diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ufs/balloc.c | 24 | ||||
-rw-r--r-- | fs/ufs/file.c | 3 | ||||
-rw-r--r-- | fs/ufs/ialloc.c | 13 | ||||
-rw-r--r-- | fs/ufs/inode.c | 4 | ||||
-rw-r--r-- | fs/ufs/namei.c | 16 | ||||
-rw-r--r-- | fs/ufs/super.c | 126 | ||||
-rw-r--r-- | fs/ufs/truncate.c | 10 |
7 files changed, 1 insertions, 195 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 5cfa4d85ccf2..048484fb10d2 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/stat.h> | 12 | #include <linux/stat.h> |
13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/quotaops.h> | ||
16 | #include <linux/buffer_head.h> | 15 | #include <linux/buffer_head.h> |
17 | #include <linux/capability.h> | 16 | #include <linux/capability.h> |
18 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
@@ -85,9 +84,6 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) | |||
85 | "bit already cleared for fragment %u", i); | 84 | "bit already cleared for fragment %u", i); |
86 | } | 85 | } |
87 | 86 | ||
88 | dquot_free_block(inode, count); | ||
89 | |||
90 | |||
91 | fs32_add(sb, &ucg->cg_cs.cs_nffree, count); | 87 | fs32_add(sb, &ucg->cg_cs.cs_nffree, count); |
92 | uspi->cs_total.cs_nffree += count; | 88 | uspi->cs_total.cs_nffree += count; |
93 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); | 89 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); |
@@ -195,7 +191,6 @@ do_more: | |||
195 | ubh_setblock(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); | 191 | ubh_setblock(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); |
196 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) | 192 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) |
197 | ufs_clusteracct (sb, ucpi, blkno, 1); | 193 | ufs_clusteracct (sb, ucpi, blkno, 1); |
198 | dquot_free_block(inode, uspi->s_fpb); | ||
199 | 194 | ||
200 | fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); | 195 | fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); |
201 | uspi->cs_total.cs_nbfree++; | 196 | uspi->cs_total.cs_nbfree++; |
@@ -511,7 +506,6 @@ static u64 ufs_add_fragments(struct inode *inode, u64 fragment, | |||
511 | struct ufs_cg_private_info * ucpi; | 506 | struct ufs_cg_private_info * ucpi; |
512 | struct ufs_cylinder_group * ucg; | 507 | struct ufs_cylinder_group * ucg; |
513 | unsigned cgno, fragno, fragoff, count, fragsize, i; | 508 | unsigned cgno, fragno, fragoff, count, fragsize, i; |
514 | int ret; | ||
515 | 509 | ||
516 | UFSD("ENTER, fragment %llu, oldcount %u, newcount %u\n", | 510 | UFSD("ENTER, fragment %llu, oldcount %u, newcount %u\n", |
517 | (unsigned long long)fragment, oldcount, newcount); | 511 | (unsigned long long)fragment, oldcount, newcount); |
@@ -557,11 +551,6 @@ static u64 ufs_add_fragments(struct inode *inode, u64 fragment, | |||
557 | fs32_add(sb, &ucg->cg_frsum[fragsize - count], 1); | 551 | fs32_add(sb, &ucg->cg_frsum[fragsize - count], 1); |
558 | for (i = oldcount; i < newcount; i++) | 552 | for (i = oldcount; i < newcount; i++) |
559 | ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, fragno + i); | 553 | ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, fragno + i); |
560 | ret = dquot_alloc_block(inode, count); | ||
561 | if (ret) { | ||
562 | *err = ret; | ||
563 | return 0; | ||
564 | } | ||
565 | 554 | ||
566 | fs32_sub(sb, &ucg->cg_cs.cs_nffree, count); | 555 | fs32_sub(sb, &ucg->cg_cs.cs_nffree, count); |
567 | fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); | 556 | fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); |
@@ -598,7 +587,6 @@ static u64 ufs_alloc_fragments(struct inode *inode, unsigned cgno, | |||
598 | struct ufs_cylinder_group * ucg; | 587 | struct ufs_cylinder_group * ucg; |
599 | unsigned oldcg, i, j, k, allocsize; | 588 | unsigned oldcg, i, j, k, allocsize; |
600 | u64 result; | 589 | u64 result; |
601 | int ret; | ||
602 | 590 | ||
603 | UFSD("ENTER, ino %lu, cgno %u, goal %llu, count %u\n", | 591 | UFSD("ENTER, ino %lu, cgno %u, goal %llu, count %u\n", |
604 | inode->i_ino, cgno, (unsigned long long)goal, count); | 592 | inode->i_ino, cgno, (unsigned long long)goal, count); |
@@ -667,7 +655,6 @@ cg_found: | |||
667 | for (i = count; i < uspi->s_fpb; i++) | 655 | for (i = count; i < uspi->s_fpb; i++) |
668 | ubh_setbit (UCPI_UBH(ucpi), ucpi->c_freeoff, goal + i); | 656 | ubh_setbit (UCPI_UBH(ucpi), ucpi->c_freeoff, goal + i); |
669 | i = uspi->s_fpb - count; | 657 | i = uspi->s_fpb - count; |
670 | dquot_free_block(inode, i); | ||
671 | 658 | ||
672 | fs32_add(sb, &ucg->cg_cs.cs_nffree, i); | 659 | fs32_add(sb, &ucg->cg_cs.cs_nffree, i); |
673 | uspi->cs_total.cs_nffree += i; | 660 | uspi->cs_total.cs_nffree += i; |
@@ -679,11 +666,6 @@ cg_found: | |||
679 | result = ufs_bitmap_search (sb, ucpi, goal, allocsize); | 666 | result = ufs_bitmap_search (sb, ucpi, goal, allocsize); |
680 | if (result == INVBLOCK) | 667 | if (result == INVBLOCK) |
681 | return 0; | 668 | return 0; |
682 | ret = dquot_alloc_block(inode, count); | ||
683 | if (ret) { | ||
684 | *err = ret; | ||
685 | return 0; | ||
686 | } | ||
687 | for (i = 0; i < count; i++) | 669 | for (i = 0; i < count; i++) |
688 | ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, result + i); | 670 | ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, result + i); |
689 | 671 | ||
@@ -718,7 +700,6 @@ static u64 ufs_alloccg_block(struct inode *inode, | |||
718 | struct ufs_super_block_first * usb1; | 700 | struct ufs_super_block_first * usb1; |
719 | struct ufs_cylinder_group * ucg; | 701 | struct ufs_cylinder_group * ucg; |
720 | u64 result, blkno; | 702 | u64 result, blkno; |
721 | int ret; | ||
722 | 703 | ||
723 | UFSD("ENTER, goal %llu\n", (unsigned long long)goal); | 704 | UFSD("ENTER, goal %llu\n", (unsigned long long)goal); |
724 | 705 | ||
@@ -752,11 +733,6 @@ gotit: | |||
752 | ubh_clrblock (UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); | 733 | ubh_clrblock (UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); |
753 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) | 734 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) |
754 | ufs_clusteracct (sb, ucpi, blkno, -1); | 735 | ufs_clusteracct (sb, ucpi, blkno, -1); |
755 | ret = dquot_alloc_block(inode, uspi->s_fpb); | ||
756 | if (ret) { | ||
757 | *err = ret; | ||
758 | return INVBLOCK; | ||
759 | } | ||
760 | 736 | ||
761 | fs32_sub(sb, &ucg->cg_cs.cs_nbfree, 1); | 737 | fs32_sub(sb, &ucg->cg_cs.cs_nbfree, 1); |
762 | uspi->cs_total.cs_nbfree--; | 738 | uspi->cs_total.cs_nbfree--; |
diff --git a/fs/ufs/file.c b/fs/ufs/file.c index a8962cecde5b..73655c61240a 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c | |||
@@ -24,7 +24,6 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/quotaops.h> | ||
28 | 27 | ||
29 | #include "ufs_fs.h" | 28 | #include "ufs_fs.h" |
30 | #include "ufs.h" | 29 | #include "ufs.h" |
@@ -41,7 +40,7 @@ const struct file_operations ufs_file_operations = { | |||
41 | .write = do_sync_write, | 40 | .write = do_sync_write, |
42 | .aio_write = generic_file_aio_write, | 41 | .aio_write = generic_file_aio_write, |
43 | .mmap = generic_file_mmap, | 42 | .mmap = generic_file_mmap, |
44 | .open = dquot_file_open, | 43 | .open = generic_file_open, |
45 | .fsync = simple_fsync, | 44 | .fsync = simple_fsync, |
46 | .splice_read = generic_file_splice_read, | 45 | .splice_read = generic_file_splice_read, |
47 | }; | 46 | }; |
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index 3a959d55084d..594480e537d2 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/stat.h> | 28 | #include <linux/stat.h> |
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/quotaops.h> | ||
31 | #include <linux/buffer_head.h> | 30 | #include <linux/buffer_head.h> |
32 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
33 | #include <linux/bitops.h> | 32 | #include <linux/bitops.h> |
@@ -95,9 +94,6 @@ void ufs_free_inode (struct inode * inode) | |||
95 | 94 | ||
96 | is_directory = S_ISDIR(inode->i_mode); | 95 | is_directory = S_ISDIR(inode->i_mode); |
97 | 96 | ||
98 | dquot_free_inode(inode); | ||
99 | dquot_drop(inode); | ||
100 | |||
101 | clear_inode (inode); | 97 | clear_inode (inode); |
102 | 98 | ||
103 | if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit)) | 99 | if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit)) |
@@ -347,21 +343,12 @@ cg_found: | |||
347 | 343 | ||
348 | unlock_super (sb); | 344 | unlock_super (sb); |
349 | 345 | ||
350 | dquot_initialize(inode); | ||
351 | err = dquot_alloc_inode(inode); | ||
352 | if (err) { | ||
353 | dquot_drop(inode); | ||
354 | goto fail_without_unlock; | ||
355 | } | ||
356 | |||
357 | UFSD("allocating inode %lu\n", inode->i_ino); | 346 | UFSD("allocating inode %lu\n", inode->i_ino); |
358 | UFSD("EXIT\n"); | 347 | UFSD("EXIT\n"); |
359 | return inode; | 348 | return inode; |
360 | 349 | ||
361 | fail_remove_inode: | 350 | fail_remove_inode: |
362 | unlock_super(sb); | 351 | unlock_super(sb); |
363 | fail_without_unlock: | ||
364 | inode->i_flags |= S_NOQUOTA; | ||
365 | inode->i_nlink = 0; | 352 | inode->i_nlink = 0; |
366 | iput(inode); | 353 | iput(inode); |
367 | UFSD("EXIT (FAILED): err %d\n", err); | 354 | UFSD("EXIT (FAILED): err %d\n", err); |
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index cffa756f1047..73fe773aa034 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -37,7 +37,6 @@ | |||
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> | ||
41 | 40 | ||
42 | #include "ufs_fs.h" | 41 | #include "ufs_fs.h" |
43 | #include "ufs.h" | 42 | #include "ufs.h" |
@@ -910,9 +909,6 @@ void ufs_delete_inode (struct inode * inode) | |||
910 | { | 909 | { |
911 | loff_t old_i_size; | 910 | loff_t old_i_size; |
912 | 911 | ||
913 | if (!is_bad_inode(inode)) | ||
914 | dquot_initialize(inode); | ||
915 | |||
916 | truncate_inode_pages(&inode->i_data, 0); | 912 | truncate_inode_pages(&inode->i_data, 0); |
917 | if (is_bad_inode(inode)) | 913 | if (is_bad_inode(inode)) |
918 | goto no_delete; | 914 | goto no_delete; |
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index eabc02eb1294..b056f02b1fb3 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -30,7 +30,6 @@ | |||
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> | ||
34 | 33 | ||
35 | #include "ufs_fs.h" | 34 | #include "ufs_fs.h" |
36 | #include "ufs.h" | 35 | #include "ufs.h" |
@@ -86,8 +85,6 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, int mode, | |||
86 | 85 | ||
87 | UFSD("BEGIN\n"); | 86 | UFSD("BEGIN\n"); |
88 | 87 | ||
89 | dquot_initialize(dir); | ||
90 | |||
91 | inode = ufs_new_inode(dir, mode); | 88 | inode = ufs_new_inode(dir, mode); |
92 | err = PTR_ERR(inode); | 89 | err = PTR_ERR(inode); |
93 | 90 | ||
@@ -112,8 +109,6 @@ static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t | |||
112 | if (!old_valid_dev(rdev)) | 109 | if (!old_valid_dev(rdev)) |
113 | return -EINVAL; | 110 | return -EINVAL; |
114 | 111 | ||
115 | dquot_initialize(dir); | ||
116 | |||
117 | inode = ufs_new_inode(dir, mode); | 112 | inode = ufs_new_inode(dir, mode); |
118 | err = PTR_ERR(inode); | 113 | err = PTR_ERR(inode); |
119 | if (!IS_ERR(inode)) { | 114 | if (!IS_ERR(inode)) { |
@@ -138,8 +133,6 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry, | |||
138 | if (l > sb->s_blocksize) | 133 | if (l > sb->s_blocksize) |
139 | goto out_notlocked; | 134 | goto out_notlocked; |
140 | 135 | ||
141 | dquot_initialize(dir); | ||
142 | |||
143 | lock_kernel(); | 136 | lock_kernel(); |
144 | inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); | 137 | inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); |
145 | err = PTR_ERR(inode); | 138 | err = PTR_ERR(inode); |
@@ -185,8 +178,6 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir, | |||
185 | return -EMLINK; | 178 | return -EMLINK; |
186 | } | 179 | } |
187 | 180 | ||
188 | dquot_initialize(dir); | ||
189 | |||
190 | inode->i_ctime = CURRENT_TIME_SEC; | 181 | inode->i_ctime = CURRENT_TIME_SEC; |
191 | inode_inc_link_count(inode); | 182 | inode_inc_link_count(inode); |
192 | atomic_inc(&inode->i_count); | 183 | atomic_inc(&inode->i_count); |
@@ -204,8 +195,6 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
204 | if (dir->i_nlink >= UFS_LINK_MAX) | 195 | if (dir->i_nlink >= UFS_LINK_MAX) |
205 | goto out; | 196 | goto out; |
206 | 197 | ||
207 | dquot_initialize(dir); | ||
208 | |||
209 | lock_kernel(); | 198 | lock_kernel(); |
210 | inode_inc_link_count(dir); | 199 | inode_inc_link_count(dir); |
211 | 200 | ||
@@ -250,8 +239,6 @@ static int ufs_unlink(struct inode *dir, struct dentry *dentry) | |||
250 | struct page *page; | 239 | struct page *page; |
251 | int err = -ENOENT; | 240 | int err = -ENOENT; |
252 | 241 | ||
253 | dquot_initialize(dir); | ||
254 | |||
255 | de = ufs_find_entry(dir, &dentry->d_name, &page); | 242 | de = ufs_find_entry(dir, &dentry->d_name, &page); |
256 | if (!de) | 243 | if (!de) |
257 | goto out; | 244 | goto out; |
@@ -296,9 +283,6 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
296 | struct ufs_dir_entry *old_de; | 283 | struct ufs_dir_entry *old_de; |
297 | int err = -ENOENT; | 284 | int err = -ENOENT; |
298 | 285 | ||
299 | dquot_initialize(old_dir); | ||
300 | dquot_initialize(new_dir); | ||
301 | |||
302 | old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); | 286 | old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); |
303 | if (!old_de) | 287 | if (!old_de) |
304 | goto out; | 288 | goto out; |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 2b08a8dd8ec0..3c9bbf23c2ff 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -77,7 +77,6 @@ | |||
77 | 77 | ||
78 | #include <linux/errno.h> | 78 | #include <linux/errno.h> |
79 | #include <linux/fs.h> | 79 | #include <linux/fs.h> |
80 | #include <linux/quotaops.h> | ||
81 | #include <linux/slab.h> | 80 | #include <linux/slab.h> |
82 | #include <linux/time.h> | 81 | #include <linux/time.h> |
83 | #include <linux/stat.h> | 82 | #include <linux/stat.h> |
@@ -1045,10 +1044,6 @@ magic_found: | |||
1045 | */ | 1044 | */ |
1046 | sb->s_op = &ufs_super_ops; | 1045 | sb->s_op = &ufs_super_ops; |
1047 | sb->s_export_op = &ufs_export_ops; | 1046 | sb->s_export_op = &ufs_export_ops; |
1048 | #ifdef CONFIG_QUOTA | ||
1049 | sb->s_qcop = &dquot_quotactl_ops; | ||
1050 | sb->dq_op = NULL; /* &dquot_operations */ | ||
1051 | #endif | ||
1052 | 1047 | ||
1053 | sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); | 1048 | sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); |
1054 | 1049 | ||
@@ -1231,8 +1226,6 @@ static void ufs_put_super(struct super_block *sb) | |||
1231 | 1226 | ||
1232 | UFSD("ENTER\n"); | 1227 | UFSD("ENTER\n"); |
1233 | 1228 | ||
1234 | dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); | ||
1235 | |||
1236 | if (sb->s_dirt) | 1229 | if (sb->s_dirt) |
1237 | ufs_write_super(sb); | 1230 | ufs_write_super(sb); |
1238 | 1231 | ||
@@ -1254,9 +1247,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1254 | struct ufs_super_block_first * usb1; | 1247 | struct ufs_super_block_first * usb1; |
1255 | struct ufs_super_block_third * usb3; | 1248 | struct ufs_super_block_third * usb3; |
1256 | unsigned new_mount_opt, ufstype; | 1249 | unsigned new_mount_opt, ufstype; |
1257 | int enable_quota = 0; | ||
1258 | unsigned flags; | 1250 | unsigned flags; |
1259 | int err; | ||
1260 | 1251 | ||
1261 | lock_kernel(); | 1252 | lock_kernel(); |
1262 | lock_super(sb); | 1253 | lock_super(sb); |
@@ -1297,13 +1288,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1297 | * fs was mouted as rw, remounting ro | 1288 | * fs was mouted as rw, remounting ro |
1298 | */ | 1289 | */ |
1299 | if (*mount_flags & MS_RDONLY) { | 1290 | if (*mount_flags & MS_RDONLY) { |
1300 | err = dquot_suspend(sb, -1); | ||
1301 | if (err < 0) { | ||
1302 | unlock_super(sb); | ||
1303 | unlock_kernel(); | ||
1304 | return err; | ||
1305 | } | ||
1306 | |||
1307 | ufs_put_super_internal(sb); | 1291 | ufs_put_super_internal(sb); |
1308 | usb1->fs_time = cpu_to_fs32(sb, get_seconds()); | 1292 | usb1->fs_time = cpu_to_fs32(sb, get_seconds()); |
1309 | if ((flags & UFS_ST_MASK) == UFS_ST_SUN | 1293 | if ((flags & UFS_ST_MASK) == UFS_ST_SUN |
@@ -1342,14 +1326,11 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1342 | return -EPERM; | 1326 | return -EPERM; |
1343 | } | 1327 | } |
1344 | sb->s_flags &= ~MS_RDONLY; | 1328 | sb->s_flags &= ~MS_RDONLY; |
1345 | enable_quota = 1; | ||
1346 | #endif | 1329 | #endif |
1347 | } | 1330 | } |
1348 | UFS_SB(sb)->s_mount_opt = new_mount_opt; | 1331 | UFS_SB(sb)->s_mount_opt = new_mount_opt; |
1349 | unlock_super(sb); | 1332 | unlock_super(sb); |
1350 | unlock_kernel(); | 1333 | unlock_kernel(); |
1351 | if (enable_quota) | ||
1352 | dquot_resume(sb, -1); | ||
1353 | return 0; | 1334 | return 0; |
1354 | } | 1335 | } |
1355 | 1336 | ||
@@ -1453,126 +1434,19 @@ static void destroy_inodecache(void) | |||
1453 | kmem_cache_destroy(ufs_inode_cachep); | 1434 | kmem_cache_destroy(ufs_inode_cachep); |
1454 | } | 1435 | } |
1455 | 1436 | ||
1456 | static void ufs_clear_inode(struct inode *inode) | ||
1457 | { | ||
1458 | dquot_drop(inode); | ||
1459 | } | ||
1460 | |||
1461 | #ifdef CONFIG_QUOTA | ||
1462 | static ssize_t ufs_quota_read(struct super_block *, int, char *,size_t, loff_t); | ||
1463 | static ssize_t ufs_quota_write(struct super_block *, int, const char *, size_t, loff_t); | ||
1464 | #endif | ||
1465 | |||
1466 | static const struct super_operations ufs_super_ops = { | 1437 | static const struct super_operations ufs_super_ops = { |
1467 | .alloc_inode = ufs_alloc_inode, | 1438 | .alloc_inode = ufs_alloc_inode, |
1468 | .destroy_inode = ufs_destroy_inode, | 1439 | .destroy_inode = ufs_destroy_inode, |
1469 | .write_inode = ufs_write_inode, | 1440 | .write_inode = ufs_write_inode, |
1470 | .delete_inode = ufs_delete_inode, | 1441 | .delete_inode = ufs_delete_inode, |
1471 | .clear_inode = ufs_clear_inode, | ||
1472 | .put_super = ufs_put_super, | 1442 | .put_super = ufs_put_super, |
1473 | .write_super = ufs_write_super, | 1443 | .write_super = ufs_write_super, |
1474 | .sync_fs = ufs_sync_fs, | 1444 | .sync_fs = ufs_sync_fs, |
1475 | .statfs = ufs_statfs, | 1445 | .statfs = ufs_statfs, |
1476 | .remount_fs = ufs_remount, | 1446 | .remount_fs = ufs_remount, |
1477 | .show_options = ufs_show_options, | 1447 | .show_options = ufs_show_options, |
1478 | #ifdef CONFIG_QUOTA | ||
1479 | .quota_read = ufs_quota_read, | ||
1480 | .quota_write = ufs_quota_write, | ||
1481 | #endif | ||
1482 | }; | 1448 | }; |
1483 | 1449 | ||
1484 | #ifdef CONFIG_QUOTA | ||
1485 | |||
1486 | /* Read data from quotafile - avoid pagecache and such because we cannot afford | ||
1487 | * acquiring the locks... As quota files are never truncated and quota code | ||
1488 | * itself serializes the operations (and noone else should touch the files) | ||
1489 | * we don't have to be afraid of races */ | ||
1490 | static ssize_t ufs_quota_read(struct super_block *sb, int type, char *data, | ||
1491 | size_t len, loff_t off) | ||
1492 | { | ||
1493 | struct inode *inode = sb_dqopt(sb)->files[type]; | ||
1494 | sector_t blk = off >> sb->s_blocksize_bits; | ||
1495 | int err = 0; | ||
1496 | int offset = off & (sb->s_blocksize - 1); | ||
1497 | int tocopy; | ||
1498 | size_t toread; | ||
1499 | struct buffer_head *bh; | ||
1500 | loff_t i_size = i_size_read(inode); | ||
1501 | |||
1502 | if (off > i_size) | ||
1503 | return 0; | ||
1504 | if (off+len > i_size) | ||
1505 | len = i_size-off; | ||
1506 | toread = len; | ||
1507 | while (toread > 0) { | ||
1508 | tocopy = sb->s_blocksize - offset < toread ? | ||
1509 | sb->s_blocksize - offset : toread; | ||
1510 | |||
1511 | bh = ufs_bread(inode, blk, 0, &err); | ||
1512 | if (err) | ||
1513 | return err; | ||
1514 | if (!bh) /* A hole? */ | ||
1515 | memset(data, 0, tocopy); | ||
1516 | else { | ||
1517 | memcpy(data, bh->b_data+offset, tocopy); | ||
1518 | brelse(bh); | ||
1519 | } | ||
1520 | offset = 0; | ||
1521 | toread -= tocopy; | ||
1522 | data += tocopy; | ||
1523 | blk++; | ||
1524 | } | ||
1525 | return len; | ||
1526 | } | ||
1527 | |||
1528 | /* Write to quotafile */ | ||
1529 | static ssize_t ufs_quota_write(struct super_block *sb, int type, | ||
1530 | const char *data, size_t len, loff_t off) | ||
1531 | { | ||
1532 | struct inode *inode = sb_dqopt(sb)->files[type]; | ||
1533 | sector_t blk = off >> sb->s_blocksize_bits; | ||
1534 | int err = 0; | ||
1535 | int offset = off & (sb->s_blocksize - 1); | ||
1536 | int tocopy; | ||
1537 | size_t towrite = len; | ||
1538 | struct buffer_head *bh; | ||
1539 | |||
1540 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA); | ||
1541 | while (towrite > 0) { | ||
1542 | tocopy = sb->s_blocksize - offset < towrite ? | ||
1543 | sb->s_blocksize - offset : towrite; | ||
1544 | |||
1545 | bh = ufs_bread(inode, blk, 1, &err); | ||
1546 | if (!bh) | ||
1547 | goto out; | ||
1548 | lock_buffer(bh); | ||
1549 | memcpy(bh->b_data+offset, data, tocopy); | ||
1550 | flush_dcache_page(bh->b_page); | ||
1551 | set_buffer_uptodate(bh); | ||
1552 | mark_buffer_dirty(bh); | ||
1553 | unlock_buffer(bh); | ||
1554 | brelse(bh); | ||
1555 | offset = 0; | ||
1556 | towrite -= tocopy; | ||
1557 | data += tocopy; | ||
1558 | blk++; | ||
1559 | } | ||
1560 | out: | ||
1561 | if (len == towrite) { | ||
1562 | mutex_unlock(&inode->i_mutex); | ||
1563 | return err; | ||
1564 | } | ||
1565 | if (inode->i_size < off+len-towrite) | ||
1566 | i_size_write(inode, off+len-towrite); | ||
1567 | inode->i_version++; | ||
1568 | inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; | ||
1569 | mark_inode_dirty(inode); | ||
1570 | mutex_unlock(&inode->i_mutex); | ||
1571 | return len - towrite; | ||
1572 | } | ||
1573 | |||
1574 | #endif | ||
1575 | |||
1576 | static int ufs_get_sb(struct file_system_type *fs_type, | 1450 | static int ufs_get_sb(struct file_system_type *fs_type, |
1577 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) | 1451 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
1578 | { | 1452 | { |
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index f294c44577dc..4171e2df18dd 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
@@ -44,7 +44,6 @@ | |||
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> | ||
48 | 47 | ||
49 | #include "ufs_fs.h" | 48 | #include "ufs_fs.h" |
50 | #include "ufs.h" | 49 | #include "ufs.h" |
@@ -518,15 +517,6 @@ int ufs_setattr(struct dentry *dentry, struct iattr *attr) | |||
518 | if (error) | 517 | if (error) |
519 | return error; | 518 | return error; |
520 | 519 | ||
521 | if (is_quota_modification(inode, attr)) | ||
522 | dquot_initialize(inode); | ||
523 | |||
524 | if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || | ||
525 | (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { | ||
526 | error = dquot_transfer(inode, attr); | ||
527 | if (error) | ||
528 | return error; | ||
529 | } | ||
530 | if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) { | 520 | if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) { |
531 | loff_t old_i_size = inode->i_size; | 521 | loff_t old_i_size = inode->i_size; |
532 | 522 | ||