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 | 13 | ||||
-rw-r--r-- | fs/ufs/inode.c | 4 | ||||
-rw-r--r-- | fs/ufs/namei.c | 16 | ||||
-rw-r--r-- | fs/ufs/super.c | 110 | ||||
-rw-r--r-- | fs/ufs/truncate.c | 10 |
7 files changed, 2 insertions, 178 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 d4c30d1bef86..33afa20d4509 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 = generic_file_fsync, | 44 | .fsync = generic_file_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 ad9bc1ebd3a6..3ec5a9eb6efb 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> |
@@ -1047,7 +1046,7 @@ magic_found: | |||
1047 | */ | 1046 | */ |
1048 | sb->s_op = &ufs_super_ops; | 1047 | sb->s_op = &ufs_super_ops; |
1049 | sb->s_export_op = &ufs_export_ops; | 1048 | sb->s_export_op = &ufs_export_ops; |
1050 | sb->dq_op = NULL; /***/ | 1049 | |
1051 | sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); | 1050 | sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); |
1052 | 1051 | ||
1053 | uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno); | 1052 | uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno); |
@@ -1437,126 +1436,19 @@ static void destroy_inodecache(void) | |||
1437 | kmem_cache_destroy(ufs_inode_cachep); | 1436 | kmem_cache_destroy(ufs_inode_cachep); |
1438 | } | 1437 | } |
1439 | 1438 | ||
1440 | static void ufs_clear_inode(struct inode *inode) | ||
1441 | { | ||
1442 | dquot_drop(inode); | ||
1443 | } | ||
1444 | |||
1445 | #ifdef CONFIG_QUOTA | ||
1446 | static ssize_t ufs_quota_read(struct super_block *, int, char *,size_t, loff_t); | ||
1447 | static ssize_t ufs_quota_write(struct super_block *, int, const char *, size_t, loff_t); | ||
1448 | #endif | ||
1449 | |||
1450 | static const struct super_operations ufs_super_ops = { | 1439 | static const struct super_operations ufs_super_ops = { |
1451 | .alloc_inode = ufs_alloc_inode, | 1440 | .alloc_inode = ufs_alloc_inode, |
1452 | .destroy_inode = ufs_destroy_inode, | 1441 | .destroy_inode = ufs_destroy_inode, |
1453 | .write_inode = ufs_write_inode, | 1442 | .write_inode = ufs_write_inode, |
1454 | .delete_inode = ufs_delete_inode, | 1443 | .delete_inode = ufs_delete_inode, |
1455 | .clear_inode = ufs_clear_inode, | ||
1456 | .put_super = ufs_put_super, | 1444 | .put_super = ufs_put_super, |
1457 | .write_super = ufs_write_super, | 1445 | .write_super = ufs_write_super, |
1458 | .sync_fs = ufs_sync_fs, | 1446 | .sync_fs = ufs_sync_fs, |
1459 | .statfs = ufs_statfs, | 1447 | .statfs = ufs_statfs, |
1460 | .remount_fs = ufs_remount, | 1448 | .remount_fs = ufs_remount, |
1461 | .show_options = ufs_show_options, | 1449 | .show_options = ufs_show_options, |
1462 | #ifdef CONFIG_QUOTA | ||
1463 | .quota_read = ufs_quota_read, | ||
1464 | .quota_write = ufs_quota_write, | ||
1465 | #endif | ||
1466 | }; | 1450 | }; |
1467 | 1451 | ||
1468 | #ifdef CONFIG_QUOTA | ||
1469 | |||
1470 | /* Read data from quotafile - avoid pagecache and such because we cannot afford | ||
1471 | * acquiring the locks... As quota files are never truncated and quota code | ||
1472 | * itself serializes the operations (and noone else should touch the files) | ||
1473 | * we don't have to be afraid of races */ | ||
1474 | static ssize_t ufs_quota_read(struct super_block *sb, int type, char *data, | ||
1475 | size_t len, loff_t off) | ||
1476 | { | ||
1477 | struct inode *inode = sb_dqopt(sb)->files[type]; | ||
1478 | sector_t blk = off >> sb->s_blocksize_bits; | ||
1479 | int err = 0; | ||
1480 | int offset = off & (sb->s_blocksize - 1); | ||
1481 | int tocopy; | ||
1482 | size_t toread; | ||
1483 | struct buffer_head *bh; | ||
1484 | loff_t i_size = i_size_read(inode); | ||
1485 | |||
1486 | if (off > i_size) | ||
1487 | return 0; | ||
1488 | if (off+len > i_size) | ||
1489 | len = i_size-off; | ||
1490 | toread = len; | ||
1491 | while (toread > 0) { | ||
1492 | tocopy = sb->s_blocksize - offset < toread ? | ||
1493 | sb->s_blocksize - offset : toread; | ||
1494 | |||
1495 | bh = ufs_bread(inode, blk, 0, &err); | ||
1496 | if (err) | ||
1497 | return err; | ||
1498 | if (!bh) /* A hole? */ | ||
1499 | memset(data, 0, tocopy); | ||
1500 | else { | ||
1501 | memcpy(data, bh->b_data+offset, tocopy); | ||
1502 | brelse(bh); | ||
1503 | } | ||
1504 | offset = 0; | ||
1505 | toread -= tocopy; | ||
1506 | data += tocopy; | ||
1507 | blk++; | ||
1508 | } | ||
1509 | return len; | ||
1510 | } | ||
1511 | |||
1512 | /* Write to quotafile */ | ||
1513 | static ssize_t ufs_quota_write(struct super_block *sb, int type, | ||
1514 | const char *data, size_t len, loff_t off) | ||
1515 | { | ||
1516 | struct inode *inode = sb_dqopt(sb)->files[type]; | ||
1517 | sector_t blk = off >> sb->s_blocksize_bits; | ||
1518 | int err = 0; | ||
1519 | int offset = off & (sb->s_blocksize - 1); | ||
1520 | int tocopy; | ||
1521 | size_t towrite = len; | ||
1522 | struct buffer_head *bh; | ||
1523 | |||
1524 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA); | ||
1525 | while (towrite > 0) { | ||
1526 | tocopy = sb->s_blocksize - offset < towrite ? | ||
1527 | sb->s_blocksize - offset : towrite; | ||
1528 | |||
1529 | bh = ufs_bread(inode, blk, 1, &err); | ||
1530 | if (!bh) | ||
1531 | goto out; | ||
1532 | lock_buffer(bh); | ||
1533 | memcpy(bh->b_data+offset, data, tocopy); | ||
1534 | flush_dcache_page(bh->b_page); | ||
1535 | set_buffer_uptodate(bh); | ||
1536 | mark_buffer_dirty(bh); | ||
1537 | unlock_buffer(bh); | ||
1538 | brelse(bh); | ||
1539 | offset = 0; | ||
1540 | towrite -= tocopy; | ||
1541 | data += tocopy; | ||
1542 | blk++; | ||
1543 | } | ||
1544 | out: | ||
1545 | if (len == towrite) { | ||
1546 | mutex_unlock(&inode->i_mutex); | ||
1547 | return err; | ||
1548 | } | ||
1549 | if (inode->i_size < off+len-towrite) | ||
1550 | i_size_write(inode, off+len-towrite); | ||
1551 | inode->i_version++; | ||
1552 | inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; | ||
1553 | mark_inode_dirty(inode); | ||
1554 | mutex_unlock(&inode->i_mutex); | ||
1555 | return len - towrite; | ||
1556 | } | ||
1557 | |||
1558 | #endif | ||
1559 | |||
1560 | static int ufs_get_sb(struct file_system_type *fs_type, | 1452 | static int ufs_get_sb(struct file_system_type *fs_type, |
1561 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) | 1453 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
1562 | { | 1454 | { |
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index 3733057e7833..589e01a465ba 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" |
@@ -516,15 +515,6 @@ int ufs_setattr(struct dentry *dentry, struct iattr *attr) | |||
516 | if (error) | 515 | if (error) |
517 | return error; | 516 | return error; |
518 | 517 | ||
519 | if (is_quota_modification(inode, attr)) | ||
520 | dquot_initialize(inode); | ||
521 | |||
522 | if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || | ||
523 | (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { | ||
524 | error = dquot_transfer(inode, attr); | ||
525 | if (error) | ||
526 | return error; | ||
527 | } | ||
528 | if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) { | 518 | if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) { |
529 | loff_t old_i_size = inode->i_size; | 519 | loff_t old_i_size = inode->i_size; |
530 | 520 | ||