linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [patch 4/5] tmpfs: convert to use the new truncate convention
Date: Mon, 17 Aug 2009 09:32:55 +0200	[thread overview]
Message-ID: <20090817073255.GE9962@wotan.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0908161930160.16622@sister.anvils>

On Sun, Aug 16, 2009 at 07:38:51PM +0100, Hugh Dickins wrote:
> On Sun, 16 Aug 2009, npiggin@suse.de wrote:
> >  mm/shmem.c |   35 +++++++++++++++++++----------------
> >  1 file changed, 19 insertions(+), 16 deletions(-)
> 
> That looks fine to me, thanks Nick, with one reservation:
> there is no case (at present anyway) in which simple_setsize()
> can fail with non-NULL page to release; but that does depend upon
> some inside knowledge, so it'll look less worrying if we move up
> the page_cache_release.  Please fold the below patch in to add my

Ah good point, that looks much better. Thanks Hugh.

> 
> Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
> 
> --- 2.6.31-rc6-trunc/mm/shmem.c	2009-08-16 17:09:57.000000000 +0100
> +++ linux/mm/shmem.c	2009-08-16 19:11:51.000000000 +0100
> @@ -767,13 +767,13 @@ done2:
>  static int shmem_notify_change(struct dentry *dentry, struct iattr *attr)
>  {
>  	struct inode *inode = dentry->d_inode;
> -	struct page *page = NULL;
>  	int error;
>  
>  	if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) {
>  		loff_t newsize = attr->ia_size;
> +		struct page *page = NULL;
>  
> -		if (attr->ia_size < inode->i_size) {
> +		if (newsize < inode->i_size) {
>  			/*
>  			 * If truncating down to a partial page, then
>  			 * if that page is already allocated, hold it
> @@ -804,6 +804,8 @@ static int shmem_notify_change(struct de
>  		}
>  
>  		error = simple_setsize(inode, newsize);
> +		if (page)
> +			page_cache_release(page);
>  		if (error)
>  			return error;
>  		shmem_truncate_range(inode, newsize, (loff_t)-1);
> @@ -817,8 +819,6 @@ static int shmem_notify_change(struct de
>  	if (!error && (attr->ia_valid & ATTR_MODE))
>  		error = generic_acl_chmod(inode, &shmem_acl_ops);
>  #endif
> -	if (page)
> -		page_cache_release(page);
>  	return error;
>  }
>  

  reply	other threads:[~2009-08-17  7:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-16 10:25 [patch 0/5] new truncate sequence npiggin
2009-08-16 10:25 ` [patch 1/5] fs: new truncate helpers npiggin
2009-08-16 10:25 ` [patch 2/5] fs: use " npiggin-l3A5Bk7waGM
2009-08-16 10:25 ` [patch 3/5] fs: introduce new truncate sequence npiggin
2009-08-16 19:39   ` Christoph Hellwig
2009-08-17  6:38     ` Nick Piggin
2009-08-17 16:41     ` Nick Piggin
2009-08-17 18:06       ` Christoph Hellwig
2009-08-18  9:19         ` Nick Piggin
2009-08-16 10:25 ` [patch 4/5] tmpfs: convert to use the new truncate convention npiggin
2009-08-16 18:38   ` Hugh Dickins
2009-08-17  7:32     ` Nick Piggin [this message]
2009-08-16 10:25 ` [patch 5/5] ext2: " npiggin
2009-08-16 20:16   ` Christoph Hellwig
2009-08-17  6:42     ` Nick Piggin
2009-08-17 11:09       ` Boaz Harrosh
2009-08-17 16:44         ` Nick Piggin
  -- strict thread matches above, loose matches on Subject: below --
2009-07-10  7:30 [patch 0/5] new truncate sequence patchset npiggin
2009-07-10  7:30 ` [patch 4/5] tmpfs: convert to use the new truncate convention npiggin

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=20090817073255.GE9962@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=hch@lst.de \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=linux-fsdevel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).