From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Subject: Re: [PATCH v2] fadvise: introduce POSIX_FADV_DONTNEED_FS Date: Wed, 27 Apr 2011 14:39:53 -0400 Message-ID: References: <1303928027-5100-1-git-send-email-andrea@betterlinux.com> <20110427183308.GA16716@parisc-linux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Andrea Righi , Andrew Morton , Dave Chinner , Al Viro , Arnd Bergmann , linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Matthew Wilcox Return-path: In-Reply-To: <20110427183308.GA16716-6jwH94ZQLHl74goWV3ctuw@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org 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 off= set, loff_t len, int advice) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 invalidate_mapping_pages(mapping, start_index, >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 end_index); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> + =C2=A0 =C2=A0 case POSIX_FADV_DONTNEED_FS: >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (capable(CAP_SYS_ADMI= N)) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 drop_pagecache_sb(file->f_dentry->d_sb, NULL); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 ret =3D -EPERM; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> =C2=A0 =C2=A0 =C2=A0 default: >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D -EINVAL; >> =C2=A0 =C2=A0 =C2=A0 } > > Mmm ... what if I open /dev/sdxyz and call fadvise() on it? =C2=A0I t= hink > you end up flushing /dev's page cache entries, instead of the filesys= tem > 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