diff options
Diffstat (limited to 'fs/ufs')
-rw-r--r-- | fs/ufs/balloc.c | 24 | ||||
-rw-r--r-- | fs/ufs/file.c | 3 | ||||
-rw-r--r-- | fs/ufs/ialloc.c | 11 | ||||
-rw-r--r-- | fs/ufs/inode.c | 4 | ||||
-rw-r--r-- | fs/ufs/namei.c | 18 | ||||
-rw-r--r-- | fs/ufs/super.c | 6 | ||||
-rw-r--r-- | fs/ufs/truncate.c | 10 |
7 files changed, 61 insertions, 15 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 54c16ec95dff..5cfa4d85ccf2 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -85,7 +85,7 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) | |||
85 | "bit already cleared for fragment %u", i); | 85 | "bit already cleared for fragment %u", i); |
86 | } | 86 | } |
87 | 87 | ||
88 | vfs_dq_free_block(inode, count); | 88 | dquot_free_block(inode, count); |
89 | 89 | ||
90 | 90 | ||
91 | fs32_add(sb, &ucg->cg_cs.cs_nffree, count); | 91 | fs32_add(sb, &ucg->cg_cs.cs_nffree, count); |
@@ -195,7 +195,7 @@ do_more: | |||
195 | ubh_setblock(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); | 195 | ubh_setblock(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); |
196 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) | 196 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) |
197 | ufs_clusteracct (sb, ucpi, blkno, 1); | 197 | ufs_clusteracct (sb, ucpi, blkno, 1); |
198 | vfs_dq_free_block(inode, uspi->s_fpb); | 198 | dquot_free_block(inode, uspi->s_fpb); |
199 | 199 | ||
200 | fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); | 200 | fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); |
201 | uspi->cs_total.cs_nbfree++; | 201 | uspi->cs_total.cs_nbfree++; |
@@ -511,6 +511,7 @@ static u64 ufs_add_fragments(struct inode *inode, u64 fragment, | |||
511 | struct ufs_cg_private_info * ucpi; | 511 | struct ufs_cg_private_info * ucpi; |
512 | struct ufs_cylinder_group * ucg; | 512 | struct ufs_cylinder_group * ucg; |
513 | unsigned cgno, fragno, fragoff, count, fragsize, i; | 513 | unsigned cgno, fragno, fragoff, count, fragsize, i; |
514 | int ret; | ||
514 | 515 | ||
515 | UFSD("ENTER, fragment %llu, oldcount %u, newcount %u\n", | 516 | UFSD("ENTER, fragment %llu, oldcount %u, newcount %u\n", |
516 | (unsigned long long)fragment, oldcount, newcount); | 517 | (unsigned long long)fragment, oldcount, newcount); |
@@ -556,8 +557,9 @@ static u64 ufs_add_fragments(struct inode *inode, u64 fragment, | |||
556 | fs32_add(sb, &ucg->cg_frsum[fragsize - count], 1); | 557 | fs32_add(sb, &ucg->cg_frsum[fragsize - count], 1); |
557 | for (i = oldcount; i < newcount; i++) | 558 | for (i = oldcount; i < newcount; i++) |
558 | ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, fragno + i); | 559 | ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, fragno + i); |
559 | if (vfs_dq_alloc_block(inode, count)) { | 560 | ret = dquot_alloc_block(inode, count); |
560 | *err = -EDQUOT; | 561 | if (ret) { |
562 | *err = ret; | ||
561 | return 0; | 563 | return 0; |
562 | } | 564 | } |
563 | 565 | ||
@@ -596,6 +598,7 @@ static u64 ufs_alloc_fragments(struct inode *inode, unsigned cgno, | |||
596 | struct ufs_cylinder_group * ucg; | 598 | struct ufs_cylinder_group * ucg; |
597 | unsigned oldcg, i, j, k, allocsize; | 599 | unsigned oldcg, i, j, k, allocsize; |
598 | u64 result; | 600 | u64 result; |
601 | int ret; | ||
599 | 602 | ||
600 | UFSD("ENTER, ino %lu, cgno %u, goal %llu, count %u\n", | 603 | UFSD("ENTER, ino %lu, cgno %u, goal %llu, count %u\n", |
601 | inode->i_ino, cgno, (unsigned long long)goal, count); | 604 | inode->i_ino, cgno, (unsigned long long)goal, count); |
@@ -664,7 +667,7 @@ cg_found: | |||
664 | for (i = count; i < uspi->s_fpb; i++) | 667 | for (i = count; i < uspi->s_fpb; i++) |
665 | ubh_setbit (UCPI_UBH(ucpi), ucpi->c_freeoff, goal + i); | 668 | ubh_setbit (UCPI_UBH(ucpi), ucpi->c_freeoff, goal + i); |
666 | i = uspi->s_fpb - count; | 669 | i = uspi->s_fpb - count; |
667 | vfs_dq_free_block(inode, i); | 670 | dquot_free_block(inode, i); |
668 | 671 | ||
669 | fs32_add(sb, &ucg->cg_cs.cs_nffree, i); | 672 | fs32_add(sb, &ucg->cg_cs.cs_nffree, i); |
670 | uspi->cs_total.cs_nffree += i; | 673 | uspi->cs_total.cs_nffree += i; |
@@ -676,8 +679,9 @@ cg_found: | |||
676 | result = ufs_bitmap_search (sb, ucpi, goal, allocsize); | 679 | result = ufs_bitmap_search (sb, ucpi, goal, allocsize); |
677 | if (result == INVBLOCK) | 680 | if (result == INVBLOCK) |
678 | return 0; | 681 | return 0; |
679 | if (vfs_dq_alloc_block(inode, count)) { | 682 | ret = dquot_alloc_block(inode, count); |
680 | *err = -EDQUOT; | 683 | if (ret) { |
684 | *err = ret; | ||
681 | return 0; | 685 | return 0; |
682 | } | 686 | } |
683 | for (i = 0; i < count; i++) | 687 | for (i = 0; i < count; i++) |
@@ -714,6 +718,7 @@ static u64 ufs_alloccg_block(struct inode *inode, | |||
714 | struct ufs_super_block_first * usb1; | 718 | struct ufs_super_block_first * usb1; |
715 | struct ufs_cylinder_group * ucg; | 719 | struct ufs_cylinder_group * ucg; |
716 | u64 result, blkno; | 720 | u64 result, blkno; |
721 | int ret; | ||
717 | 722 | ||
718 | UFSD("ENTER, goal %llu\n", (unsigned long long)goal); | 723 | UFSD("ENTER, goal %llu\n", (unsigned long long)goal); |
719 | 724 | ||
@@ -747,8 +752,9 @@ gotit: | |||
747 | ubh_clrblock (UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); | 752 | ubh_clrblock (UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); |
748 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) | 753 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) |
749 | ufs_clusteracct (sb, ucpi, blkno, -1); | 754 | ufs_clusteracct (sb, ucpi, blkno, -1); |
750 | if (vfs_dq_alloc_block(inode, uspi->s_fpb)) { | 755 | ret = dquot_alloc_block(inode, uspi->s_fpb); |
751 | *err = -EDQUOT; | 756 | if (ret) { |
757 | *err = ret; | ||
752 | return INVBLOCK; | 758 | return INVBLOCK; |
753 | } | 759 | } |
754 | 760 | ||
diff --git a/fs/ufs/file.c b/fs/ufs/file.c index 73655c61240a..a8962cecde5b 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c | |||
@@ -24,6 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/quotaops.h> | ||
27 | 28 | ||
28 | #include "ufs_fs.h" | 29 | #include "ufs_fs.h" |
29 | #include "ufs.h" | 30 | #include "ufs.h" |
@@ -40,7 +41,7 @@ const struct file_operations ufs_file_operations = { | |||
40 | .write = do_sync_write, | 41 | .write = do_sync_write, |
41 | .aio_write = generic_file_aio_write, | 42 | .aio_write = generic_file_aio_write, |
42 | .mmap = generic_file_mmap, | 43 | .mmap = generic_file_mmap, |
43 | .open = generic_file_open, | 44 | .open = dquot_file_open, |
44 | .fsync = simple_fsync, | 45 | .fsync = simple_fsync, |
45 | .splice_read = generic_file_splice_read, | 46 | .splice_read = generic_file_splice_read, |
46 | }; | 47 | }; |
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index 3527c00fef0d..230ecf608026 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -95,8 +95,8 @@ void ufs_free_inode (struct inode * inode) | |||
95 | 95 | ||
96 | is_directory = S_ISDIR(inode->i_mode); | 96 | is_directory = S_ISDIR(inode->i_mode); |
97 | 97 | ||
98 | vfs_dq_free_inode(inode); | 98 | dquot_free_inode(inode); |
99 | vfs_dq_drop(inode); | 99 | dquot_drop(inode); |
100 | 100 | ||
101 | clear_inode (inode); | 101 | clear_inode (inode); |
102 | 102 | ||
@@ -355,9 +355,10 @@ cg_found: | |||
355 | 355 | ||
356 | unlock_super (sb); | 356 | unlock_super (sb); |
357 | 357 | ||
358 | if (vfs_dq_alloc_inode(inode)) { | 358 | dquot_initialize(inode); |
359 | vfs_dq_drop(inode); | 359 | err = dquot_alloc_inode(inode); |
360 | err = -EDQUOT; | 360 | if (err) { |
361 | dquot_drop(inode); | ||
361 | goto fail_without_unlock; | 362 | goto fail_without_unlock; |
362 | } | 363 | } |
363 | 364 | ||
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 0a627e08610b..80b68c3702d1 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/smp_lock.h> | 37 | #include <linux/smp_lock.h> |
38 | #include <linux/buffer_head.h> | 38 | #include <linux/buffer_head.h> |
39 | #include <linux/writeback.h> | 39 | #include <linux/writeback.h> |
40 | #include <linux/quotaops.h> | ||
40 | 41 | ||
41 | #include "ufs_fs.h" | 42 | #include "ufs_fs.h" |
42 | #include "ufs.h" | 43 | #include "ufs.h" |
@@ -909,6 +910,9 @@ void ufs_delete_inode (struct inode * inode) | |||
909 | { | 910 | { |
910 | loff_t old_i_size; | 911 | loff_t old_i_size; |
911 | 912 | ||
913 | if (!is_bad_inode(inode)) | ||
914 | dquot_initialize(inode); | ||
915 | |||
912 | truncate_inode_pages(&inode->i_data, 0); | 916 | truncate_inode_pages(&inode->i_data, 0); |
913 | if (is_bad_inode(inode)) | 917 | if (is_bad_inode(inode)) |
914 | goto no_delete; | 918 | goto no_delete; |
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 4c26d9e8bc94..118556243e7a 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/time.h> | 30 | #include <linux/time.h> |
31 | #include <linux/fs.h> | 31 | #include <linux/fs.h> |
32 | #include <linux/smp_lock.h> | 32 | #include <linux/smp_lock.h> |
33 | #include <linux/quotaops.h> | ||
33 | 34 | ||
34 | #include "ufs_fs.h" | 35 | #include "ufs_fs.h" |
35 | #include "ufs.h" | 36 | #include "ufs.h" |
@@ -84,6 +85,9 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, int mode, | |||
84 | int err; | 85 | int err; |
85 | 86 | ||
86 | UFSD("BEGIN\n"); | 87 | UFSD("BEGIN\n"); |
88 | |||
89 | dquot_initialize(dir); | ||
90 | |||
87 | inode = ufs_new_inode(dir, mode); | 91 | inode = ufs_new_inode(dir, mode); |
88 | err = PTR_ERR(inode); | 92 | err = PTR_ERR(inode); |
89 | 93 | ||
@@ -107,6 +111,9 @@ static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t | |||
107 | 111 | ||
108 | if (!old_valid_dev(rdev)) | 112 | if (!old_valid_dev(rdev)) |
109 | return -EINVAL; | 113 | return -EINVAL; |
114 | |||
115 | dquot_initialize(dir); | ||
116 | |||
110 | inode = ufs_new_inode(dir, mode); | 117 | inode = ufs_new_inode(dir, mode); |
111 | err = PTR_ERR(inode); | 118 | err = PTR_ERR(inode); |
112 | if (!IS_ERR(inode)) { | 119 | if (!IS_ERR(inode)) { |
@@ -131,6 +138,8 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry, | |||
131 | if (l > sb->s_blocksize) | 138 | if (l > sb->s_blocksize) |
132 | goto out_notlocked; | 139 | goto out_notlocked; |
133 | 140 | ||
141 | dquot_initialize(dir); | ||
142 | |||
134 | lock_kernel(); | 143 | lock_kernel(); |
135 | inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); | 144 | inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); |
136 | err = PTR_ERR(inode); | 145 | err = PTR_ERR(inode); |
@@ -176,6 +185,8 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir, | |||
176 | return -EMLINK; | 185 | return -EMLINK; |
177 | } | 186 | } |
178 | 187 | ||
188 | dquot_initialize(dir); | ||
189 | |||
179 | inode->i_ctime = CURRENT_TIME_SEC; | 190 | inode->i_ctime = CURRENT_TIME_SEC; |
180 | inode_inc_link_count(inode); | 191 | inode_inc_link_count(inode); |
181 | atomic_inc(&inode->i_count); | 192 | atomic_inc(&inode->i_count); |
@@ -193,6 +204,8 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
193 | if (dir->i_nlink >= UFS_LINK_MAX) | 204 | if (dir->i_nlink >= UFS_LINK_MAX) |
194 | goto out; | 205 | goto out; |
195 | 206 | ||
207 | dquot_initialize(dir); | ||
208 | |||
196 | lock_kernel(); | 209 | lock_kernel(); |
197 | inode_inc_link_count(dir); | 210 | inode_inc_link_count(dir); |
198 | 211 | ||
@@ -237,6 +250,8 @@ static int ufs_unlink(struct inode *dir, struct dentry *dentry) | |||
237 | struct page *page; | 250 | struct page *page; |
238 | int err = -ENOENT; | 251 | int err = -ENOENT; |
239 | 252 | ||
253 | dquot_initialize(dir); | ||
254 | |||
240 | de = ufs_find_entry(dir, &dentry->d_name, &page); | 255 | de = ufs_find_entry(dir, &dentry->d_name, &page); |
241 | if (!de) | 256 | if (!de) |
242 | goto out; | 257 | goto out; |
@@ -281,6 +296,9 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
281 | struct ufs_dir_entry *old_de; | 296 | struct ufs_dir_entry *old_de; |
282 | int err = -ENOENT; | 297 | int err = -ENOENT; |
283 | 298 | ||
299 | dquot_initialize(old_dir); | ||
300 | dquot_initialize(new_dir); | ||
301 | |||
284 | old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); | 302 | old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); |
285 | if (!old_de) | 303 | if (!old_de) |
286 | goto out; | 304 | goto out; |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 143c20bfb04b..66b63a751615 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -1432,6 +1432,11 @@ static void destroy_inodecache(void) | |||
1432 | kmem_cache_destroy(ufs_inode_cachep); | 1432 | kmem_cache_destroy(ufs_inode_cachep); |
1433 | } | 1433 | } |
1434 | 1434 | ||
1435 | static void ufs_clear_inode(struct inode *inode) | ||
1436 | { | ||
1437 | dquot_drop(inode); | ||
1438 | } | ||
1439 | |||
1435 | #ifdef CONFIG_QUOTA | 1440 | #ifdef CONFIG_QUOTA |
1436 | static ssize_t ufs_quota_read(struct super_block *, int, char *,size_t, loff_t); | 1441 | static ssize_t ufs_quota_read(struct super_block *, int, char *,size_t, loff_t); |
1437 | static ssize_t ufs_quota_write(struct super_block *, int, const char *, size_t, loff_t); | 1442 | static ssize_t ufs_quota_write(struct super_block *, int, const char *, size_t, loff_t); |
@@ -1442,6 +1447,7 @@ static const struct super_operations ufs_super_ops = { | |||
1442 | .destroy_inode = ufs_destroy_inode, | 1447 | .destroy_inode = ufs_destroy_inode, |
1443 | .write_inode = ufs_write_inode, | 1448 | .write_inode = ufs_write_inode, |
1444 | .delete_inode = ufs_delete_inode, | 1449 | .delete_inode = ufs_delete_inode, |
1450 | .clear_inode = ufs_clear_inode, | ||
1445 | .put_super = ufs_put_super, | 1451 | .put_super = ufs_put_super, |
1446 | .write_super = ufs_write_super, | 1452 | .write_super = ufs_write_super, |
1447 | .sync_fs = ufs_sync_fs, | 1453 | .sync_fs = ufs_sync_fs, |
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index 41dd431ce228..d3b6270cb377 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/buffer_head.h> | 44 | #include <linux/buffer_head.h> |
45 | #include <linux/blkdev.h> | 45 | #include <linux/blkdev.h> |
46 | #include <linux/sched.h> | 46 | #include <linux/sched.h> |
47 | #include <linux/quotaops.h> | ||
47 | 48 | ||
48 | #include "ufs_fs.h" | 49 | #include "ufs_fs.h" |
49 | #include "ufs.h" | 50 | #include "ufs.h" |
@@ -517,9 +518,18 @@ static int ufs_setattr(struct dentry *dentry, struct iattr *attr) | |||
517 | if (error) | 518 | if (error) |
518 | return error; | 519 | return error; |
519 | 520 | ||
521 | if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || | ||
522 | (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { | ||
523 | error = dquot_transfer(inode, attr); | ||
524 | if (error) | ||
525 | return error; | ||
526 | } | ||
520 | if (ia_valid & ATTR_SIZE && | 527 | if (ia_valid & ATTR_SIZE && |
521 | attr->ia_size != i_size_read(inode)) { | 528 | attr->ia_size != i_size_read(inode)) { |
522 | loff_t old_i_size = inode->i_size; | 529 | loff_t old_i_size = inode->i_size; |
530 | |||
531 | dquot_initialize(inode); | ||
532 | |||
523 | error = vmtruncate(inode, attr->ia_size); | 533 | error = vmtruncate(inode, attr->ia_size); |
524 | if (error) | 534 | if (error) |
525 | return error; | 535 | return error; |