aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-05 16:20:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-05 16:20:53 -0500
commite213e26ab3988c516c06eba4dcd030ac052f6dc9 (patch)
tree6e26fbdbb842b387697d73daf6e70cf718269a77 /fs/jfs
parentc812a51d11bbe983f4c24e32b59b265705ddd3c2 (diff)
parentefd8f0e6f6c1faa041f228d7113bd3a9db802d49 (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: (33 commits) quota: stop using QUOTA_OK / NO_QUOTA dquot: cleanup dquot initialize routine dquot: move dquot initialization responsibility into the filesystem dquot: cleanup dquot drop routine dquot: move dquot drop responsibility into the filesystem dquot: cleanup dquot transfer routine dquot: move dquot transfer responsibility into the filesystem dquot: cleanup inode allocation / freeing routines dquot: cleanup space allocation / freeing routines ext3: add writepage sanity checks ext3: Truncate allocated blocks if direct IO write fails to update i_size quota: Properly invalidate caches even for filesystems with blocksize < pagesize quota: generalize quota transfer interface quota: sb_quota state flags cleanup jbd: Delay discarding buffers in journal_unmap_buffer ext3: quota_write cross block boundary behaviour quota: drop permission checks from xfs_fs_set_xstate/xfs_fs_set_xquota quota: split out compat_sys_quotactl support from quota.c quota: split out netlink notification support from quota.c quota: remove invalid optimization from quota_sync_all ... Fixed trivial conflicts in fs/namei.c and fs/ufs/inode.c
Diffstat (limited to 'fs/jfs')
-rw-r--r--fs/jfs/acl.c26
-rw-r--r--fs/jfs/file.c31
-rw-r--r--fs/jfs/inode.c9
-rw-r--r--fs/jfs/jfs_acl.h7
-rw-r--r--fs/jfs/jfs_dtree.c28
-rw-r--r--fs/jfs/jfs_extent.c16
-rw-r--r--fs/jfs/jfs_inode.c8
-rw-r--r--fs/jfs/jfs_inode.h1
-rw-r--r--fs/jfs/jfs_xtree.c21
-rw-r--r--fs/jfs/namei.c23
-rw-r--r--fs/jfs/super.c6
-rw-r--r--fs/jfs/xattr.c17
12 files changed, 116 insertions, 77 deletions
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index d66477c34306..213169780b6c 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/fs.h> 22#include <linux/fs.h>
23#include <linux/quotaops.h>
24#include <linux/posix_acl_xattr.h> 23#include <linux/posix_acl_xattr.h>
25#include "jfs_incore.h" 24#include "jfs_incore.h"
26#include "jfs_txnmgr.h" 25#include "jfs_txnmgr.h"
@@ -174,7 +173,7 @@ cleanup:
174 return rc; 173 return rc;
175} 174}
176 175
177static int jfs_acl_chmod(struct inode *inode) 176int jfs_acl_chmod(struct inode *inode)
178{ 177{
179 struct posix_acl *acl, *clone; 178 struct posix_acl *acl, *clone;
180 int rc; 179 int rc;
@@ -205,26 +204,3 @@ static int jfs_acl_chmod(struct inode *inode)
205 posix_acl_release(clone); 204 posix_acl_release(clone);
206 return rc; 205 return rc;
207} 206}
208
209int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
210{
211 struct inode *inode = dentry->d_inode;
212 int rc;
213
214 rc = inode_change_ok(inode, iattr);
215 if (rc)
216 return rc;
217
218 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
219 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
220 if (vfs_dq_transfer(inode, iattr))
221 return -EDQUOT;
222 }
223
224 rc = inode_setattr(inode, iattr);
225
226 if (!rc && (iattr->ia_valid & ATTR_MODE))
227 rc = jfs_acl_chmod(inode);
228
229 return rc;
230}
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index 2b70fa78e4a7..14ba982b3f24 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -18,6 +18,7 @@
18 */ 18 */
19 19
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include <linux/quotaops.h>
21#include "jfs_incore.h" 22#include "jfs_incore.h"
22#include "jfs_inode.h" 23#include "jfs_inode.h"
23#include "jfs_dmap.h" 24#include "jfs_dmap.h"
@@ -47,7 +48,7 @@ static int jfs_open(struct inode *inode, struct file *file)
47{ 48{
48 int rc; 49 int rc;
49 50
50 if ((rc = generic_file_open(inode, file))) 51 if ((rc = dquot_file_open(inode, file)))
51 return rc; 52 return rc;
52 53
53 /* 54 /*
@@ -88,14 +89,40 @@ static int jfs_release(struct inode *inode, struct file *file)
88 return 0; 89 return 0;
89} 90}
90 91
92int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
93{
94 struct inode *inode = dentry->d_inode;
95 int rc;
96
97 rc = inode_change_ok(inode, iattr);
98 if (rc)
99 return rc;
100
101 if (iattr->ia_valid & ATTR_SIZE)
102 dquot_initialize(inode);
103 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
104 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
105 rc = dquot_transfer(inode, iattr);
106 if (rc)
107 return rc;
108 }
109
110 rc = inode_setattr(inode, iattr);
111
112 if (!rc && (iattr->ia_valid & ATTR_MODE))
113 rc = jfs_acl_chmod(inode);
114
115 return rc;
116}
117
91const struct inode_operations jfs_file_inode_operations = { 118const struct inode_operations jfs_file_inode_operations = {
92 .truncate = jfs_truncate, 119 .truncate = jfs_truncate,
93 .setxattr = jfs_setxattr, 120 .setxattr = jfs_setxattr,
94 .getxattr = jfs_getxattr, 121 .getxattr = jfs_getxattr,
95 .listxattr = jfs_listxattr, 122 .listxattr = jfs_listxattr,
96 .removexattr = jfs_removexattr, 123 .removexattr = jfs_removexattr,
97#ifdef CONFIG_JFS_POSIX_ACL
98 .setattr = jfs_setattr, 124 .setattr = jfs_setattr,
125#ifdef CONFIG_JFS_POSIX_ACL
99 .check_acl = jfs_check_acl, 126 .check_acl = jfs_check_acl,
100#endif 127#endif
101}; 128};
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 182b78cc3e62..9dd126276c9f 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -149,6 +149,9 @@ void jfs_delete_inode(struct inode *inode)
149{ 149{
150 jfs_info("In jfs_delete_inode, inode = 0x%p", inode); 150 jfs_info("In jfs_delete_inode, inode = 0x%p", inode);
151 151
152 if (!is_bad_inode(inode))
153 dquot_initialize(inode);
154
152 if (!is_bad_inode(inode) && 155 if (!is_bad_inode(inode) &&
153 (JFS_IP(inode)->fileset == FILESYSTEM_I)) { 156 (JFS_IP(inode)->fileset == FILESYSTEM_I)) {
154 truncate_inode_pages(&inode->i_data, 0); 157 truncate_inode_pages(&inode->i_data, 0);
@@ -161,9 +164,9 @@ void jfs_delete_inode(struct inode *inode)
161 /* 164 /*
162 * Free the inode from the quota allocation. 165 * Free the inode from the quota allocation.
163 */ 166 */
164 vfs_dq_init(inode); 167 dquot_initialize(inode);
165 vfs_dq_free_inode(inode); 168 dquot_free_inode(inode);
166 vfs_dq_drop(inode); 169 dquot_drop(inode);
167 } 170 }
168 171
169 clear_inode(inode); 172 clear_inode(inode);
diff --git a/fs/jfs/jfs_acl.h b/fs/jfs/jfs_acl.h
index b07bd417ef85..54e07559878d 100644
--- a/fs/jfs/jfs_acl.h
+++ b/fs/jfs/jfs_acl.h
@@ -22,7 +22,7 @@
22 22
23int jfs_check_acl(struct inode *, int); 23int jfs_check_acl(struct inode *, int);
24int jfs_init_acl(tid_t, struct inode *, struct inode *); 24int jfs_init_acl(tid_t, struct inode *, struct inode *);
25int jfs_setattr(struct dentry *, struct iattr *); 25int jfs_acl_chmod(struct inode *inode);
26 26
27#else 27#else
28 28
@@ -32,5 +32,10 @@ static inline int jfs_init_acl(tid_t tid, struct inode *inode,
32 return 0; 32 return 0;
33} 33}
34 34
35static inline int jfs_acl_chmod(struct inode *inode)
36{
37 return 0;
38}
39
35#endif 40#endif
36#endif /* _H_JFS_ACL */ 41#endif /* _H_JFS_ACL */
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index 925871e9887b..0e4623be70ce 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -381,10 +381,10 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
381 * It's time to move the inline table to an external 381 * It's time to move the inline table to an external
382 * page and begin to build the xtree 382 * page and begin to build the xtree
383 */ 383 */
384 if (vfs_dq_alloc_block(ip, sbi->nbperpage)) 384 if (dquot_alloc_block(ip, sbi->nbperpage))
385 goto clean_up; 385 goto clean_up;
386 if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) { 386 if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) {
387 vfs_dq_free_block(ip, sbi->nbperpage); 387 dquot_free_block(ip, sbi->nbperpage);
388 goto clean_up; 388 goto clean_up;
389 } 389 }
390 390
@@ -408,7 +408,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
408 memcpy(&jfs_ip->i_dirtable, temp_table, 408 memcpy(&jfs_ip->i_dirtable, temp_table,
409 sizeof (temp_table)); 409 sizeof (temp_table));
410 dbFree(ip, xaddr, sbi->nbperpage); 410 dbFree(ip, xaddr, sbi->nbperpage);
411 vfs_dq_free_block(ip, sbi->nbperpage); 411 dquot_free_block(ip, sbi->nbperpage);
412 goto clean_up; 412 goto clean_up;
413 } 413 }
414 ip->i_size = PSIZE; 414 ip->i_size = PSIZE;
@@ -1027,10 +1027,9 @@ static int dtSplitUp(tid_t tid,
1027 n = xlen; 1027 n = xlen;
1028 1028
1029 /* Allocate blocks to quota. */ 1029 /* Allocate blocks to quota. */
1030 if (vfs_dq_alloc_block(ip, n)) { 1030 rc = dquot_alloc_block(ip, n);
1031 rc = -EDQUOT; 1031 if (rc)
1032 goto extendOut; 1032 goto extendOut;
1033 }
1034 quota_allocation += n; 1033 quota_allocation += n;
1035 1034
1036 if ((rc = dbReAlloc(sbi->ipbmap, xaddr, (s64) xlen, 1035 if ((rc = dbReAlloc(sbi->ipbmap, xaddr, (s64) xlen,
@@ -1308,7 +1307,7 @@ static int dtSplitUp(tid_t tid,
1308 1307
1309 /* Rollback quota allocation */ 1308 /* Rollback quota allocation */
1310 if (rc && quota_allocation) 1309 if (rc && quota_allocation)
1311 vfs_dq_free_block(ip, quota_allocation); 1310 dquot_free_block(ip, quota_allocation);
1312 1311
1313 dtSplitUp_Exit: 1312 dtSplitUp_Exit:
1314 1313
@@ -1369,9 +1368,10 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
1369 return -EIO; 1368 return -EIO;
1370 1369
1371 /* Allocate blocks to quota. */ 1370 /* Allocate blocks to quota. */
1372 if (vfs_dq_alloc_block(ip, lengthPXD(pxd))) { 1371 rc = dquot_alloc_block(ip, lengthPXD(pxd));
1372 if (rc) {
1373 release_metapage(rmp); 1373 release_metapage(rmp);
1374 return -EDQUOT; 1374 return rc;
1375 } 1375 }
1376 1376
1377 jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp); 1377 jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp);
@@ -1892,6 +1892,7 @@ static int dtSplitRoot(tid_t tid,
1892 struct dt_lock *dtlck; 1892 struct dt_lock *dtlck;
1893 struct tlock *tlck; 1893 struct tlock *tlck;
1894 struct lv *lv; 1894 struct lv *lv;
1895 int rc;
1895 1896
1896 /* get split root page */ 1897 /* get split root page */
1897 smp = split->mp; 1898 smp = split->mp;
@@ -1916,9 +1917,10 @@ static int dtSplitRoot(tid_t tid,
1916 rp = rmp->data; 1917 rp = rmp->data;
1917 1918
1918 /* Allocate blocks to quota. */ 1919 /* Allocate blocks to quota. */
1919 if (vfs_dq_alloc_block(ip, lengthPXD(pxd))) { 1920 rc = dquot_alloc_block(ip, lengthPXD(pxd));
1921 if (rc) {
1920 release_metapage(rmp); 1922 release_metapage(rmp);
1921 return -EDQUOT; 1923 return rc;
1922 } 1924 }
1923 1925
1924 BT_MARK_DIRTY(rmp, ip); 1926 BT_MARK_DIRTY(rmp, ip);
@@ -2287,7 +2289,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip,
2287 xlen = lengthPXD(&fp->header.self); 2289 xlen = lengthPXD(&fp->header.self);
2288 2290
2289 /* Free quota allocation. */ 2291 /* Free quota allocation. */
2290 vfs_dq_free_block(ip, xlen); 2292 dquot_free_block(ip, xlen);
2291 2293
2292 /* free/invalidate its buffer page */ 2294 /* free/invalidate its buffer page */
2293 discard_metapage(fmp); 2295 discard_metapage(fmp);
@@ -2363,7 +2365,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip,
2363 xlen = lengthPXD(&p->header.self); 2365 xlen = lengthPXD(&p->header.self);
2364 2366
2365 /* Free quota allocation */ 2367 /* Free quota allocation */
2366 vfs_dq_free_block(ip, xlen); 2368 dquot_free_block(ip, xlen);
2367 2369
2368 /* free/invalidate its buffer page */ 2370 /* free/invalidate its buffer page */
2369 discard_metapage(mp); 2371 discard_metapage(mp);
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
index 41d6045dbeb0..5d3bbd10f8db 100644
--- a/fs/jfs/jfs_extent.c
+++ b/fs/jfs/jfs_extent.c
@@ -141,10 +141,11 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr)
141 } 141 }
142 142
143 /* Allocate blocks to quota. */ 143 /* Allocate blocks to quota. */
144 if (vfs_dq_alloc_block(ip, nxlen)) { 144 rc = dquot_alloc_block(ip, nxlen);
145 if (rc) {
145 dbFree(ip, nxaddr, (s64) nxlen); 146 dbFree(ip, nxaddr, (s64) nxlen);
146 mutex_unlock(&JFS_IP(ip)->commit_mutex); 147 mutex_unlock(&JFS_IP(ip)->commit_mutex);
147 return -EDQUOT; 148 return rc;
148 } 149 }
149 150
150 /* determine the value of the extent flag */ 151 /* determine the value of the extent flag */
@@ -164,7 +165,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr)
164 */ 165 */
165 if (rc) { 166 if (rc) {
166 dbFree(ip, nxaddr, nxlen); 167 dbFree(ip, nxaddr, nxlen);
167 vfs_dq_free_block(ip, nxlen); 168 dquot_free_block(ip, nxlen);
168 mutex_unlock(&JFS_IP(ip)->commit_mutex); 169 mutex_unlock(&JFS_IP(ip)->commit_mutex);
169 return (rc); 170 return (rc);
170 } 171 }
@@ -256,10 +257,11 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr)
256 goto exit; 257 goto exit;
257 258
258 /* Allocat blocks to quota. */ 259 /* Allocat blocks to quota. */
259 if (vfs_dq_alloc_block(ip, nxlen)) { 260 rc = dquot_alloc_block(ip, nxlen);
261 if (rc) {
260 dbFree(ip, nxaddr, (s64) nxlen); 262 dbFree(ip, nxaddr, (s64) nxlen);
261 mutex_unlock(&JFS_IP(ip)->commit_mutex); 263 mutex_unlock(&JFS_IP(ip)->commit_mutex);
262 return -EDQUOT; 264 return rc;
263 } 265 }
264 266
265 delta = nxlen - xlen; 267 delta = nxlen - xlen;
@@ -297,7 +299,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr)
297 /* extend the extent */ 299 /* extend the extent */
298 if ((rc = xtExtend(0, ip, xoff + xlen, (int) nextend, 0))) { 300 if ((rc = xtExtend(0, ip, xoff + xlen, (int) nextend, 0))) {
299 dbFree(ip, xaddr + xlen, delta); 301 dbFree(ip, xaddr + xlen, delta);
300 vfs_dq_free_block(ip, nxlen); 302 dquot_free_block(ip, nxlen);
301 goto exit; 303 goto exit;
302 } 304 }
303 } else { 305 } else {
@@ -308,7 +310,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr)
308 */ 310 */
309 if ((rc = xtTailgate(0, ip, xoff, (int) ntail, nxaddr, 0))) { 311 if ((rc = xtTailgate(0, ip, xoff, (int) ntail, nxaddr, 0))) {
310 dbFree(ip, nxaddr, nxlen); 312 dbFree(ip, nxaddr, nxlen);
311 vfs_dq_free_block(ip, nxlen); 313 dquot_free_block(ip, nxlen);
312 goto exit; 314 goto exit;
313 } 315 }
314 } 316 }
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c
index dc0e02159ac9..829921b67765 100644
--- a/fs/jfs/jfs_inode.c
+++ b/fs/jfs/jfs_inode.c
@@ -116,10 +116,10 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
116 /* 116 /*
117 * Allocate inode to quota. 117 * Allocate inode to quota.
118 */ 118 */
119 if (vfs_dq_alloc_inode(inode)) { 119 dquot_initialize(inode);
120 rc = -EDQUOT; 120 rc = dquot_alloc_inode(inode);
121 if (rc)
121 goto fail_drop; 122 goto fail_drop;
122 }
123 123
124 inode->i_mode = mode; 124 inode->i_mode = mode;
125 /* inherit flags from parent */ 125 /* inherit flags from parent */
@@ -162,7 +162,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
162 return inode; 162 return inode;
163 163
164fail_drop: 164fail_drop:
165 vfs_dq_drop(inode); 165 dquot_drop(inode);
166 inode->i_flags |= S_NOQUOTA; 166 inode->i_flags |= S_NOQUOTA;
167fail_unlock: 167fail_unlock:
168 inode->i_nlink = 0; 168 inode->i_nlink = 0;
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h
index 15902b03c2a7..79e2c79661df 100644
--- a/fs/jfs/jfs_inode.h
+++ b/fs/jfs/jfs_inode.h
@@ -40,6 +40,7 @@ extern struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
40 int fh_len, int fh_type); 40 int fh_len, int fh_type);
41extern void jfs_set_inode_flags(struct inode *); 41extern void jfs_set_inode_flags(struct inode *);
42extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int); 42extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
43extern int jfs_setattr(struct dentry *, struct iattr *);
43 44
44extern const struct address_space_operations jfs_aops; 45extern const struct address_space_operations jfs_aops;
45extern const struct inode_operations jfs_dir_inode_operations; 46extern const struct inode_operations jfs_dir_inode_operations;
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c
index d654a6458648..6c50871e6220 100644
--- a/fs/jfs/jfs_xtree.c
+++ b/fs/jfs/jfs_xtree.c
@@ -585,10 +585,10 @@ int xtInsert(tid_t tid, /* transaction id */
585 hint = addressXAD(xad) + lengthXAD(xad) - 1; 585 hint = addressXAD(xad) + lengthXAD(xad) - 1;
586 } else 586 } else
587 hint = 0; 587 hint = 0;
588 if ((rc = vfs_dq_alloc_block(ip, xlen))) 588 if ((rc = dquot_alloc_block(ip, xlen)))
589 goto out; 589 goto out;
590 if ((rc = dbAlloc(ip, hint, (s64) xlen, &xaddr))) { 590 if ((rc = dbAlloc(ip, hint, (s64) xlen, &xaddr))) {
591 vfs_dq_free_block(ip, xlen); 591 dquot_free_block(ip, xlen);
592 goto out; 592 goto out;
593 } 593 }
594 } 594 }
@@ -617,7 +617,7 @@ int xtInsert(tid_t tid, /* transaction id */
617 /* undo data extent allocation */ 617 /* undo data extent allocation */
618 if (*xaddrp == 0) { 618 if (*xaddrp == 0) {
619 dbFree(ip, xaddr, (s64) xlen); 619 dbFree(ip, xaddr, (s64) xlen);
620 vfs_dq_free_block(ip, xlen); 620 dquot_free_block(ip, xlen);
621 } 621 }
622 return rc; 622 return rc;
623 } 623 }
@@ -985,10 +985,9 @@ xtSplitPage(tid_t tid, struct inode *ip,
985 rbn = addressPXD(pxd); 985 rbn = addressPXD(pxd);
986 986
987 /* Allocate blocks to quota. */ 987 /* Allocate blocks to quota. */
988 if (vfs_dq_alloc_block(ip, lengthPXD(pxd))) { 988 rc = dquot_alloc_block(ip, lengthPXD(pxd));
989 rc = -EDQUOT; 989 if (rc)
990 goto clean_up; 990 goto clean_up;
991 }
992 991
993 quota_allocation += lengthPXD(pxd); 992 quota_allocation += lengthPXD(pxd);
994 993
@@ -1195,7 +1194,7 @@ xtSplitPage(tid_t tid, struct inode *ip,
1195 1194
1196 /* Rollback quota allocation. */ 1195 /* Rollback quota allocation. */
1197 if (quota_allocation) 1196 if (quota_allocation)
1198 vfs_dq_free_block(ip, quota_allocation); 1197 dquot_free_block(ip, quota_allocation);
1199 1198
1200 return (rc); 1199 return (rc);
1201} 1200}
@@ -1235,6 +1234,7 @@ xtSplitRoot(tid_t tid,
1235 struct pxdlist *pxdlist; 1234 struct pxdlist *pxdlist;
1236 struct tlock *tlck; 1235 struct tlock *tlck;
1237 struct xtlock *xtlck; 1236 struct xtlock *xtlck;
1237 int rc;
1238 1238
1239 sp = &JFS_IP(ip)->i_xtroot; 1239 sp = &JFS_IP(ip)->i_xtroot;
1240 1240
@@ -1252,9 +1252,10 @@ xtSplitRoot(tid_t tid,
1252 return -EIO; 1252 return -EIO;
1253 1253
1254 /* Allocate blocks to quota. */ 1254 /* Allocate blocks to quota. */
1255 if (vfs_dq_alloc_block(ip, lengthPXD(pxd))) { 1255 rc = dquot_alloc_block(ip, lengthPXD(pxd));
1256 if (rc) {
1256 release_metapage(rmp); 1257 release_metapage(rmp);
1257 return -EDQUOT; 1258 return rc;
1258 } 1259 }
1259 1260
1260 jfs_info("xtSplitRoot: ip:0x%p rmp:0x%p", ip, rmp); 1261 jfs_info("xtSplitRoot: ip:0x%p rmp:0x%p", ip, rmp);
@@ -3680,7 +3681,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
3680 ip->i_size = newsize; 3681 ip->i_size = newsize;
3681 3682
3682 /* update quota allocation to reflect freed blocks */ 3683 /* update quota allocation to reflect freed blocks */
3683 vfs_dq_free_block(ip, nfreed); 3684 dquot_free_block(ip, nfreed);
3684 3685
3685 /* 3686 /*
3686 * free tlock of invalidated pages 3687 * free tlock of invalidated pages
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index c79a4270f083..4a3e9f39c21d 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -85,6 +85,8 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
85 85
86 jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name); 86 jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name);
87 87
88 dquot_initialize(dip);
89
88 /* 90 /*
89 * search parent directory for entry/freespace 91 * search parent directory for entry/freespace
90 * (dtSearch() returns parent directory page pinned) 92 * (dtSearch() returns parent directory page pinned)
@@ -215,6 +217,8 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
215 217
216 jfs_info("jfs_mkdir: dip:0x%p name:%s", dip, dentry->d_name.name); 218 jfs_info("jfs_mkdir: dip:0x%p name:%s", dip, dentry->d_name.name);
217 219
220 dquot_initialize(dip);
221
218 /* link count overflow on parent directory ? */ 222 /* link count overflow on parent directory ? */
219 if (dip->i_nlink == JFS_LINK_MAX) { 223 if (dip->i_nlink == JFS_LINK_MAX) {
220 rc = -EMLINK; 224 rc = -EMLINK;
@@ -356,7 +360,8 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
356 jfs_info("jfs_rmdir: dip:0x%p name:%s", dip, dentry->d_name.name); 360 jfs_info("jfs_rmdir: dip:0x%p name:%s", dip, dentry->d_name.name);
357 361
358 /* Init inode for quota operations. */ 362 /* Init inode for quota operations. */
359 vfs_dq_init(ip); 363 dquot_initialize(dip);
364 dquot_initialize(ip);
360 365
361 /* directory must be empty to be removed */ 366 /* directory must be empty to be removed */
362 if (!dtEmpty(ip)) { 367 if (!dtEmpty(ip)) {
@@ -483,7 +488,8 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
483 jfs_info("jfs_unlink: dip:0x%p name:%s", dip, dentry->d_name.name); 488 jfs_info("jfs_unlink: dip:0x%p name:%s", dip, dentry->d_name.name);
484 489
485 /* Init inode for quota operations. */ 490 /* Init inode for quota operations. */
486 vfs_dq_init(ip); 491 dquot_initialize(dip);
492 dquot_initialize(ip);
487 493
488 if ((rc = get_UCSname(&dname, dentry))) 494 if ((rc = get_UCSname(&dname, dentry)))
489 goto out; 495 goto out;
@@ -805,6 +811,8 @@ static int jfs_link(struct dentry *old_dentry,
805 if (ip->i_nlink == 0) 811 if (ip->i_nlink == 0)
806 return -ENOENT; 812 return -ENOENT;
807 813
814 dquot_initialize(dir);
815
808 tid = txBegin(ip->i_sb, 0); 816 tid = txBegin(ip->i_sb, 0);
809 817
810 mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT); 818 mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT);
@@ -896,6 +904,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
896 904
897 jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name); 905 jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name);
898 906
907 dquot_initialize(dip);
908
899 ssize = strlen(name) + 1; 909 ssize = strlen(name) + 1;
900 910
901 /* 911 /*
@@ -1087,6 +1097,9 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1087 jfs_info("jfs_rename: %s %s", old_dentry->d_name.name, 1097 jfs_info("jfs_rename: %s %s", old_dentry->d_name.name,
1088 new_dentry->d_name.name); 1098 new_dentry->d_name.name);
1089 1099
1100 dquot_initialize(old_dir);
1101 dquot_initialize(new_dir);
1102
1090 old_ip = old_dentry->d_inode; 1103 old_ip = old_dentry->d_inode;
1091 new_ip = new_dentry->d_inode; 1104 new_ip = new_dentry->d_inode;
1092 1105
@@ -1136,7 +1149,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1136 } else if (new_ip) { 1149 } else if (new_ip) {
1137 IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL); 1150 IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL);
1138 /* Init inode for quota operations. */ 1151 /* Init inode for quota operations. */
1139 vfs_dq_init(new_ip); 1152 dquot_initialize(new_ip);
1140 } 1153 }
1141 1154
1142 /* 1155 /*
@@ -1360,6 +1373,8 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1360 1373
1361 jfs_info("jfs_mknod: %s", dentry->d_name.name); 1374 jfs_info("jfs_mknod: %s", dentry->d_name.name);
1362 1375
1376 dquot_initialize(dir);
1377
1363 if ((rc = get_UCSname(&dname, dentry))) 1378 if ((rc = get_UCSname(&dname, dentry)))
1364 goto out; 1379 goto out;
1365 1380
@@ -1541,8 +1556,8 @@ const struct inode_operations jfs_dir_inode_operations = {
1541 .getxattr = jfs_getxattr, 1556 .getxattr = jfs_getxattr,
1542 .listxattr = jfs_listxattr, 1557 .listxattr = jfs_listxattr,
1543 .removexattr = jfs_removexattr, 1558 .removexattr = jfs_removexattr,
1544#ifdef CONFIG_JFS_POSIX_ACL
1545 .setattr = jfs_setattr, 1559 .setattr = jfs_setattr,
1560#ifdef CONFIG_JFS_POSIX_ACL
1546 .check_acl = jfs_check_acl, 1561 .check_acl = jfs_check_acl,
1547#endif 1562#endif
1548}; 1563};
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index d929a822a74e..266699deb1c6 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -131,6 +131,11 @@ static void jfs_destroy_inode(struct inode *inode)
131 kmem_cache_free(jfs_inode_cachep, ji); 131 kmem_cache_free(jfs_inode_cachep, ji);
132} 132}
133 133
134static void jfs_clear_inode(struct inode *inode)
135{
136 dquot_drop(inode);
137}
138
134static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf) 139static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf)
135{ 140{
136 struct jfs_sb_info *sbi = JFS_SBI(dentry->d_sb); 141 struct jfs_sb_info *sbi = JFS_SBI(dentry->d_sb);
@@ -745,6 +750,7 @@ static const struct super_operations jfs_super_operations = {
745 .dirty_inode = jfs_dirty_inode, 750 .dirty_inode = jfs_dirty_inode,
746 .write_inode = jfs_write_inode, 751 .write_inode = jfs_write_inode,
747 .delete_inode = jfs_delete_inode, 752 .delete_inode = jfs_delete_inode,
753 .clear_inode = jfs_clear_inode,
748 .put_super = jfs_put_super, 754 .put_super = jfs_put_super,
749 .sync_fs = jfs_sync_fs, 755 .sync_fs = jfs_sync_fs,
750 .freeze_fs = jfs_freeze, 756 .freeze_fs = jfs_freeze,
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index fad364548bc9..1f594ab21895 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -260,14 +260,14 @@ static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size,
260 nblocks = (size + (sb->s_blocksize - 1)) >> sb->s_blocksize_bits; 260 nblocks = (size + (sb->s_blocksize - 1)) >> sb->s_blocksize_bits;
261 261
262 /* Allocate new blocks to quota. */ 262 /* Allocate new blocks to quota. */
263 if (vfs_dq_alloc_block(ip, nblocks)) { 263 rc = dquot_alloc_block(ip, nblocks);
264 return -EDQUOT; 264 if (rc)
265 } 265 return rc;
266 266
267 rc = dbAlloc(ip, INOHINT(ip), nblocks, &blkno); 267 rc = dbAlloc(ip, INOHINT(ip), nblocks, &blkno);
268 if (rc) { 268 if (rc) {
269 /*Rollback quota allocation. */ 269 /*Rollback quota allocation. */
270 vfs_dq_free_block(ip, nblocks); 270 dquot_free_block(ip, nblocks);
271 return rc; 271 return rc;
272 } 272 }
273 273
@@ -332,7 +332,7 @@ static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size,
332 332
333 failed: 333 failed:
334 /* Rollback quota allocation. */ 334 /* Rollback quota allocation. */
335 vfs_dq_free_block(ip, nblocks); 335 dquot_free_block(ip, nblocks);
336 336
337 dbFree(ip, blkno, nblocks); 337 dbFree(ip, blkno, nblocks);
338 return rc; 338 return rc;
@@ -538,7 +538,8 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
538 538
539 if (blocks_needed > current_blocks) { 539 if (blocks_needed > current_blocks) {
540 /* Allocate new blocks to quota. */ 540 /* Allocate new blocks to quota. */
541 if (vfs_dq_alloc_block(inode, blocks_needed)) 541 rc = dquot_alloc_block(inode, blocks_needed);
542 if (rc)
542 return -EDQUOT; 543 return -EDQUOT;
543 544
544 quota_allocation = blocks_needed; 545 quota_allocation = blocks_needed;
@@ -602,7 +603,7 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
602 clean_up: 603 clean_up:
603 /* Rollback quota allocation */ 604 /* Rollback quota allocation */
604 if (quota_allocation) 605 if (quota_allocation)
605 vfs_dq_free_block(inode, quota_allocation); 606 dquot_free_block(inode, quota_allocation);
606 607
607 return (rc); 608 return (rc);
608} 609}
@@ -677,7 +678,7 @@ static int ea_put(tid_t tid, struct inode *inode, struct ea_buffer *ea_buf,
677 678
678 /* If old blocks exist, they must be removed from quota allocation. */ 679 /* If old blocks exist, they must be removed from quota allocation. */
679 if (old_blocks) 680 if (old_blocks)
680 vfs_dq_free_block(inode, old_blocks); 681 dquot_free_block(inode, old_blocks);
681 682
682 inode->i_ctime = CURRENT_TIME; 683 inode->i_ctime = CURRENT_TIME;
683 684