Re: [PATCH v2] fadvise: introduce POSIX_FADV_DONTNEED_FS

From: Mike Frysinger
Date: Wed Apr 27 2011 - 14:40:23 EST


On Wed, Apr 27, 2011 at 14:33, Matthew Wilcox wrote:
> On Wed, Apr 27, 2011 at 08:13:47PM +0200, Andrea Righi wrote:
>> @@ -127,6 +128,12 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
>> Â Â Â Â Â Â Â Â Â Â Â invalidate_mapping_pages(mapping, start_index,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â end_index);
>> Â Â Â Â Â Â Â break;
>> + Â Â case POSIX_FADV_DONTNEED_FS:
>> + Â Â Â Â Â Â if (capable(CAP_SYS_ADMIN))
>> + Â Â Â Â Â Â Â Â Â Â drop_pagecache_sb(file->f_dentry->d_sb, NULL);
>> + Â Â Â Â Â Â else
>> + Â Â Â Â Â Â Â Â Â Â ret = -EPERM;
>> + Â Â Â Â Â Â break;
>> Â Â Â default:
>> Â Â Â Â Â Â Â ret = -EINVAL;
>> Â Â Â }
>
> Mmm ... what if I open /dev/sdxyz and call fadvise() on it? ÂI think
> you end up flushing /dev's page cache entries, instead of the filesystem
> which is on /dev/sdxyz.

i was thinking of that, but was trying to come up with situations
where there might not have a node to work on. fs's in a file go
through loop devs, dm/lvm have ones created, and flash fs's still have
a mtd block. how about network based fs's ? how you going to signal
dropping of pages for nfs or cifs or fuse ones ?
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/