ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: Remove the deprecated inode_setattr.
Date: Wed, 9 Jun 2010 03:08:39 -0700	[thread overview]
Message-ID: <20100609100839.GA21239@mail.oracle.com> (raw)
In-Reply-To: <1276073300-7360-1-git-send-email-tao.ma@oracle.com>

On Wed, Jun 09, 2010 at 04:48:20PM +0800, Tao Ma wrote:
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index 6a13ea6..06fd85c 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -1052,17 +1052,17 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
>  	}
>  
>  	/*
> -	 * This will intentionally not wind up calling simple_setsize(),
> -	 * since all the work for a size change has been done above.
> -	 * Otherwise, we could get into problems with truncate as
> -	 * ip_alloc_sem is used there to protect against i_size
> -	 * changes.
> +	 * Since all the work for a size change has been done above,
> +	 * we only need to call simple_setsize to update i_size.
>  	 */
> -	status = inode_setattr(inode, attr);
> -	if (status < 0) {
> -		mlog_errno(status);
> -		goto bail_commit;
> +	if (attr->ia_valid & ATTR_SIZE) {
> +		status = simple_setsize(inode, attr->ia_size);
> +		if (status < 0) {
> +			mlog_errno(status);
> +			goto bail_commit;
> +		}

	Boy, this is a bit to think about.  The old code deliberately
used vmtruncate() to update i_size and trim the pagecace, but because we
didn't implement ->truncate() we knew that we wouldn't modify the
(already adjusted) allocation.  Not buggy, Christoph, just a roundabout
way to get the job done.
	The new simple_setsize() does nothing but update i_size and trim
the pagecache, right Nick?  If that's so, that's all we need.

Joel

-- 

"Also, all of life's big problems include the words 'indictment' or
	'inoperable.' Everything else is small stuff."
	- Alton Brown

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127

  parent reply	other threads:[~2010-06-09 10:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09  8:48 [Ocfs2-devel] [PATCH] ocfs2: Remove the deprecated inode_setattr Tao Ma
2010-06-09  9:16 ` Nick Piggin
2010-06-09  9:29   ` Tao Ma
2010-06-09  9:38     ` Nick Piggin
2010-06-09 10:12       ` Joel Becker
2010-06-09 10:14         ` Christoph Hellwig
2010-06-09 19:53           ` Joel Becker
2010-06-09 10:01   ` Christoph Hellwig
2010-06-09 13:43     ` Tao Ma
2010-06-09 10:08 ` Joel Becker [this message]
2010-06-09 10:43   ` Nick Piggin
2010-06-09 13:54   ` Tao Ma

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=20100609100839.GA21239@mail.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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).