All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Christoph Hellwig <hch@lst.de>
Cc: viro@zeniv.linux.org.uk, npiggin@suse.de, jack@suse.cz,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 4/4] remove inode_setattr
Date: Mon, 31 May 2010 13:36:38 +0300	[thread overview]
Message-ID: <4C039136.9020709@panasas.com> (raw)
In-Reply-To: <20100531094030.GD10001@lst.de>

On 05/31/2010 12:40 PM, Christoph Hellwig wrote:
> Replace inode_setattr with opencoded variants of it in all callers.  This
> moves the remaining call to vmtruncate into the filesystem methods where it
> can be replaced with the proper truncate sequence.
> 
> In a few cases it was obvious that we would never end up calling vmtruncate
> so it was left out in the opencoded variant:
> 
>  spufs: explicitly checks for ATTR_SIZE earlier
>  btrfs,hugetlbfs,logfs,dlmfs: explicitly clears ATTR_SIZE earlier
>  ufs: contains an opencoded simple_seattr + truncate that sets the filesize just above
> 
> In addition to that ncpfs called inode_setattr with handcrafted iattrs,
> which allowed to trim down the opencoded variant.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 

<snip>

> Index: linux-2.6/fs/exofs/inode.c
> ===================================================================
> --- linux-2.6.orig/fs/exofs/inode.c	2010-05-31 10:15:55.792254729 +0200
> +++ linux-2.6/fs/exofs/inode.c	2010-05-31 10:22:36.959254590 +0200
> @@ -887,8 +887,18 @@ int exofs_setattr(struct dentry *dentry,
>  	if (error)
>  		return error;
>  
> -	error = inode_setattr(inode, iattr);
> -	return error;
> +	if ((iattr->ia_valid & ATTR_SIZE) &&
> +	    iattr->ia_size != i_size_read(inode)) {
> +		int error;
> +
> +		error = vmtruncate(inode, iattr->ia_size);
> +		if (error)
> +			return error;
> +	}
> +
> +	setattr_copy(inode, iattr);
> +	mark_inode_dirty(inode);
> +	return 0;
>  }
>  
>  static const struct osd_attr g_attr_inode_file_layout = ATTR_DEF(

Hold on to this for just a sec. I'm already testing a proper conversion
replaying the conversion done to ext2. I'll send it your way so it can
get together with this patchset. (give me couple hours)

Boaz

  reply	other threads:[~2010-05-31 10:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-31  9:39 [PATCH 0/4] second batch of new truncate sequence preparations Christoph Hellwig
2010-05-31  9:40 ` [PATCH 1/4] add missing setattr methods Christoph Hellwig
2010-05-31  9:40 ` [PATCH 2/4] rename generic_setattr Christoph Hellwig
2010-05-31  9:40 ` [PATCH 3/4] default to simple_setattr Christoph Hellwig
2010-05-31  9:40 ` [PATCH 4/4] remove inode_setattr Christoph Hellwig
2010-05-31 10:36   ` Boaz Harrosh [this message]
2010-05-31 14:04   ` Nick Piggin
2010-05-31 14:08     ` Christoph Hellwig

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=4C039136.9020709@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=npiggin@suse.de \
    --cc=viro@zeniv.linux.org.uk \
    /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.