All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew-Ztpu424NOJ8@public.gmane.org>
To: Andrea Righi <andrea-oIIqvOZpAevzfdHfmsDf5w@public.gmane.org>
Cc: Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Dave Chinner <david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org>,
	Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>,
	Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2] fadvise: introduce POSIX_FADV_DONTNEED_FS
Date: Wed, 27 Apr 2011 12:33:08 -0600	[thread overview]
Message-ID: <20110427183308.GA16716@parisc-linux.org> (raw)
In-Reply-To: <1303928027-5100-1-git-send-email-andrea-oIIqvOZpAevzfdHfmsDf5w@public.gmane.org>

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.

If I understand correctly, you want mapping->host->i_sb instead of
file->f_dentry->d_sb.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

WARNING: multiple messages have this Message-ID (diff)
From: Matthew Wilcox <matthew@wil.cx>
To: Andrea Righi <andrea@betterlinux.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Dave Chinner <david@fromorbit.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Al Viro <viro@zeniv.linux.org.uk>, Arnd Bergmann <arnd@arndb.de>,
	linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] fadvise: introduce POSIX_FADV_DONTNEED_FS
Date: Wed, 27 Apr 2011 12:33:08 -0600	[thread overview]
Message-ID: <20110427183308.GA16716@parisc-linux.org> (raw)
In-Reply-To: <1303928027-5100-1-git-send-email-andrea@betterlinux.com>

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.

If I understand correctly, you want mapping->host->i_sb instead of
file->f_dentry->d_sb.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  parent reply	other threads:[~2011-04-27 18:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27 18:13 [PATCH v2] fadvise: introduce POSIX_FADV_DONTNEED_FS Andrea Righi
2011-04-27 18:13 ` Andrea Righi
     [not found] ` <1303928027-5100-1-git-send-email-andrea-oIIqvOZpAevzfdHfmsDf5w@public.gmane.org>
2011-04-27 18:25   ` Mike Frysinger
2011-04-27 18:25     ` Mike Frysinger
2011-04-28  9:35     ` Andrea Righi
2011-04-27 18:33   ` Matthew Wilcox [this message]
2011-04-27 18:33     ` Matthew Wilcox
     [not found]     ` <20110427183308.GA16716-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
2011-04-27 18:39       ` Mike Frysinger
2011-04-27 18:39         ` Mike Frysinger
2011-04-27 18:47         ` Matthew Wilcox
     [not found]           ` <20110427184756.GB16716-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
2011-04-27 18:49             ` Mike Frysinger
2011-04-27 18:49               ` Mike Frysinger
2011-04-28  9:29     ` Andrea Righi
2011-05-04 21:44   ` Andrew Morton
2011-05-04 21:44     ` Andrew Morton
     [not found]     ` <20110504144411.7f32c00c.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2011-05-04 22:09       ` Andrea Righi
2011-05-04 22:09         ` Andrea Righi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110427183308.GA16716@parisc-linux.org \
    --to=matthew-ztpu424noj8@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=andrea-oIIqvOZpAevzfdHfmsDf5w@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.