diff options
Diffstat (limited to 'fs/udf')
| -rw-r--r-- | fs/udf/file.c | 2 | ||||
| -rw-r--r-- | fs/udf/ialloc.c | 18 | ||||
| -rw-r--r-- | fs/udf/inode.c | 4 | ||||
| -rw-r--r-- | fs/udf/super.c | 17 | ||||
| -rw-r--r-- | fs/udf/symlink.c | 2 | ||||
| -rw-r--r-- | fs/udf/truncate.c | 64 | ||||
| -rw-r--r-- | fs/udf/udfdecl.h | 7 |
7 files changed, 66 insertions, 48 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c index e34b00e303f1..a59e5f33daf6 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
| @@ -95,7 +95,7 @@ static int udf_adinicb_commit_write(struct file *file, struct page *page, unsign | |||
| 95 | return 0; | 95 | return 0; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | struct address_space_operations udf_adinicb_aops = { | 98 | const struct address_space_operations udf_adinicb_aops = { |
| 99 | .readpage = udf_adinicb_readpage, | 99 | .readpage = udf_adinicb_readpage, |
| 100 | .writepage = udf_adinicb_writepage, | 100 | .writepage = udf_adinicb_writepage, |
| 101 | .sync_page = block_sync_page, | 101 | .sync_page = block_sync_page, |
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 3873c672cb4c..8206983f2ebf 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
| @@ -75,6 +75,12 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) | |||
| 75 | } | 75 | } |
| 76 | *err = -ENOSPC; | 76 | *err = -ENOSPC; |
| 77 | 77 | ||
| 78 | UDF_I_UNIQUE(inode) = 0; | ||
| 79 | UDF_I_LENEXTENTS(inode) = 0; | ||
| 80 | UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; | ||
| 81 | UDF_I_NEXT_ALLOC_GOAL(inode) = 0; | ||
| 82 | UDF_I_STRAT4096(inode) = 0; | ||
| 83 | |||
| 78 | block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum, | 84 | block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum, |
| 79 | start, err); | 85 | start, err); |
| 80 | if (*err) | 86 | if (*err) |
| @@ -84,11 +90,6 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) | |||
| 84 | } | 90 | } |
| 85 | 91 | ||
| 86 | mutex_lock(&sbi->s_alloc_mutex); | 92 | mutex_lock(&sbi->s_alloc_mutex); |
| 87 | UDF_I_UNIQUE(inode) = 0; | ||
| 88 | UDF_I_LENEXTENTS(inode) = 0; | ||
| 89 | UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; | ||
| 90 | UDF_I_NEXT_ALLOC_GOAL(inode) = 0; | ||
| 91 | UDF_I_STRAT4096(inode) = 0; | ||
| 92 | if (UDF_SB_LVIDBH(sb)) | 93 | if (UDF_SB_LVIDBH(sb)) |
| 93 | { | 94 | { |
| 94 | struct logicalVolHeaderDesc *lvhd; | 95 | struct logicalVolHeaderDesc *lvhd; |
| @@ -120,7 +121,6 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) | |||
| 120 | UDF_I_LOCATION(inode).logicalBlockNum = block; | 121 | UDF_I_LOCATION(inode).logicalBlockNum = block; |
| 121 | UDF_I_LOCATION(inode).partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum; | 122 | UDF_I_LOCATION(inode).partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum; |
| 122 | inode->i_ino = udf_get_lb_pblock(sb, UDF_I_LOCATION(inode), 0); | 123 | inode->i_ino = udf_get_lb_pblock(sb, UDF_I_LOCATION(inode), 0); |
| 123 | inode->i_blksize = PAGE_SIZE; | ||
| 124 | inode->i_blocks = 0; | 124 | inode->i_blocks = 0; |
| 125 | UDF_I_LENEATTR(inode) = 0; | 125 | UDF_I_LENEATTR(inode) = 0; |
| 126 | UDF_I_LENALLOC(inode) = 0; | 126 | UDF_I_LENALLOC(inode) = 0; |
| @@ -129,14 +129,12 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) | |||
| 129 | { | 129 | { |
| 130 | UDF_I_EFE(inode) = 1; | 130 | UDF_I_EFE(inode) = 1; |
| 131 | UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE); | 131 | UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE); |
| 132 | UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL); | 132 | UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL); |
| 133 | memset(UDF_I_DATA(inode), 0x00, inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry)); | ||
| 134 | } | 133 | } |
| 135 | else | 134 | else |
| 136 | { | 135 | { |
| 137 | UDF_I_EFE(inode) = 0; | 136 | UDF_I_EFE(inode) = 0; |
| 138 | UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL); | 137 | UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL); |
| 139 | memset(UDF_I_DATA(inode), 0x00, inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | ||
| 140 | } | 138 | } |
| 141 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) | 139 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) |
| 142 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; | 140 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 2983afd5e7fd..b223b32db991 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
| @@ -132,7 +132,7 @@ static sector_t udf_bmap(struct address_space *mapping, sector_t block) | |||
| 132 | return generic_block_bmap(mapping,block,udf_get_block); | 132 | return generic_block_bmap(mapping,block,udf_get_block); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | struct address_space_operations udf_aops = { | 135 | const struct address_space_operations udf_aops = { |
| 136 | .readpage = udf_readpage, | 136 | .readpage = udf_readpage, |
| 137 | .writepage = udf_writepage, | 137 | .writepage = udf_writepage, |
| 138 | .sync_page = block_sync_page, | 138 | .sync_page = block_sync_page, |
| @@ -916,8 +916,6 @@ __udf_read_inode(struct inode *inode) | |||
| 916 | * i_nlink = 1 | 916 | * i_nlink = 1 |
| 917 | * i_op = NULL; | 917 | * i_op = NULL; |
| 918 | */ | 918 | */ |
| 919 | inode->i_blksize = PAGE_SIZE; | ||
| 920 | |||
| 921 | bh = udf_read_ptagged(inode->i_sb, UDF_I_LOCATION(inode), 0, &ident); | 919 | bh = udf_read_ptagged(inode->i_sb, UDF_I_LOCATION(inode), 0, &ident); |
| 922 | 920 | ||
| 923 | if (!bh) | 921 | if (!bh) |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 44fe2cb0bbb2..1d3b5d2070e5 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
| @@ -40,7 +40,6 @@ | |||
| 40 | 40 | ||
| 41 | #include "udfdecl.h" | 41 | #include "udfdecl.h" |
| 42 | 42 | ||
| 43 | #include <linux/config.h> | ||
| 44 | #include <linux/blkdev.h> | 43 | #include <linux/blkdev.h> |
| 45 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
| 46 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
| @@ -116,6 +115,13 @@ static struct inode *udf_alloc_inode(struct super_block *sb) | |||
| 116 | ei = (struct udf_inode_info *)kmem_cache_alloc(udf_inode_cachep, SLAB_KERNEL); | 115 | ei = (struct udf_inode_info *)kmem_cache_alloc(udf_inode_cachep, SLAB_KERNEL); |
| 117 | if (!ei) | 116 | if (!ei) |
| 118 | return NULL; | 117 | return NULL; |
| 118 | |||
| 119 | ei->i_unique = 0; | ||
| 120 | ei->i_lenExtents = 0; | ||
| 121 | ei->i_next_alloc_block = 0; | ||
| 122 | ei->i_next_alloc_goal = 0; | ||
| 123 | ei->i_strat4096 = 0; | ||
| 124 | |||
| 119 | return &ei->vfs_inode; | 125 | return &ei->vfs_inode; |
| 120 | } | 126 | } |
| 121 | 127 | ||
| @@ -150,8 +156,7 @@ static int init_inodecache(void) | |||
| 150 | 156 | ||
| 151 | static void destroy_inodecache(void) | 157 | static void destroy_inodecache(void) |
| 152 | { | 158 | { |
| 153 | if (kmem_cache_destroy(udf_inode_cachep)) | 159 | kmem_cache_destroy(udf_inode_cachep); |
| 154 | printk(KERN_INFO "udf_inode_cache: not all structures were freed\n"); | ||
| 155 | } | 160 | } |
| 156 | 161 | ||
| 157 | /* Superblock operations */ | 162 | /* Superblock operations */ |
| @@ -1616,6 +1621,10 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
| 1616 | goto error_out; | 1621 | goto error_out; |
| 1617 | } | 1622 | } |
| 1618 | 1623 | ||
| 1624 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_READ_ONLY) | ||
| 1625 | printk("UDF-fs: Partition marked readonly; forcing readonly mount\n"); | ||
| 1626 | sb->s_flags |= MS_RDONLY; | ||
| 1627 | |||
| 1619 | if ( udf_find_fileset(sb, &fileset, &rootdir) ) | 1628 | if ( udf_find_fileset(sb, &fileset, &rootdir) ) |
| 1620 | { | 1629 | { |
| 1621 | printk("UDF-fs: No fileset found\n"); | 1630 | printk("UDF-fs: No fileset found\n"); |
| @@ -1653,7 +1662,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
| 1653 | iput(inode); | 1662 | iput(inode); |
| 1654 | goto error_out; | 1663 | goto error_out; |
| 1655 | } | 1664 | } |
| 1656 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 1665 | sb->s_maxbytes = 1<<30; |
| 1657 | return 0; | 1666 | return 0; |
| 1658 | 1667 | ||
| 1659 | error_out: | 1668 | error_out: |
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c index 674bb40edc83..ba068a786563 100644 --- a/fs/udf/symlink.c +++ b/fs/udf/symlink.c | |||
| @@ -113,6 +113,6 @@ out: | |||
| 113 | /* | 113 | /* |
| 114 | * symlinks can't do much... | 114 | * symlinks can't do much... |
| 115 | */ | 115 | */ |
| 116 | struct address_space_operations udf_symlink_aops = { | 116 | const struct address_space_operations udf_symlink_aops = { |
| 117 | .readpage = udf_symlink_filler, | 117 | .readpage = udf_symlink_filler, |
| 118 | }; | 118 | }; |
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c index e1b0e8cfecb4..0abd66ce36ea 100644 --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c | |||
| @@ -239,37 +239,51 @@ void udf_truncate_extents(struct inode * inode) | |||
| 239 | { | 239 | { |
| 240 | if (offset) | 240 | if (offset) |
| 241 | { | 241 | { |
| 242 | extoffset -= adsize; | 242 | /* |
| 243 | etype = udf_next_aext(inode, &bloc, &extoffset, &eloc, &elen, &bh, 1); | 243 | * OK, there is not extent covering inode->i_size and |
| 244 | if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) | 244 | * no extent above inode->i_size => truncate is |
| 245 | { | 245 | * extending the file by 'offset'. |
| 246 | extoffset -= adsize; | 246 | */ |
| 247 | elen = EXT_NOT_RECORDED_NOT_ALLOCATED | (elen + offset); | 247 | if ((!bh && extoffset == udf_file_entry_alloc_offset(inode)) || |
| 248 | udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 0); | 248 | (bh && extoffset == sizeof(struct allocExtDesc))) { |
| 249 | /* File has no extents at all! */ | ||
| 250 | memset(&eloc, 0x00, sizeof(kernel_lb_addr)); | ||
| 251 | elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset; | ||
| 252 | udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1); | ||
| 249 | } | 253 | } |
| 250 | else if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) | 254 | else { |
| 251 | { | ||
| 252 | kernel_lb_addr neloc = { 0, 0 }; | ||
| 253 | extoffset -= adsize; | 255 | extoffset -= adsize; |
| 254 | nelen = EXT_NOT_RECORDED_NOT_ALLOCATED | | 256 | etype = udf_next_aext(inode, &bloc, &extoffset, &eloc, &elen, &bh, 1); |
| 255 | ((elen + offset + inode->i_sb->s_blocksize - 1) & | 257 | if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) |
| 256 | ~(inode->i_sb->s_blocksize - 1)); | 258 | { |
| 257 | udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 1); | 259 | extoffset -= adsize; |
| 258 | udf_add_aext(inode, &bloc, &extoffset, eloc, (etype << 30) | elen, &bh, 1); | 260 | elen = EXT_NOT_RECORDED_NOT_ALLOCATED | (elen + offset); |
| 259 | } | 261 | udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 0); |
| 260 | else | 262 | } |
| 261 | { | 263 | else if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) |
| 262 | if (elen & (inode->i_sb->s_blocksize - 1)) | ||
| 263 | { | 264 | { |
| 265 | kernel_lb_addr neloc = { 0, 0 }; | ||
| 264 | extoffset -= adsize; | 266 | extoffset -= adsize; |
| 265 | elen = EXT_RECORDED_ALLOCATED | | 267 | nelen = EXT_NOT_RECORDED_NOT_ALLOCATED | |
| 266 | ((elen + inode->i_sb->s_blocksize - 1) & | 268 | ((elen + offset + inode->i_sb->s_blocksize - 1) & |
| 267 | ~(inode->i_sb->s_blocksize - 1)); | 269 | ~(inode->i_sb->s_blocksize - 1)); |
| 268 | udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 1); | 270 | udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 1); |
| 271 | udf_add_aext(inode, &bloc, &extoffset, eloc, (etype << 30) | elen, &bh, 1); | ||
| 272 | } | ||
| 273 | else | ||
| 274 | { | ||
| 275 | if (elen & (inode->i_sb->s_blocksize - 1)) | ||
| 276 | { | ||
| 277 | extoffset -= adsize; | ||
| 278 | elen = EXT_RECORDED_ALLOCATED | | ||
| 279 | ((elen + inode->i_sb->s_blocksize - 1) & | ||
| 280 | ~(inode->i_sb->s_blocksize - 1)); | ||
| 281 | udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 1); | ||
| 282 | } | ||
| 283 | memset(&eloc, 0x00, sizeof(kernel_lb_addr)); | ||
| 284 | elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset; | ||
| 285 | udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1); | ||
| 269 | } | 286 | } |
| 270 | memset(&eloc, 0x00, sizeof(kernel_lb_addr)); | ||
| 271 | elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset; | ||
| 272 | udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1); | ||
| 273 | } | 287 | } |
| 274 | } | 288 | } |
| 275 | } | 289 | } |
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 023e19ba5a2e..1033b7cf2939 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | #include "osta_udf.h" | 6 | #include "osta_udf.h" |
| 7 | 7 | ||
| 8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
| 9 | #include <linux/config.h> | ||
| 10 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 11 | #include <linux/udf_fs_i.h> | 10 | #include <linux/udf_fs_i.h> |
| 12 | #include <linux/udf_fs_sb.h> | 11 | #include <linux/udf_fs_sb.h> |
| @@ -47,9 +46,9 @@ extern struct inode_operations udf_dir_inode_operations; | |||
| 47 | extern const struct file_operations udf_dir_operations; | 46 | extern const struct file_operations udf_dir_operations; |
| 48 | extern struct inode_operations udf_file_inode_operations; | 47 | extern struct inode_operations udf_file_inode_operations; |
| 49 | extern const struct file_operations udf_file_operations; | 48 | extern const struct file_operations udf_file_operations; |
| 50 | extern struct address_space_operations udf_aops; | 49 | extern const struct address_space_operations udf_aops; |
| 51 | extern struct address_space_operations udf_adinicb_aops; | 50 | extern const struct address_space_operations udf_adinicb_aops; |
| 52 | extern struct address_space_operations udf_symlink_aops; | 51 | extern const struct address_space_operations udf_symlink_aops; |
| 53 | 52 | ||
| 54 | struct udf_fileident_bh | 53 | struct udf_fileident_bh |
| 55 | { | 54 | { |
