linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Christoph Hellwig <hch@infradead.org>
Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/8] dquot: move dquot transfer responsibiliy into the filesystem
Date: Thu, 25 Feb 2010 00:06:07 +0100	[thread overview]
Message-ID: <20100224230607.GD3097@quack.suse.cz> (raw)
In-Reply-To: <20100220115212.927441586@bombadil.infradead.org>

On Sat 20-02-10 06:51:04, Christoph Hellwig wrote:
> Currently notify_change calls vfs_dq_transfer directly.  This means
> we tie the quota code into the VFS.  Get rid of that and make the
> filesystem responsibly for the transfer.  Most filesystems already
> do this, only ufs needs the code added, and for jfs it needs to be
> enabled unconditionally instead of only when ACLs are enabled.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
  Looks good. Merged.

								Honza

> Index: linux-2.6/fs/attr.c
> ===================================================================
> --- linux-2.6.orig/fs/attr.c	2010-02-19 11:45:24.904272974 +0100
> +++ linux-2.6/fs/attr.c	2010-02-19 11:45:43.050005619 +0100
> @@ -12,7 +12,6 @@
>  #include <linux/capability.h>
>  #include <linux/fsnotify.h>
>  #include <linux/fcntl.h>
> -#include <linux/quotaops.h>
>  #include <linux/security.h>
>  
>  /* Taken over from the old code... */
> @@ -212,14 +211,8 @@ int notify_change(struct dentry * dentry
>  		error = inode->i_op->setattr(dentry, attr);
>  	} else {
>  		error = inode_change_ok(inode, attr);
> -		if (!error) {
> -			if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
> -			    (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))
> -				error = vfs_dq_transfer(inode, attr) ?
> -					-EDQUOT : 0;
> -			if (!error)
> -				error = inode_setattr(inode, attr);
> -		}
> +		if (!error)
> +			error = inode_setattr(inode, attr);
>  	}
>  
>  	if (ia_valid & ATTR_SIZE)
> Index: linux-2.6/fs/ufs/truncate.c
> ===================================================================
> --- linux-2.6.orig/fs/ufs/truncate.c	2010-02-19 11:45:24.913004221 +0100
> +++ linux-2.6/fs/ufs/truncate.c	2010-02-19 15:08:15.042023986 +0100
> @@ -44,6 +44,7 @@
>  #include <linux/buffer_head.h>
>  #include <linux/blkdev.h>
>  #include <linux/sched.h>
> +#include <linux/quotaops.h>
>  
>  #include "ufs_fs.h"
>  #include "ufs.h"
> @@ -517,6 +518,12 @@ static int ufs_setattr(struct dentry *de
>  	if (error)
>  		return error;
>  
> +	if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
> +	    (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
> +		error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
> +		if (error)
> +			return error;
> +	}
>  	if (ia_valid & ATTR_SIZE &&
>  	    attr->ia_size != i_size_read(inode)) {
>  		loff_t old_i_size = inode->i_size;
> Index: linux-2.6/fs/jfs/acl.c
> ===================================================================
> --- linux-2.6.orig/fs/jfs/acl.c	2010-02-19 11:45:24.919010367 +0100
> +++ linux-2.6/fs/jfs/acl.c	2010-02-19 11:45:32.078271367 +0100
> @@ -20,7 +20,6 @@
>  
>  #include <linux/sched.h>
>  #include <linux/fs.h>
> -#include <linux/quotaops.h>
>  #include <linux/posix_acl_xattr.h>
>  #include "jfs_incore.h"
>  #include "jfs_txnmgr.h"
> @@ -174,7 +173,7 @@ cleanup:
>  	return rc;
>  }
>  
> -static int jfs_acl_chmod(struct inode *inode)
> +int jfs_acl_chmod(struct inode *inode)
>  {
>  	struct posix_acl *acl, *clone;
>  	int rc;
> @@ -205,26 +204,3 @@ static int jfs_acl_chmod(struct inode *i
>  	posix_acl_release(clone);
>  	return rc;
>  }
> -
> -int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
> -{
> -	struct inode *inode = dentry->d_inode;
> -	int rc;
> -
> -	rc = inode_change_ok(inode, iattr);
> -	if (rc)
> -		return rc;
> -
> -	if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
> -	    (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
> -		if (vfs_dq_transfer(inode, iattr))
> -			return -EDQUOT;
> -	}
> -
> -	rc = inode_setattr(inode, iattr);
> -
> -	if (!rc && (iattr->ia_valid & ATTR_MODE))
> -		rc = jfs_acl_chmod(inode);
> -
> -	return rc;
> -}
> Index: linux-2.6/fs/jfs/file.c
> ===================================================================
> --- linux-2.6.orig/fs/jfs/file.c	2010-02-19 11:45:24.929004081 +0100
> +++ linux-2.6/fs/jfs/file.c	2010-02-19 15:08:02.655004431 +0100
> @@ -18,6 +18,7 @@
>   */
>  
>  #include <linux/fs.h>
> +#include <linux/quotaops.h>
>  #include "jfs_incore.h"
>  #include "jfs_inode.h"
>  #include "jfs_dmap.h"
> @@ -88,14 +89,37 @@ static int jfs_release(struct inode *ino
>  	return 0;
>  }
>  
> +int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
> +{
> +	struct inode *inode = dentry->d_inode;
> +	int rc;
> +
> +	rc = inode_change_ok(inode, iattr);
> +	if (rc)
> +		return rc;
> +
> +	if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
> +	    (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
> +		if (vfs_dq_transfer(inode, iattr))
> +			return -EDQUOT;
> +	}
> +
> +	rc = inode_setattr(inode, iattr);
> +
> +	if (!rc && (iattr->ia_valid & ATTR_MODE))
> +		rc = jfs_acl_chmod(inode);
> +
> +	return rc;
> +}
> +
>  const struct inode_operations jfs_file_inode_operations = {
>  	.truncate	= jfs_truncate,
>  	.setxattr	= jfs_setxattr,
>  	.getxattr	= jfs_getxattr,
>  	.listxattr	= jfs_listxattr,
>  	.removexattr	= jfs_removexattr,
> -#ifdef CONFIG_JFS_POSIX_ACL
>  	.setattr	= jfs_setattr,
> +#ifdef CONFIG_JFS_POSIX_ACL
>  	.check_acl	= jfs_check_acl,
>  #endif
>  };
> Index: linux-2.6/fs/jfs/jfs_acl.h
> ===================================================================
> --- linux-2.6.orig/fs/jfs/jfs_acl.h	2010-02-19 11:45:24.936025523 +0100
> +++ linux-2.6/fs/jfs/jfs_acl.h	2010-02-19 11:45:32.085271437 +0100
> @@ -22,7 +22,7 @@
>  
>  int jfs_check_acl(struct inode *, int);
>  int jfs_init_acl(tid_t, struct inode *, struct inode *);
> -int jfs_setattr(struct dentry *, struct iattr *);
> +int jfs_acl_chmod(struct inode *inode);
>  
>  #else
>  
> @@ -32,5 +32,10 @@ static inline int jfs_init_acl(tid_t tid
>  	return 0;
>  }
>  
> +static inline int jfs_acl_chmod(struct inode *inode)
> +{
> +	return 0;
> +}
> +
>  #endif
>  #endif		/* _H_JFS_ACL */
> Index: linux-2.6/fs/jfs/jfs_inode.h
> ===================================================================
> --- linux-2.6.orig/fs/jfs/jfs_inode.h	2010-02-19 11:45:24.944024894 +0100
> +++ linux-2.6/fs/jfs/jfs_inode.h	2010-02-19 11:45:32.090281355 +0100
> @@ -40,6 +40,7 @@ extern struct dentry *jfs_fh_to_parent(s
>  	int fh_len, int fh_type);
>  extern void jfs_set_inode_flags(struct inode *);
>  extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
> +extern int jfs_setattr(struct dentry *, struct iattr *);
>  
>  extern const struct address_space_operations jfs_aops;
>  extern const struct inode_operations jfs_dir_inode_operations;
> Index: linux-2.6/fs/jfs/namei.c
> ===================================================================
> --- linux-2.6.orig/fs/jfs/namei.c	2010-02-19 11:45:24.955254046 +0100
> +++ linux-2.6/fs/jfs/namei.c	2010-02-19 14:53:30.838004431 +0100
> @@ -1541,8 +1541,8 @@ const struct inode_operations jfs_dir_in
>  	.getxattr	= jfs_getxattr,
>  	.listxattr	= jfs_listxattr,
>  	.removexattr	= jfs_removexattr,
> -#ifdef CONFIG_JFS_POSIX_ACL
>  	.setattr	= jfs_setattr,
> +#ifdef CONFIG_JFS_POSIX_ACL
>  	.check_acl	= jfs_check_acl,
>  #endif
>  };
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2010-02-24 23:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-20 11:51 [PATCH 0/8] dquot interface cleanups Christoph Hellwig
2010-02-20 11:51 ` [PATCH 1/8] dquot: cleanup space allocation / freeing routines Christoph Hellwig
2010-02-24 22:09   ` Jan Kara
2010-02-20 11:51 ` [PATCH 2/8] dquot: cleanup inode " Christoph Hellwig
2010-02-24 22:39   ` Jan Kara
2010-02-20 11:51 ` [PATCH 3/8] dquot: move dquot transfer responsibiliy into the filesystem Christoph Hellwig
2010-02-24 23:06   ` Jan Kara [this message]
2010-02-20 11:51 ` [PATCH 4/8] dquot: cleanup dquot transfer routine Christoph Hellwig
2010-02-24 23:14   ` Jan Kara
2010-03-01  9:50     ` Christoph Hellwig
2010-03-01 10:40       ` Jan Kara
2010-03-01 11:20         ` Dmitry Monakhov
2010-03-01 13:45           ` Jan Kara
2010-03-01 14:18             ` commiting unreviewed patches, was " Christoph Hellwig
2010-03-02 17:43               ` Jan Kara
2010-02-20 11:51 ` [PATCH 5/8] dquot: move dquot drop responsibiliy into the filesystem Christoph Hellwig
2010-02-25  0:00   ` Jan Kara
2010-02-20 11:51 ` [PATCH 6/8] dquot: cleanup dquot drop routine Christoph Hellwig
2010-02-25  0:08   ` Jan Kara
2010-02-20 11:51 ` [PATCH 7/8] dquot: move dquot initialization responsibiliy into the filesystem Christoph Hellwig
2010-02-25  0:29   ` Jan Kara
2010-03-02 18:44   ` Jan Kara
2010-03-02 19:50     ` Christoph Hellwig
2010-03-03  8:16       ` Jan Kara
2010-03-03 13:02         ` Christoph Hellwig
2010-02-20 11:51 ` [PATCH 8/8] dquot: cleanup dquot initialize routine 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=20100224230607.GD3097@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=hch@infradead.org \
    --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).