From: Christoph Hellwig <hch@infradead.org>
To: jack@suse.cz
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH 4/8] dquot: cleanup dquot transfer routine
Date: Sat, 20 Feb 2010 06:51:05 -0500 [thread overview]
Message-ID: <20100220115213.269522934@bombadil.infradead.org> (raw)
In-Reply-To: 20100220115101.469826792@bombadil.infradead.org
[-- Attachment #1: quota-kill-transfer --]
[-- Type: text/plain, Size: 12369 bytes --]
Get rid of the transfer dquot operation - it is now always called from
the filesystem and if a filesystem really needs it's own (which none
currently does) it can just call into it's own routine directly.
Rename the now static low-level dquot_transfer helper to __dquot_transfer
and vfs_dq_transfer to dquot_transfer to have a consistent namespace,
and make the new dquot_transfer return a normal negative errno value
which all callers expect.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/Documentation/filesystems/Locking
===================================================================
--- linux-2.6.orig/Documentation/filesystems/Locking 2010-02-20 11:48:48.624253837 +0100
+++ linux-2.6/Documentation/filesystems/Locking 2010-02-20 11:55:53.694023148 +0100
@@ -462,7 +462,6 @@ in sys_read() and friends.
prototypes:
int (*initialize) (struct inode *, int);
int (*drop) (struct inode *);
- int (*transfer) (struct inode *, struct iattr *);
int (*write_dquot) (struct dquot *);
int (*acquire_dquot) (struct dquot *);
int (*release_dquot) (struct dquot *);
@@ -477,7 +476,6 @@ What filesystem should expect from the g
FS recursion Held locks when called
initialize: yes maybe dqonoff_sem
drop: yes -
-transfer: yes -
write_dquot: yes dqonoff_sem or dqptr_sem
acquire_dquot: yes dqonoff_sem or dqptr_sem
release_dquot: yes dqonoff_sem or dqptr_sem
Index: linux-2.6/fs/ext3/super.c
===================================================================
--- linux-2.6.orig/fs/ext3/super.c 2010-02-20 11:48:48.626253697 +0100
+++ linux-2.6/fs/ext3/super.c 2010-02-20 11:55:53.695023428 +0100
@@ -752,7 +752,6 @@ static ssize_t ext3_quota_write(struct s
static const struct dquot_operations ext3_quota_operations = {
.initialize = dquot_initialize,
.drop = dquot_drop,
- .transfer = dquot_transfer,
.write_dquot = ext3_write_dquot,
.acquire_dquot = ext3_acquire_dquot,
.release_dquot = ext3_release_dquot,
Index: linux-2.6/fs/ext4/super.c
===================================================================
--- linux-2.6.orig/fs/ext4/super.c 2010-02-20 11:48:48.633253627 +0100
+++ linux-2.6/fs/ext4/super.c 2010-02-20 11:55:53.706254954 +0100
@@ -1017,7 +1017,6 @@ static const struct dquot_operations ext
#ifdef CONFIG_QUOTA
.get_reserved_space = ext4_get_reserved_space,
#endif
- .transfer = dquot_transfer,
.write_dquot = ext4_write_dquot,
.acquire_dquot = ext4_acquire_dquot,
.release_dquot = ext4_release_dquot,
Index: linux-2.6/fs/ocfs2/quota_global.c
===================================================================
--- linux-2.6.orig/fs/ocfs2/quota_global.c 2010-02-20 11:48:48.666256212 +0100
+++ linux-2.6/fs/ocfs2/quota_global.c 2010-02-20 11:55:53.733255653 +0100
@@ -853,7 +853,6 @@ static void ocfs2_destroy_dquot(struct d
const struct dquot_operations ocfs2_quota_operations = {
.initialize = dquot_initialize,
.drop = dquot_drop,
- .transfer = dquot_transfer,
.write_dquot = ocfs2_write_dquot,
.acquire_dquot = ocfs2_acquire_dquot,
.release_dquot = ocfs2_release_dquot,
Index: linux-2.6/fs/quota/dquot.c
===================================================================
--- linux-2.6.orig/fs/quota/dquot.c 2010-02-20 11:50:33.509255304 +0100
+++ linux-2.6/fs/quota/dquot.c 2010-02-20 11:55:53.742255234 +0100
@@ -1669,7 +1669,7 @@ EXPORT_SYMBOL(dquot_free_inode);
* This operation can block, but only after everything is updated
* A transaction must be started when entering this function.
*/
-int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask)
+static int __dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask)
{
qsize_t space, cur_space;
qsize_t rsv_space = 0;
@@ -1766,12 +1766,11 @@ over_quota:
ret = NO_QUOTA;
goto warn_put_all;
}
-EXPORT_SYMBOL(dquot_transfer);
/* Wrapper for transferring ownership of an inode for uid/gid only
* Called from FSXXX_setattr()
*/
-int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
+int dquot_transfer(struct inode *inode, struct iattr *iattr)
{
qid_t chid[MAXQUOTAS];
unsigned long mask = 0;
@@ -1786,12 +1785,12 @@ int vfs_dq_transfer(struct inode *inode,
}
if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) {
vfs_dq_init(inode);
- if (inode->i_sb->dq_op->transfer(inode, chid, mask) == NO_QUOTA)
- return 1;
+ if (__dquot_transfer(inode, chid, mask) == NO_QUOTA)
+ return -EDQUOT;
}
return 0;
}
-EXPORT_SYMBOL(vfs_dq_transfer);
+EXPORT_SYMBOL(dquot_transfer);
/*
* Write info of quota file to disk
@@ -1814,7 +1813,6 @@ EXPORT_SYMBOL(dquot_commit_info);
const struct dquot_operations dquot_operations = {
.initialize = dquot_initialize,
.drop = dquot_drop,
- .transfer = dquot_transfer,
.write_dquot = dquot_commit,
.acquire_dquot = dquot_acquire,
.release_dquot = dquot_release,
Index: linux-2.6/fs/reiserfs/super.c
===================================================================
--- linux-2.6.orig/fs/reiserfs/super.c 2010-02-20 11:48:48.691005897 +0100
+++ linux-2.6/fs/reiserfs/super.c 2010-02-20 11:55:53.756256212 +0100
@@ -618,7 +618,6 @@ static int reiserfs_quota_on(struct supe
static const struct dquot_operations reiserfs_quota_operations = {
.initialize = dquot_initialize,
.drop = dquot_drop,
- .transfer = dquot_transfer,
.write_dquot = reiserfs_write_dquot,
.acquire_dquot = reiserfs_acquire_dquot,
.release_dquot = reiserfs_release_dquot,
Index: linux-2.6/include/linux/quota.h
===================================================================
--- linux-2.6.orig/include/linux/quota.h 2010-02-20 11:48:48.696005828 +0100
+++ linux-2.6/include/linux/quota.h 2010-02-20 11:55:53.761255862 +0100
@@ -297,7 +297,6 @@ struct quota_format_ops {
struct dquot_operations {
int (*initialize) (struct inode *, int);
int (*drop) (struct inode *);
- int (*transfer) (struct inode *, qid_t *, unsigned long);
int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */
Index: linux-2.6/include/linux/quotaops.h
===================================================================
--- linux-2.6.orig/include/linux/quotaops.h 2010-02-20 11:48:48.698006456 +0100
+++ linux-2.6/include/linux/quotaops.h 2010-02-20 11:55:53.763255583 +0100
@@ -42,7 +42,6 @@ int dquot_alloc_inode(const struct inode
int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
void dquot_free_inode(const struct inode *inode);
-int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask);
int dquot_commit(struct dquot *dquot);
int dquot_acquire(struct dquot *dquot);
int dquot_release(struct dquot *dquot);
@@ -66,7 +65,7 @@ int vfs_get_dqblk(struct super_block *sb
int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
void vfs_dq_drop(struct inode *inode);
-int vfs_dq_transfer(struct inode *inode, struct iattr *iattr);
+int dquot_transfer(struct inode *inode, struct iattr *iattr);
int vfs_dq_quota_on_remount(struct super_block *sb);
static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
@@ -234,7 +233,7 @@ static inline int vfs_dq_quota_on_remoun
return 0;
}
-static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
+static inline int dquot_transfer(struct inode *inode, struct iattr *iattr)
{
return 0;
}
Index: linux-2.6/drivers/staging/pohmelfs/inode.c
===================================================================
--- linux-2.6.orig/drivers/staging/pohmelfs/inode.c 2010-02-20 11:40:49.947004081 +0100
+++ linux-2.6/drivers/staging/pohmelfs/inode.c 2010-02-20 11:55:53.767255443 +0100
@@ -969,7 +969,7 @@ int pohmelfs_setattr_raw(struct inode *i
if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
(attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
- err = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
+ err = dquot_transfer(inode, attr);
if (err)
goto err_out_exit;
}
Index: linux-2.6/fs/ext2/inode.c
===================================================================
--- linux-2.6.orig/fs/ext2/inode.c 2010-02-20 11:40:49.886253766 +0100
+++ linux-2.6/fs/ext2/inode.c 2010-02-20 11:55:53.772255862 +0100
@@ -1459,7 +1459,7 @@ int ext2_setattr(struct dentry *dentry,
return error;
if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
(iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
- error = vfs_dq_transfer(inode, iattr) ? -EDQUOT : 0;
+ error = dquot_transfer(inode, iattr);
if (error)
return error;
}
Index: linux-2.6/fs/ext3/inode.c
===================================================================
--- linux-2.6.orig/fs/ext3/inode.c 2010-02-20 11:46:29.838255793 +0100
+++ linux-2.6/fs/ext3/inode.c 2010-02-20 11:55:53.781265570 +0100
@@ -3152,7 +3152,7 @@ int ext3_setattr(struct dentry *dentry,
error = PTR_ERR(handle);
goto err_out;
}
- error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
+ error = dquot_transfer(inode, attr);
if (error) {
ext3_journal_stop(handle);
return error;
Index: linux-2.6/fs/ext4/inode.c
===================================================================
--- linux-2.6.orig/fs/ext4/inode.c 2010-02-20 11:46:29.854255514 +0100
+++ linux-2.6/fs/ext4/inode.c 2010-02-20 11:55:53.804005688 +0100
@@ -5261,7 +5261,7 @@ int ext4_setattr(struct dentry *dentry,
error = PTR_ERR(handle);
goto err_out;
}
- error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
+ error = dquot_transfer(inode, attr);
if (error) {
ext4_journal_stop(handle);
return error;
Index: linux-2.6/fs/ocfs2/file.c
===================================================================
--- linux-2.6.orig/fs/ocfs2/file.c 2010-02-20 11:46:30.009005758 +0100
+++ linux-2.6/fs/ocfs2/file.c 2010-02-20 11:55:53.836005270 +0100
@@ -1021,7 +1021,7 @@ int ocfs2_setattr(struct dentry *dentry,
/*
* Gather pointers to quota structures so that allocation /
* freeing of quota structures happens here and not inside
- * vfs_dq_transfer() where we have problems with lock ordering
+ * dquot_transfer() where we have problems with lock ordering
*/
if (attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid
&& OCFS2_HAS_RO_COMPAT_FEATURE(sb,
@@ -1054,7 +1054,7 @@ int ocfs2_setattr(struct dentry *dentry,
mlog_errno(status);
goto bail_unlock;
}
- status = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
+ status = dquot_transfer(inode, attr);
if (status < 0)
goto bail_commit;
} else {
Index: linux-2.6/fs/reiserfs/inode.c
===================================================================
--- linux-2.6.orig/fs/reiserfs/inode.c 2010-02-20 11:48:48.735005688 +0100
+++ linux-2.6/fs/reiserfs/inode.c 2010-02-20 11:55:53.847006037 +0100
@@ -3135,8 +3135,7 @@ int reiserfs_setattr(struct dentry *dent
jbegin_count);
if (error)
goto out;
- error =
- vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
+ error = dquot_transfer(inode, attr);
if (error) {
journal_end(&th, inode->i_sb,
jbegin_count);
Index: linux-2.6/fs/ufs/truncate.c
===================================================================
--- linux-2.6.orig/fs/ufs/truncate.c 2010-02-20 11:53:51.125252859 +0100
+++ linux-2.6/fs/ufs/truncate.c 2010-02-20 11:55:53.855009459 +0100
@@ -520,7 +520,7 @@ static int ufs_setattr(struct dentry *de
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;
+ error = dquot_transfer(inode, attr);
if (error)
return error;
}
Index: linux-2.6/fs/jfs/file.c
===================================================================
--- linux-2.6.orig/fs/jfs/file.c 2010-02-20 11:53:51.132291971 +0100
+++ linux-2.6/fs/jfs/file.c 2010-02-20 11:55:53.857256072 +0100
@@ -100,8 +100,9 @@ int jfs_setattr(struct dentry *dentry, s
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 = dquot_transfer(inode, iattr);
+ if (rc)
+ return rc;
}
rc = inode_setattr(inode, iattr);
next prev parent reply other threads:[~2010-02-20 11:52 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
2010-02-20 11:51 ` Christoph Hellwig [this message]
2010-02-24 23:14 ` [PATCH 4/8] dquot: cleanup dquot transfer routine 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=20100220115213.269522934@bombadil.infradead.org \
--to=hch@infradead.org \
--cc=jack@suse.cz \
--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).