aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-03-03 09:05:06 -0500
committerJan Kara <jack@suse.cz>2010-03-04 18:20:30 -0500
commit907f4554e2521cb28b0009d17167760650a9561c (patch)
tree68dc49163fd34331f8efbd63592c8f1baa387031 /fs/namei.c
parent9f7547580263d4a55efe06ce5cfd567f568be6e8 (diff)
dquot: move dquot initialization responsibility into the filesystem
Currently various places in the VFS call vfs_dq_init directly. This means we tie the quota code into the VFS. Get rid of that and make the filesystem responsible for the initialization. For most metadata operations this is a straight forward move into the methods, but for truncate and open it's a bit more complicated. For truncate we currently only call vfs_dq_init for the sys_truncate case because open already takes care of it for ftruncate and open(O_TRUNC) - the new code causes an additional vfs_dq_init for those which is harmless. For open the initialization is moved from do_filp_open into the open method, which means it happens slightly earlier now, and only for regular files. The latter is fine because we don't need to initialize it for operations on special files, and we already do it as part of the namespace operations for directories. Add a dquot_file_open helper that filesystems that support generic quotas can use to fill in ->open. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/fs/namei.c b/fs/namei.c
index a4855af776a..06abd2bf473 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -19,7 +19,6 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include <linux/namei.h> 21#include <linux/namei.h>
22#include <linux/quotaops.h>
23#include <linux/pagemap.h> 22#include <linux/pagemap.h>
24#include <linux/fsnotify.h> 23#include <linux/fsnotify.h>
25#include <linux/personality.h> 24#include <linux/personality.h>
@@ -1461,7 +1460,6 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
1461 error = security_inode_create(dir, dentry, mode); 1460 error = security_inode_create(dir, dentry, mode);
1462 if (error) 1461 if (error)
1463 return error; 1462 return error;
1464 vfs_dq_init(dir);
1465 error = dir->i_op->create(dir, dentry, mode, nd); 1463 error = dir->i_op->create(dir, dentry, mode, nd);
1466 if (!error) 1464 if (!error)
1467 fsnotify_create(dir, dentry); 1465 fsnotify_create(dir, dentry);
@@ -1813,9 +1811,6 @@ ok:
1813 } 1811 }
1814 } 1812 }
1815 if (!IS_ERR(filp)) { 1813 if (!IS_ERR(filp)) {
1816 if (acc_mode & MAY_WRITE)
1817 vfs_dq_init(nd.path.dentry->d_inode);
1818
1819 if (will_truncate) { 1814 if (will_truncate) {
1820 error = handle_truncate(&nd.path); 1815 error = handle_truncate(&nd.path);
1821 if (error) { 1816 if (error) {
@@ -1996,7 +1991,6 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
1996 if (error) 1991 if (error)
1997 return error; 1992 return error;
1998 1993
1999 vfs_dq_init(dir);
2000 error = dir->i_op->mknod(dir, dentry, mode, dev); 1994 error = dir->i_op->mknod(dir, dentry, mode, dev);
2001 if (!error) 1995 if (!error)
2002 fsnotify_create(dir, dentry); 1996 fsnotify_create(dir, dentry);
@@ -2095,7 +2089,6 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2095 if (error) 2089 if (error)
2096 return error; 2090 return error;
2097 2091
2098 vfs_dq_init(dir);
2099 error = dir->i_op->mkdir(dir, dentry, mode); 2092 error = dir->i_op->mkdir(dir, dentry, mode);
2100 if (!error) 2093 if (!error)
2101 fsnotify_mkdir(dir, dentry); 2094 fsnotify_mkdir(dir, dentry);
@@ -2181,8 +2174,6 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
2181 if (!dir->i_op->rmdir) 2174 if (!dir->i_op->rmdir)
2182 return -EPERM; 2175 return -EPERM;
2183 2176
2184 vfs_dq_init(dir);
2185
2186 mutex_lock(&dentry->d_inode->i_mutex); 2177 mutex_lock(&dentry->d_inode->i_mutex);
2187 dentry_unhash(dentry); 2178 dentry_unhash(dentry);
2188 if (d_mountpoint(dentry)) 2179 if (d_mountpoint(dentry))
@@ -2268,8 +2259,6 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
2268 if (!dir->i_op->unlink) 2259 if (!dir->i_op->unlink)
2269 return -EPERM; 2260 return -EPERM;
2270 2261
2271 vfs_dq_init(dir);
2272
2273 mutex_lock(&dentry->d_inode->i_mutex); 2262 mutex_lock(&dentry->d_inode->i_mutex);
2274 if (d_mountpoint(dentry)) 2263 if (d_mountpoint(dentry))
2275 error = -EBUSY; 2264 error = -EBUSY;
@@ -2379,7 +2368,6 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
2379 if (error) 2368 if (error)
2380 return error; 2369 return error;
2381 2370
2382 vfs_dq_init(dir);
2383 error = dir->i_op->symlink(dir, dentry, oldname); 2371 error = dir->i_op->symlink(dir, dentry, oldname);
2384 if (!error) 2372 if (!error)
2385 fsnotify_create(dir, dentry); 2373 fsnotify_create(dir, dentry);
@@ -2463,7 +2451,6 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2463 return error; 2451 return error;
2464 2452
2465 mutex_lock(&inode->i_mutex); 2453 mutex_lock(&inode->i_mutex);
2466 vfs_dq_init(dir);
2467 error = dir->i_op->link(old_dentry, dir, new_dentry); 2454 error = dir->i_op->link(old_dentry, dir, new_dentry);
2468 mutex_unlock(&inode->i_mutex); 2455 mutex_unlock(&inode->i_mutex);
2469 if (!error) 2456 if (!error)
@@ -2662,9 +2649,6 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2662 if (!old_dir->i_op->rename) 2649 if (!old_dir->i_op->rename)
2663 return -EPERM; 2650 return -EPERM;
2664 2651
2665 vfs_dq_init(old_dir);
2666 vfs_dq_init(new_dir);
2667
2668 old_name = fsnotify_oldname_init(old_dentry->d_name.name); 2652 old_name = fsnotify_oldname_init(old_dentry->d_name.name);
2669 2653
2670 if (is_dir) 2654 if (is_dir)