diff options
Diffstat (limited to 'fs/udf')
| -rw-r--r-- | fs/udf/balloc.c | 86 | ||||
| -rw-r--r-- | fs/udf/dir.c | 4 | ||||
| -rw-r--r-- | fs/udf/file.c | 28 | ||||
| -rw-r--r-- | fs/udf/ialloc.c | 14 | ||||
| -rw-r--r-- | fs/udf/inode.c | 48 | ||||
| -rw-r--r-- | fs/udf/namei.c | 37 | ||||
| -rw-r--r-- | fs/udf/symlink.c | 10 | ||||
| -rw-r--r-- | fs/udf/udfdecl.h | 2 |
8 files changed, 118 insertions, 111 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index 82372e332f08..19626e2491c4 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c | |||
| @@ -31,55 +31,8 @@ | |||
| 31 | #define udf_clear_bit(nr, addr) ext2_clear_bit(nr, addr) | 31 | #define udf_clear_bit(nr, addr) ext2_clear_bit(nr, addr) |
| 32 | #define udf_set_bit(nr, addr) ext2_set_bit(nr, addr) | 32 | #define udf_set_bit(nr, addr) ext2_set_bit(nr, addr) |
| 33 | #define udf_test_bit(nr, addr) ext2_test_bit(nr, addr) | 33 | #define udf_test_bit(nr, addr) ext2_test_bit(nr, addr) |
| 34 | #define udf_find_first_one_bit(addr, size) find_first_one_bit(addr, size) | ||
| 35 | #define udf_find_next_one_bit(addr, size, offset) \ | 34 | #define udf_find_next_one_bit(addr, size, offset) \ |
| 36 | find_next_one_bit(addr, size, offset) | 35 | ext2_find_next_bit(addr, size, offset) |
| 37 | |||
| 38 | #define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x) | ||
| 39 | #define leNUM_to_cpup(x, y) xleNUM_to_cpup(x, y) | ||
| 40 | #define xleNUM_to_cpup(x, y) (le ## x ## _to_cpup(y)) | ||
| 41 | #define uintBPL_t uint(BITS_PER_LONG) | ||
| 42 | #define uint(x) xuint(x) | ||
| 43 | #define xuint(x) __le ## x | ||
| 44 | |||
| 45 | static inline int find_next_one_bit(void *addr, int size, int offset) | ||
| 46 | { | ||
| 47 | uintBPL_t *p = ((uintBPL_t *) addr) + (offset / BITS_PER_LONG); | ||
| 48 | int result = offset & ~(BITS_PER_LONG - 1); | ||
| 49 | unsigned long tmp; | ||
| 50 | |||
| 51 | if (offset >= size) | ||
| 52 | return size; | ||
| 53 | size -= result; | ||
| 54 | offset &= (BITS_PER_LONG - 1); | ||
| 55 | if (offset) { | ||
| 56 | tmp = leBPL_to_cpup(p++); | ||
| 57 | tmp &= ~0UL << offset; | ||
| 58 | if (size < BITS_PER_LONG) | ||
| 59 | goto found_first; | ||
| 60 | if (tmp) | ||
| 61 | goto found_middle; | ||
| 62 | size -= BITS_PER_LONG; | ||
| 63 | result += BITS_PER_LONG; | ||
| 64 | } | ||
| 65 | while (size & ~(BITS_PER_LONG - 1)) { | ||
| 66 | tmp = leBPL_to_cpup(p++); | ||
| 67 | if (tmp) | ||
| 68 | goto found_middle; | ||
| 69 | result += BITS_PER_LONG; | ||
| 70 | size -= BITS_PER_LONG; | ||
| 71 | } | ||
| 72 | if (!size) | ||
| 73 | return result; | ||
| 74 | tmp = leBPL_to_cpup(p); | ||
| 75 | found_first: | ||
| 76 | tmp &= ~0UL >> (BITS_PER_LONG - size); | ||
| 77 | found_middle: | ||
| 78 | return result + ffz(~tmp); | ||
| 79 | } | ||
| 80 | |||
| 81 | #define find_first_one_bit(addr, size)\ | ||
| 82 | find_next_one_bit((addr), (size), 0) | ||
| 83 | 36 | ||
| 84 | static int read_block_bitmap(struct super_block *sb, | 37 | static int read_block_bitmap(struct super_block *sb, |
| 85 | struct udf_bitmap *bitmap, unsigned int block, | 38 | struct udf_bitmap *bitmap, unsigned int block, |
| @@ -208,7 +161,7 @@ static void udf_bitmap_free_blocks(struct super_block *sb, | |||
| 208 | ((char *)bh->b_data)[(bit + i) >> 3]); | 161 | ((char *)bh->b_data)[(bit + i) >> 3]); |
| 209 | } else { | 162 | } else { |
| 210 | if (inode) | 163 | if (inode) |
| 211 | vfs_dq_free_block(inode, 1); | 164 | dquot_free_block(inode, 1); |
| 212 | udf_add_free_space(sb, sbi->s_partition, 1); | 165 | udf_add_free_space(sb, sbi->s_partition, 1); |
| 213 | } | 166 | } |
| 214 | } | 167 | } |
| @@ -260,11 +213,11 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb, | |||
| 260 | while (bit < (sb->s_blocksize << 3) && block_count > 0) { | 213 | while (bit < (sb->s_blocksize << 3) && block_count > 0) { |
| 261 | if (!udf_test_bit(bit, bh->b_data)) | 214 | if (!udf_test_bit(bit, bh->b_data)) |
| 262 | goto out; | 215 | goto out; |
| 263 | else if (vfs_dq_prealloc_block(inode, 1)) | 216 | else if (dquot_prealloc_block(inode, 1)) |
| 264 | goto out; | 217 | goto out; |
| 265 | else if (!udf_clear_bit(bit, bh->b_data)) { | 218 | else if (!udf_clear_bit(bit, bh->b_data)) { |
| 266 | udf_debug("bit already cleared for block %d\n", bit); | 219 | udf_debug("bit already cleared for block %d\n", bit); |
| 267 | vfs_dq_free_block(inode, 1); | 220 | dquot_free_block(inode, 1); |
| 268 | goto out; | 221 | goto out; |
| 269 | } | 222 | } |
| 270 | block_count--; | 223 | block_count--; |
| @@ -390,10 +343,14 @@ got_block: | |||
| 390 | /* | 343 | /* |
| 391 | * Check quota for allocation of this block. | 344 | * Check quota for allocation of this block. |
| 392 | */ | 345 | */ |
| 393 | if (inode && vfs_dq_alloc_block(inode, 1)) { | 346 | if (inode) { |
| 394 | mutex_unlock(&sbi->s_alloc_mutex); | 347 | int ret = dquot_alloc_block(inode, 1); |
| 395 | *err = -EDQUOT; | 348 | |
| 396 | return 0; | 349 | if (ret) { |
| 350 | mutex_unlock(&sbi->s_alloc_mutex); | ||
| 351 | *err = ret; | ||
| 352 | return 0; | ||
| 353 | } | ||
| 397 | } | 354 | } |
| 398 | 355 | ||
| 399 | newblock = bit + (block_group << (sb->s_blocksize_bits + 3)) - | 356 | newblock = bit + (block_group << (sb->s_blocksize_bits + 3)) - |
| @@ -449,7 +406,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
| 449 | /* We do this up front - There are some error conditions that | 406 | /* We do this up front - There are some error conditions that |
| 450 | could occure, but.. oh well */ | 407 | could occure, but.. oh well */ |
| 451 | if (inode) | 408 | if (inode) |
| 452 | vfs_dq_free_block(inode, count); | 409 | dquot_free_block(inode, count); |
| 453 | udf_add_free_space(sb, sbi->s_partition, count); | 410 | udf_add_free_space(sb, sbi->s_partition, count); |
| 454 | 411 | ||
| 455 | start = bloc->logicalBlockNum + offset; | 412 | start = bloc->logicalBlockNum + offset; |
| @@ -547,7 +504,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
| 547 | } | 504 | } |
| 548 | 505 | ||
| 549 | if (epos.offset + (2 * adsize) > sb->s_blocksize) { | 506 | if (epos.offset + (2 * adsize) > sb->s_blocksize) { |
| 550 | char *sptr, *dptr; | 507 | unsigned char *sptr, *dptr; |
| 551 | int loffset; | 508 | int loffset; |
| 552 | 509 | ||
| 553 | brelse(oepos.bh); | 510 | brelse(oepos.bh); |
| @@ -694,7 +651,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb, | |||
| 694 | epos.offset -= adsize; | 651 | epos.offset -= adsize; |
| 695 | 652 | ||
| 696 | alloc_count = (elen >> sb->s_blocksize_bits); | 653 | alloc_count = (elen >> sb->s_blocksize_bits); |
| 697 | if (inode && vfs_dq_prealloc_block(inode, | 654 | if (inode && dquot_prealloc_block(inode, |
| 698 | alloc_count > block_count ? block_count : alloc_count)) | 655 | alloc_count > block_count ? block_count : alloc_count)) |
| 699 | alloc_count = 0; | 656 | alloc_count = 0; |
| 700 | else if (alloc_count > block_count) { | 657 | else if (alloc_count > block_count) { |
| @@ -797,12 +754,13 @@ static int udf_table_new_block(struct super_block *sb, | |||
| 797 | newblock = goal_eloc.logicalBlockNum; | 754 | newblock = goal_eloc.logicalBlockNum; |
| 798 | goal_eloc.logicalBlockNum++; | 755 | goal_eloc.logicalBlockNum++; |
| 799 | goal_elen -= sb->s_blocksize; | 756 | goal_elen -= sb->s_blocksize; |
| 800 | 757 | if (inode) { | |
| 801 | if (inode && vfs_dq_alloc_block(inode, 1)) { | 758 | *err = dquot_alloc_block(inode, 1); |
| 802 | brelse(goal_epos.bh); | 759 | if (*err) { |
| 803 | mutex_unlock(&sbi->s_alloc_mutex); | 760 | brelse(goal_epos.bh); |
| 804 | *err = -EDQUOT; | 761 | mutex_unlock(&sbi->s_alloc_mutex); |
| 805 | return 0; | 762 | return 0; |
| 763 | } | ||
| 806 | } | 764 | } |
| 807 | 765 | ||
| 808 | if (goal_elen) | 766 | if (goal_elen) |
diff --git a/fs/udf/dir.c b/fs/udf/dir.c index 61d9a76a3a69..f0f2a436251e 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c | |||
| @@ -45,8 +45,8 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, | |||
| 45 | int block, iblock; | 45 | int block, iblock; |
| 46 | loff_t nf_pos = (filp->f_pos - 1) << 2; | 46 | loff_t nf_pos = (filp->f_pos - 1) << 2; |
| 47 | int flen; | 47 | int flen; |
| 48 | char *fname = NULL; | 48 | unsigned char *fname = NULL; |
| 49 | char *nameptr; | 49 | unsigned char *nameptr; |
| 50 | uint16_t liu; | 50 | uint16_t liu; |
| 51 | uint8_t lfi; | 51 | uint8_t lfi; |
| 52 | loff_t size = udf_ext0_offset(dir) + dir->i_size; | 52 | loff_t size = udf_ext0_offset(dir) + dir->i_size; |
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 | ||
| 221 | static 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 | |||
| 220 | const struct inode_operations udf_file_inode_operations = { | 243 | const 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 f90231eb2916..bb863fe579ac 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 | ||
| 71 | void udf_delete_inode(struct inode *inode) | 72 | void 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)) |
| @@ -102,12 +106,14 @@ void udf_clear_inode(struct inode *inode) | |||
| 102 | if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB && | 106 | if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB && |
| 103 | inode->i_size != iinfo->i_lenExtents) { | 107 | inode->i_size != iinfo->i_lenExtents) { |
| 104 | printk(KERN_WARNING "UDF-fs (%s): Inode %lu (mode %o) has " | 108 | printk(KERN_WARNING "UDF-fs (%s): Inode %lu (mode %o) has " |
| 105 | "inode size %llu different from extent lenght %llu. " | 109 | "inode size %llu different from extent length %llu. " |
| 106 | "Filesystem need not be standards compliant.\n", | 110 | "Filesystem need not be standards compliant.\n", |
| 107 | inode->i_sb->s_id, inode->i_ino, inode->i_mode, | 111 | inode->i_sb->s_id, inode->i_ino, inode->i_mode, |
| 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 | } |
| @@ -1373,12 +1379,12 @@ static mode_t udf_convert_permissions(struct fileEntry *fe) | |||
| 1373 | return mode; | 1379 | return mode; |
| 1374 | } | 1380 | } |
| 1375 | 1381 | ||
| 1376 | int udf_write_inode(struct inode *inode, int sync) | 1382 | int udf_write_inode(struct inode *inode, struct writeback_control *wbc) |
| 1377 | { | 1383 | { |
| 1378 | int ret; | 1384 | int ret; |
| 1379 | 1385 | ||
| 1380 | lock_kernel(); | 1386 | lock_kernel(); |
| 1381 | ret = udf_update_inode(inode, sync); | 1387 | ret = udf_update_inode(inode, wbc->sync_mode == WB_SYNC_ALL); |
| 1382 | unlock_kernel(); | 1388 | unlock_kernel(); |
| 1383 | 1389 | ||
| 1384 | return ret; | 1390 | return ret; |
| @@ -1402,20 +1408,19 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1402 | unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; | 1408 | unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; |
| 1403 | struct udf_inode_info *iinfo = UDF_I(inode); | 1409 | struct udf_inode_info *iinfo = UDF_I(inode); |
| 1404 | 1410 | ||
| 1405 | bh = udf_tread(inode->i_sb, | 1411 | bh = udf_tgetblk(inode->i_sb, |
| 1406 | udf_get_lb_pblock(inode->i_sb, | 1412 | udf_get_lb_pblock(inode->i_sb, &iinfo->i_location, 0)); |
| 1407 | &iinfo->i_location, 0)); | ||
| 1408 | if (!bh) { | 1413 | if (!bh) { |
| 1409 | udf_debug("bread failure\n"); | 1414 | udf_debug("getblk failure\n"); |
| 1410 | return -EIO; | 1415 | return -ENOMEM; |
| 1411 | } | 1416 | } |
| 1412 | 1417 | ||
| 1413 | memset(bh->b_data, 0x00, inode->i_sb->s_blocksize); | 1418 | lock_buffer(bh); |
| 1414 | 1419 | memset(bh->b_data, 0, inode->i_sb->s_blocksize); | |
| 1415 | fe = (struct fileEntry *)bh->b_data; | 1420 | fe = (struct fileEntry *)bh->b_data; |
| 1416 | efe = (struct extendedFileEntry *)bh->b_data; | 1421 | efe = (struct extendedFileEntry *)bh->b_data; |
| 1417 | 1422 | ||
| 1418 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) { | 1423 | if (iinfo->i_use) { |
| 1419 | struct unallocSpaceEntry *use = | 1424 | struct unallocSpaceEntry *use = |
| 1420 | (struct unallocSpaceEntry *)bh->b_data; | 1425 | (struct unallocSpaceEntry *)bh->b_data; |
| 1421 | 1426 | ||
| @@ -1423,20 +1428,18 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1423 | memcpy(bh->b_data + sizeof(struct unallocSpaceEntry), | 1428 | memcpy(bh->b_data + sizeof(struct unallocSpaceEntry), |
| 1424 | iinfo->i_ext.i_data, inode->i_sb->s_blocksize - | 1429 | iinfo->i_ext.i_data, inode->i_sb->s_blocksize - |
| 1425 | sizeof(struct unallocSpaceEntry)); | 1430 | sizeof(struct unallocSpaceEntry)); |
| 1431 | use->descTag.tagIdent = cpu_to_le16(TAG_IDENT_USE); | ||
| 1432 | use->descTag.tagLocation = | ||
| 1433 | cpu_to_le32(iinfo->i_location.logicalBlockNum); | ||
| 1426 | crclen = sizeof(struct unallocSpaceEntry) + | 1434 | crclen = sizeof(struct unallocSpaceEntry) + |
| 1427 | iinfo->i_lenAlloc - sizeof(struct tag); | 1435 | iinfo->i_lenAlloc - sizeof(struct tag); |
| 1428 | use->descTag.tagLocation = cpu_to_le32( | ||
| 1429 | iinfo->i_location. | ||
| 1430 | logicalBlockNum); | ||
| 1431 | use->descTag.descCRCLength = cpu_to_le16(crclen); | 1436 | use->descTag.descCRCLength = cpu_to_le16(crclen); |
| 1432 | use->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)use + | 1437 | use->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)use + |
| 1433 | sizeof(struct tag), | 1438 | sizeof(struct tag), |
| 1434 | crclen)); | 1439 | crclen)); |
| 1435 | use->descTag.tagChecksum = udf_tag_checksum(&use->descTag); | 1440 | use->descTag.tagChecksum = udf_tag_checksum(&use->descTag); |
| 1436 | 1441 | ||
| 1437 | mark_buffer_dirty(bh); | 1442 | goto out; |
| 1438 | brelse(bh); | ||
| 1439 | return err; | ||
| 1440 | } | 1443 | } |
| 1441 | 1444 | ||
| 1442 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) | 1445 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) |
| @@ -1591,18 +1594,21 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1591 | fe->descTag.tagSerialNum = cpu_to_le16(sbi->s_serial_number); | 1594 | fe->descTag.tagSerialNum = cpu_to_le16(sbi->s_serial_number); |
| 1592 | fe->descTag.tagLocation = cpu_to_le32( | 1595 | fe->descTag.tagLocation = cpu_to_le32( |
| 1593 | iinfo->i_location.logicalBlockNum); | 1596 | iinfo->i_location.logicalBlockNum); |
| 1594 | crclen += iinfo->i_lenEAttr + iinfo->i_lenAlloc - | 1597 | crclen += iinfo->i_lenEAttr + iinfo->i_lenAlloc - sizeof(struct tag); |
| 1595 | sizeof(struct tag); | ||
| 1596 | fe->descTag.descCRCLength = cpu_to_le16(crclen); | 1598 | fe->descTag.descCRCLength = cpu_to_le16(crclen); |
| 1597 | fe->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)fe + sizeof(struct tag), | 1599 | fe->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)fe + sizeof(struct tag), |
| 1598 | crclen)); | 1600 | crclen)); |
| 1599 | fe->descTag.tagChecksum = udf_tag_checksum(&fe->descTag); | 1601 | fe->descTag.tagChecksum = udf_tag_checksum(&fe->descTag); |
| 1600 | 1602 | ||
| 1603 | out: | ||
| 1604 | set_buffer_uptodate(bh); | ||
| 1605 | unlock_buffer(bh); | ||
| 1606 | |||
| 1601 | /* write the data blocks */ | 1607 | /* write the data blocks */ |
| 1602 | mark_buffer_dirty(bh); | 1608 | mark_buffer_dirty(bh); |
| 1603 | if (do_sync) { | 1609 | if (do_sync) { |
| 1604 | sync_dirty_buffer(bh); | 1610 | sync_dirty_buffer(bh); |
| 1605 | if (buffer_req(bh) && !buffer_uptodate(bh)) { | 1611 | if (buffer_write_io_error(bh)) { |
| 1606 | printk(KERN_WARNING "IO error syncing udf inode " | 1612 | printk(KERN_WARNING "IO error syncing udf inode " |
| 1607 | "[%s:%08lx]\n", inode->i_sb->s_id, | 1613 | "[%s:%08lx]\n", inode->i_sb->s_id, |
| 1608 | inode->i_ino); | 1614 | inode->i_ino); |
| @@ -1672,7 +1678,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
| 1672 | return -1; | 1678 | return -1; |
| 1673 | 1679 | ||
| 1674 | if (epos->offset + (2 * adsize) > inode->i_sb->s_blocksize) { | 1680 | if (epos->offset + (2 * adsize) > inode->i_sb->s_blocksize) { |
| 1675 | char *sptr, *dptr; | 1681 | unsigned char *sptr, *dptr; |
| 1676 | struct buffer_head *nbh; | 1682 | struct buffer_head *nbh; |
| 1677 | int err, loffset; | 1683 | int err, loffset; |
| 1678 | struct kernel_lb_addr obloc = epos->block; | 1684 | struct kernel_lb_addr obloc = epos->block; |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index cd2115060fdc..db423ab078b1 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
| @@ -34,8 +34,8 @@ | |||
| 34 | #include <linux/crc-itu-t.h> | 34 | #include <linux/crc-itu-t.h> |
| 35 | #include <linux/exportfs.h> | 35 | #include <linux/exportfs.h> |
| 36 | 36 | ||
| 37 | static inline int udf_match(int len1, const char *name1, int len2, | 37 | static inline int udf_match(int len1, const unsigned char *name1, int len2, |
| 38 | const char *name2) | 38 | const unsigned char *name2) |
| 39 | { | 39 | { |
| 40 | if (len1 != len2) | 40 | if (len1 != len2) |
| 41 | return 0; | 41 | return 0; |
| @@ -142,15 +142,15 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi, | |||
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | static struct fileIdentDesc *udf_find_entry(struct inode *dir, | 144 | static struct fileIdentDesc *udf_find_entry(struct inode *dir, |
| 145 | struct qstr *child, | 145 | const struct qstr *child, |
| 146 | struct udf_fileident_bh *fibh, | 146 | struct udf_fileident_bh *fibh, |
| 147 | struct fileIdentDesc *cfi) | 147 | struct fileIdentDesc *cfi) |
| 148 | { | 148 | { |
| 149 | struct fileIdentDesc *fi = NULL; | 149 | struct fileIdentDesc *fi = NULL; |
| 150 | loff_t f_pos; | 150 | loff_t f_pos; |
| 151 | int block, flen; | 151 | int block, flen; |
| 152 | char *fname = NULL; | 152 | unsigned char *fname = NULL; |
| 153 | char *nameptr; | 153 | unsigned char *nameptr; |
| 154 | uint8_t lfi; | 154 | uint8_t lfi; |
| 155 | uint16_t liu; | 155 | uint16_t liu; |
| 156 | loff_t size; | 156 | loff_t size; |
| @@ -308,7 +308,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, | |||
| 308 | { | 308 | { |
| 309 | struct super_block *sb = dir->i_sb; | 309 | struct super_block *sb = dir->i_sb; |
| 310 | struct fileIdentDesc *fi = NULL; | 310 | struct fileIdentDesc *fi = NULL; |
| 311 | char *name = NULL; | 311 | unsigned char *name = NULL; |
| 312 | int namelen; | 312 | int namelen; |
| 313 | loff_t f_pos; | 313 | loff_t f_pos; |
| 314 | loff_t size = udf_ext0_offset(dir) + dir->i_size; | 314 | loff_t size = udf_ext0_offset(dir) + dir->i_size; |
| @@ -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); |
| @@ -885,20 +895,22 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
| 885 | { | 895 | { |
| 886 | struct inode *inode; | 896 | struct inode *inode; |
| 887 | struct pathComponent *pc; | 897 | struct pathComponent *pc; |
| 888 | char *compstart; | 898 | const char *compstart; |
| 889 | struct udf_fileident_bh fibh; | 899 | struct udf_fileident_bh fibh; |
| 890 | struct extent_position epos = {}; | 900 | struct extent_position epos = {}; |
| 891 | int eoffset, elen = 0; | 901 | int eoffset, elen = 0; |
| 892 | struct fileIdentDesc *fi; | 902 | struct fileIdentDesc *fi; |
| 893 | struct fileIdentDesc cfi; | 903 | struct fileIdentDesc cfi; |
| 894 | char *ea; | 904 | uint8_t *ea; |
| 895 | int err; | 905 | int err; |
| 896 | int block; | 906 | int block; |
| 897 | char *name = NULL; | 907 | unsigned char *name = NULL; |
| 898 | int namelen; | 908 | int namelen; |
| 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) |
| @@ -970,7 +982,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
| 970 | 982 | ||
| 971 | pc = (struct pathComponent *)(ea + elen); | 983 | pc = (struct pathComponent *)(ea + elen); |
| 972 | 984 | ||
| 973 | compstart = (char *)symname; | 985 | compstart = symname; |
| 974 | 986 | ||
| 975 | do { | 987 | do { |
| 976 | symname++; | 988 | symname++; |
| @@ -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) { |
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c index c3265e1385d4..852e91845688 100644 --- a/fs/udf/symlink.c +++ b/fs/udf/symlink.c | |||
| @@ -32,12 +32,12 @@ | |||
| 32 | #include <linux/buffer_head.h> | 32 | #include <linux/buffer_head.h> |
| 33 | #include "udf_i.h" | 33 | #include "udf_i.h" |
| 34 | 34 | ||
| 35 | static void udf_pc_to_char(struct super_block *sb, char *from, int fromlen, | 35 | static void udf_pc_to_char(struct super_block *sb, unsigned char *from, |
| 36 | char *to) | 36 | int fromlen, unsigned char *to) |
| 37 | { | 37 | { |
| 38 | struct pathComponent *pc; | 38 | struct pathComponent *pc; |
| 39 | int elen = 0; | 39 | int elen = 0; |
| 40 | char *p = to; | 40 | unsigned char *p = to; |
| 41 | 41 | ||
| 42 | while (elen < fromlen) { | 42 | while (elen < fromlen) { |
| 43 | pc = (struct pathComponent *)(from + elen); | 43 | pc = (struct pathComponent *)(from + elen); |
| @@ -75,9 +75,9 @@ static int udf_symlink_filler(struct file *file, struct page *page) | |||
| 75 | { | 75 | { |
| 76 | struct inode *inode = page->mapping->host; | 76 | struct inode *inode = page->mapping->host; |
| 77 | struct buffer_head *bh = NULL; | 77 | struct buffer_head *bh = NULL; |
| 78 | char *symlink; | 78 | unsigned char *symlink; |
| 79 | int err = -EIO; | 79 | int err = -EIO; |
| 80 | char *p = kmap(page); | 80 | unsigned char *p = kmap(page); |
| 81 | struct udf_inode_info *iinfo; | 81 | struct udf_inode_info *iinfo; |
| 82 | 82 | ||
| 83 | lock_kernel(); | 83 | lock_kernel(); |
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 8d46f4294ee7..4223ac855da9 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
| @@ -142,7 +142,7 @@ extern void udf_truncate(struct inode *); | |||
| 142 | extern void udf_read_inode(struct inode *); | 142 | extern void udf_read_inode(struct inode *); |
| 143 | extern void udf_delete_inode(struct inode *); | 143 | extern void udf_delete_inode(struct inode *); |
| 144 | extern void udf_clear_inode(struct inode *); | 144 | extern void udf_clear_inode(struct inode *); |
| 145 | extern int udf_write_inode(struct inode *, int); | 145 | extern int udf_write_inode(struct inode *, struct writeback_control *wbc); |
| 146 | extern long udf_block_map(struct inode *, sector_t); | 146 | extern long udf_block_map(struct inode *, sector_t); |
| 147 | extern int udf_extend_file(struct inode *, struct extent_position *, | 147 | extern int udf_extend_file(struct inode *, struct extent_position *, |
| 148 | struct kernel_long_ad *, sector_t); | 148 | struct kernel_long_ad *, sector_t); |
