aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
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/udf
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/udf')
-rw-r--r--fs/udf/balloc.c35
-rw-r--r--fs/udf/file.c28
-rw-r--r--fs/udf/ialloc.c14
-rw-r--r--fs/udf/inode.c6
-rw-r--r--fs/udf/namei.c17
5 files changed, 77 insertions, 23 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index b2d96f45c12b..ccc3ad7242d4 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -208,7 +208,7 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
208 ((char *)bh->b_data)[(bit + i) >> 3]); 208 ((char *)bh->b_data)[(bit + i) >> 3]);
209 } else { 209 } else {
210 if (inode) 210 if (inode)
211 vfs_dq_free_block(inode, 1); 211 dquot_free_block(inode, 1);
212 udf_add_free_space(sb, sbi->s_partition, 1); 212 udf_add_free_space(sb, sbi->s_partition, 1);
213 } 213 }
214 } 214 }
@@ -260,11 +260,11 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb,
260 while (bit < (sb->s_blocksize << 3) && block_count > 0) { 260 while (bit < (sb->s_blocksize << 3) && block_count > 0) {
261 if (!udf_test_bit(bit, bh->b_data)) 261 if (!udf_test_bit(bit, bh->b_data))
262 goto out; 262 goto out;
263 else if (vfs_dq_prealloc_block(inode, 1)) 263 else if (dquot_prealloc_block(inode, 1))
264 goto out; 264 goto out;
265 else if (!udf_clear_bit(bit, bh->b_data)) { 265 else if (!udf_clear_bit(bit, bh->b_data)) {
266 udf_debug("bit already cleared for block %d\n", bit); 266 udf_debug("bit already cleared for block %d\n", bit);
267 vfs_dq_free_block(inode, 1); 267 dquot_free_block(inode, 1);
268 goto out; 268 goto out;
269 } 269 }
270 block_count--; 270 block_count--;
@@ -390,10 +390,14 @@ got_block:
390 /* 390 /*
391 * Check quota for allocation of this block. 391 * Check quota for allocation of this block.
392 */ 392 */
393 if (inode && vfs_dq_alloc_block(inode, 1)) { 393 if (inode) {
394 mutex_unlock(&sbi->s_alloc_mutex); 394 int ret = dquot_alloc_block(inode, 1);
395 *err = -EDQUOT; 395
396 return 0; 396 if (ret) {
397 mutex_unlock(&sbi->s_alloc_mutex);
398 *err = ret;
399 return 0;
400 }
397 } 401 }
398 402
399 newblock = bit + (block_group << (sb->s_blocksize_bits + 3)) - 403 newblock = bit + (block_group << (sb->s_blocksize_bits + 3)) -
@@ -449,7 +453,7 @@ static void udf_table_free_blocks(struct super_block *sb,
449 /* We do this up front - There are some error conditions that 453 /* We do this up front - There are some error conditions that
450 could occure, but.. oh well */ 454 could occure, but.. oh well */
451 if (inode) 455 if (inode)
452 vfs_dq_free_block(inode, count); 456 dquot_free_block(inode, count);
453 udf_add_free_space(sb, sbi->s_partition, count); 457 udf_add_free_space(sb, sbi->s_partition, count);
454 458
455 start = bloc->logicalBlockNum + offset; 459 start = bloc->logicalBlockNum + offset;
@@ -694,7 +698,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
694 epos.offset -= adsize; 698 epos.offset -= adsize;
695 699
696 alloc_count = (elen >> sb->s_blocksize_bits); 700 alloc_count = (elen >> sb->s_blocksize_bits);
697 if (inode && vfs_dq_prealloc_block(inode, 701 if (inode && dquot_prealloc_block(inode,
698 alloc_count > block_count ? block_count : alloc_count)) 702 alloc_count > block_count ? block_count : alloc_count))
699 alloc_count = 0; 703 alloc_count = 0;
700 else if (alloc_count > block_count) { 704 else if (alloc_count > block_count) {
@@ -797,12 +801,13 @@ static int udf_table_new_block(struct super_block *sb,
797 newblock = goal_eloc.logicalBlockNum; 801 newblock = goal_eloc.logicalBlockNum;
798 goal_eloc.logicalBlockNum++; 802 goal_eloc.logicalBlockNum++;
799 goal_elen -= sb->s_blocksize; 803 goal_elen -= sb->s_blocksize;
800 804 if (inode) {
801 if (inode && vfs_dq_alloc_block(inode, 1)) { 805 *err = dquot_alloc_block(inode, 1);
802 brelse(goal_epos.bh); 806 if (*err) {
803 mutex_unlock(&sbi->s_alloc_mutex); 807 brelse(goal_epos.bh);
804 *err = -EDQUOT; 808 mutex_unlock(&sbi->s_alloc_mutex);
805 return 0; 809 return 0;
810 }
806 } 811 }
807 812
808 if (goal_elen) 813 if (goal_elen)
diff --git a/fs/udf/file.c b/fs/udf/file.c
index f311d509b6a3..1eb06774ed90 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -34,6 +34,7 @@
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/smp_lock.h> 35#include <linux/smp_lock.h>
36#include <linux/pagemap.h> 36#include <linux/pagemap.h>
37#include <linux/quotaops.h>
37#include <linux/buffer_head.h> 38#include <linux/buffer_head.h>
38#include <linux/aio.h> 39#include <linux/aio.h>
39 40
@@ -207,7 +208,7 @@ const struct file_operations udf_file_operations = {
207 .read = do_sync_read, 208 .read = do_sync_read,
208 .aio_read = generic_file_aio_read, 209 .aio_read = generic_file_aio_read,
209 .ioctl = udf_ioctl, 210 .ioctl = udf_ioctl,
210 .open = generic_file_open, 211 .open = dquot_file_open,
211 .mmap = generic_file_mmap, 212 .mmap = generic_file_mmap,
212 .write = do_sync_write, 213 .write = do_sync_write,
213 .aio_write = udf_file_aio_write, 214 .aio_write = udf_file_aio_write,
@@ -217,6 +218,29 @@ const struct file_operations udf_file_operations = {
217 .llseek = generic_file_llseek, 218 .llseek = generic_file_llseek,
218}; 219};
219 220
221static int udf_setattr(struct dentry *dentry, struct iattr *iattr)
222{
223 struct inode *inode = dentry->d_inode;
224 int error;
225
226 error = inode_change_ok(inode, iattr);
227 if (error)
228 return error;
229
230 if (iattr->ia_valid & ATTR_SIZE)
231 dquot_initialize(inode);
232
233 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
234 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
235 error = dquot_transfer(inode, iattr);
236 if (error)
237 return error;
238 }
239
240 return inode_setattr(inode, iattr);
241}
242
220const struct inode_operations udf_file_inode_operations = { 243const struct inode_operations udf_file_inode_operations = {
221 .truncate = udf_truncate, 244 .truncate = udf_truncate,
245 .setattr = udf_setattr,
222}; 246};
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index c10fa39f97e2..fb68c9cd0c3e 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -36,8 +36,8 @@ void udf_free_inode(struct inode *inode)
36 * Note: we must free any quota before locking the superblock, 36 * Note: we must free any quota before locking the superblock,
37 * as writing the quota to disk may need the lock as well. 37 * as writing the quota to disk may need the lock as well.
38 */ 38 */
39 vfs_dq_free_inode(inode); 39 dquot_free_inode(inode);
40 vfs_dq_drop(inode); 40 dquot_drop(inode);
41 41
42 clear_inode(inode); 42 clear_inode(inode);
43 43
@@ -61,7 +61,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
61 struct super_block *sb = dir->i_sb; 61 struct super_block *sb = dir->i_sb;
62 struct udf_sb_info *sbi = UDF_SB(sb); 62 struct udf_sb_info *sbi = UDF_SB(sb);
63 struct inode *inode; 63 struct inode *inode;
64 int block; 64 int block, ret;
65 uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; 65 uint32_t start = UDF_I(dir)->i_location.logicalBlockNum;
66 struct udf_inode_info *iinfo; 66 struct udf_inode_info *iinfo;
67 struct udf_inode_info *dinfo = UDF_I(dir); 67 struct udf_inode_info *dinfo = UDF_I(dir);
@@ -153,12 +153,14 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
153 insert_inode_hash(inode); 153 insert_inode_hash(inode);
154 mark_inode_dirty(inode); 154 mark_inode_dirty(inode);
155 155
156 if (vfs_dq_alloc_inode(inode)) { 156 dquot_initialize(inode);
157 vfs_dq_drop(inode); 157 ret = dquot_alloc_inode(inode);
158 if (ret) {
159 dquot_drop(inode);
158 inode->i_flags |= S_NOQUOTA; 160 inode->i_flags |= S_NOQUOTA;
159 inode->i_nlink = 0; 161 inode->i_nlink = 0;
160 iput(inode); 162 iput(inode);
161 *err = -EDQUOT; 163 *err = ret;
162 return NULL; 164 return NULL;
163 } 165 }
164 166
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index b02089247296..b57ab0402d89 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -36,6 +36,7 @@
36#include <linux/pagemap.h> 36#include <linux/pagemap.h>
37#include <linux/buffer_head.h> 37#include <linux/buffer_head.h>
38#include <linux/writeback.h> 38#include <linux/writeback.h>
39#include <linux/quotaops.h>
39#include <linux/slab.h> 40#include <linux/slab.h>
40#include <linux/crc-itu-t.h> 41#include <linux/crc-itu-t.h>
41 42
@@ -70,6 +71,9 @@ static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int);
70 71
71void udf_delete_inode(struct inode *inode) 72void udf_delete_inode(struct inode *inode)
72{ 73{
74 if (!is_bad_inode(inode))
75 dquot_initialize(inode);
76
73 truncate_inode_pages(&inode->i_data, 0); 77 truncate_inode_pages(&inode->i_data, 0);
74 78
75 if (is_bad_inode(inode)) 79 if (is_bad_inode(inode))
@@ -108,6 +112,8 @@ void udf_clear_inode(struct inode *inode)
108 (unsigned long long)inode->i_size, 112 (unsigned long long)inode->i_size,
109 (unsigned long long)iinfo->i_lenExtents); 113 (unsigned long long)iinfo->i_lenExtents);
110 } 114 }
115
116 dquot_drop(inode);
111 kfree(iinfo->i_ext.i_data); 117 kfree(iinfo->i_ext.i_data);
112 iinfo->i_ext.i_data = NULL; 118 iinfo->i_ext.i_data = NULL;
113} 119}
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 7c56ff00cd53..db423ab078b1 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -563,6 +563,8 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode,
563 int err; 563 int err;
564 struct udf_inode_info *iinfo; 564 struct udf_inode_info *iinfo;
565 565
566 dquot_initialize(dir);
567
566 lock_kernel(); 568 lock_kernel();
567 inode = udf_new_inode(dir, mode, &err); 569 inode = udf_new_inode(dir, mode, &err);
568 if (!inode) { 570 if (!inode) {
@@ -616,6 +618,8 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode,
616 if (!old_valid_dev(rdev)) 618 if (!old_valid_dev(rdev))
617 return -EINVAL; 619 return -EINVAL;
618 620
621 dquot_initialize(dir);
622
619 lock_kernel(); 623 lock_kernel();
620 err = -EIO; 624 err = -EIO;
621 inode = udf_new_inode(dir, mode, &err); 625 inode = udf_new_inode(dir, mode, &err);
@@ -662,6 +666,8 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode)
662 struct udf_inode_info *dinfo = UDF_I(dir); 666 struct udf_inode_info *dinfo = UDF_I(dir);
663 struct udf_inode_info *iinfo; 667 struct udf_inode_info *iinfo;
664 668
669 dquot_initialize(dir);
670
665 lock_kernel(); 671 lock_kernel();
666 err = -EMLINK; 672 err = -EMLINK;
667 if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1) 673 if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1)
@@ -799,6 +805,8 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
799 struct fileIdentDesc *fi, cfi; 805 struct fileIdentDesc *fi, cfi;
800 struct kernel_lb_addr tloc; 806 struct kernel_lb_addr tloc;
801 807
808 dquot_initialize(dir);
809
802 retval = -ENOENT; 810 retval = -ENOENT;
803 lock_kernel(); 811 lock_kernel();
804 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); 812 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
@@ -845,6 +853,8 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
845 struct fileIdentDesc cfi; 853 struct fileIdentDesc cfi;
846 struct kernel_lb_addr tloc; 854 struct kernel_lb_addr tloc;
847 855
856 dquot_initialize(dir);
857
848 retval = -ENOENT; 858 retval = -ENOENT;
849 lock_kernel(); 859 lock_kernel();
850 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); 860 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
@@ -899,6 +909,8 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
899 struct buffer_head *bh; 909 struct buffer_head *bh;
900 struct udf_inode_info *iinfo; 910 struct udf_inode_info *iinfo;
901 911
912 dquot_initialize(dir);
913
902 lock_kernel(); 914 lock_kernel();
903 inode = udf_new_inode(dir, S_IFLNK, &err); 915 inode = udf_new_inode(dir, S_IFLNK, &err);
904 if (!inode) 916 if (!inode)
@@ -1069,6 +1081,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
1069 int err; 1081 int err;
1070 struct buffer_head *bh; 1082 struct buffer_head *bh;
1071 1083
1084 dquot_initialize(dir);
1085
1072 lock_kernel(); 1086 lock_kernel();
1073 if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { 1087 if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) {
1074 unlock_kernel(); 1088 unlock_kernel();
@@ -1131,6 +1145,9 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1131 struct kernel_lb_addr tloc; 1145 struct kernel_lb_addr tloc;
1132 struct udf_inode_info *old_iinfo = UDF_I(old_inode); 1146 struct udf_inode_info *old_iinfo = UDF_I(old_inode);
1133 1147
1148 dquot_initialize(old_dir);
1149 dquot_initialize(new_dir);
1150
1134 lock_kernel(); 1151 lock_kernel();
1135 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); 1152 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi);
1136 if (ofi) { 1153 if (ofi) {