aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/balloc.c20
-rw-r--r--fs/udf/dir.c1
-rw-r--r--fs/udf/directory.c1
-rw-r--r--fs/udf/file.c30
-rw-r--r--fs/udf/inode.c12
-rw-r--r--fs/udf/misc.c1
-rw-r--r--fs/udf/namei.c10
-rw-r--r--fs/udf/partition.c1
-rw-r--r--fs/udf/super.c1
-rw-r--r--fs/udf/symlink.c1
-rw-r--r--fs/udf/truncate.c1
11 files changed, 32 insertions, 47 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index 1ba2baaf4367..6d6a96b4e73f 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -21,7 +21,6 @@
21 21
22#include "udfdecl.h" 22#include "udfdecl.h"
23 23
24#include <linux/buffer_head.h>
25#include <linux/bitops.h> 24#include <linux/bitops.h>
26 25
27#include "udf_i.h" 26#include "udf_i.h"
@@ -63,15 +62,14 @@ static int __load_block_bitmap(struct super_block *sb,
63 block_group, nr_groups); 62 block_group, nr_groups);
64 } 63 }
65 64
66 if (bitmap->s_block_bitmap[block_group]) { 65 if (bitmap->s_block_bitmap[block_group])
67 return block_group; 66 return block_group;
68 } else { 67
69 retval = read_block_bitmap(sb, bitmap, block_group, 68 retval = read_block_bitmap(sb, bitmap, block_group, block_group);
70 block_group); 69 if (retval < 0)
71 if (retval < 0) 70 return retval;
72 return retval; 71
73 return block_group; 72 return block_group;
74 }
75} 73}
76 74
77static inline int load_block_bitmap(struct super_block *sb, 75static inline int load_block_bitmap(struct super_block *sb,
@@ -358,7 +356,6 @@ static void udf_table_free_blocks(struct super_block *sb,
358 struct kernel_lb_addr eloc; 356 struct kernel_lb_addr eloc;
359 struct extent_position oepos, epos; 357 struct extent_position oepos, epos;
360 int8_t etype; 358 int8_t etype;
361 int i;
362 struct udf_inode_info *iinfo; 359 struct udf_inode_info *iinfo;
363 360
364 mutex_lock(&sbi->s_alloc_mutex); 361 mutex_lock(&sbi->s_alloc_mutex);
@@ -425,7 +422,6 @@ static void udf_table_free_blocks(struct super_block *sb,
425 } 422 }
426 423
427 if (epos.bh != oepos.bh) { 424 if (epos.bh != oepos.bh) {
428 i = -1;
429 oepos.block = epos.block; 425 oepos.block = epos.block;
430 brelse(oepos.bh); 426 brelse(oepos.bh);
431 get_bh(epos.bh); 427 get_bh(epos.bh);
@@ -762,7 +758,7 @@ inline int udf_prealloc_blocks(struct super_block *sb,
762 uint32_t block_count) 758 uint32_t block_count)
763{ 759{
764 struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition]; 760 struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
765 sector_t allocated; 761 int allocated;
766 762
767 if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) 763 if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
768 allocated = udf_bitmap_prealloc_blocks(sb, 764 allocated = udf_bitmap_prealloc_blocks(sb,
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index 05e90edd1992..541a12b5792d 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -30,7 +30,6 @@
30#include <linux/errno.h> 30#include <linux/errno.h>
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/buffer_head.h>
34 33
35#include "udf_i.h" 34#include "udf_i.h"
36#include "udf_sb.h" 35#include "udf_sb.h"
diff --git a/fs/udf/directory.c b/fs/udf/directory.c
index 3e44f575fb9c..c763fda257bf 100644
--- a/fs/udf/directory.c
+++ b/fs/udf/directory.c
@@ -16,7 +16,6 @@
16 16
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/string.h> 18#include <linux/string.h>
19#include <linux/buffer_head.h>
20 19
21struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, 20struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
22 struct udf_fileident_bh *fibh, 21 struct udf_fileident_bh *fibh,
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 08f3555fbeac..5dadad9960b9 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -33,8 +33,7 @@
33#include <linux/capability.h> 33#include <linux/capability.h>
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/pagemap.h> 35#include <linux/pagemap.h>
36#include <linux/buffer_head.h> 36#include <linux/uio.h>
37#include <linux/aio.h>
38 37
39#include "udf_i.h" 38#include "udf_i.h"
40#include "udf_sb.h" 39#include "udf_sb.h"
@@ -100,8 +99,7 @@ static int udf_adinicb_write_begin(struct file *file,
100 return 0; 99 return 0;
101} 100}
102 101
103static ssize_t udf_adinicb_direct_IO(int rw, struct kiocb *iocb, 102static ssize_t udf_adinicb_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
104 struct iov_iter *iter,
105 loff_t offset) 103 loff_t offset)
106{ 104{
107 /* Fallback to buffered I/O. */ 105 /* Fallback to buffered I/O. */
@@ -121,21 +119,21 @@ static ssize_t udf_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
121 ssize_t retval; 119 ssize_t retval;
122 struct file *file = iocb->ki_filp; 120 struct file *file = iocb->ki_filp;
123 struct inode *inode = file_inode(file); 121 struct inode *inode = file_inode(file);
124 int err, pos;
125 size_t count = iocb->ki_nbytes;
126 struct udf_inode_info *iinfo = UDF_I(inode); 122 struct udf_inode_info *iinfo = UDF_I(inode);
123 int err;
127 124
128 mutex_lock(&inode->i_mutex); 125 mutex_lock(&inode->i_mutex);
126
127 retval = generic_write_checks(iocb, from);
128 if (retval <= 0)
129 goto out;
130
129 down_write(&iinfo->i_data_sem); 131 down_write(&iinfo->i_data_sem);
130 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { 132 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
131 if (file->f_flags & O_APPEND) 133 loff_t end = iocb->ki_pos + iov_iter_count(from);
132 pos = inode->i_size;
133 else
134 pos = iocb->ki_pos;
135 134
136 if (inode->i_sb->s_blocksize < 135 if (inode->i_sb->s_blocksize <
137 (udf_file_entry_alloc_offset(inode) + 136 (udf_file_entry_alloc_offset(inode) + end)) {
138 pos + count)) {
139 err = udf_expand_file_adinicb(inode); 137 err = udf_expand_file_adinicb(inode);
140 if (err) { 138 if (err) {
141 mutex_unlock(&inode->i_mutex); 139 mutex_unlock(&inode->i_mutex);
@@ -143,16 +141,14 @@ static ssize_t udf_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
143 return err; 141 return err;
144 } 142 }
145 } else { 143 } else {
146 if (pos + count > inode->i_size) 144 iinfo->i_lenAlloc = max(end, inode->i_size);
147 iinfo->i_lenAlloc = pos + count;
148 else
149 iinfo->i_lenAlloc = inode->i_size;
150 up_write(&iinfo->i_data_sem); 145 up_write(&iinfo->i_data_sem);
151 } 146 }
152 } else 147 } else
153 up_write(&iinfo->i_data_sem); 148 up_write(&iinfo->i_data_sem);
154 149
155 retval = __generic_file_write_iter(iocb, from); 150 retval = __generic_file_write_iter(iocb, from);
151out:
156 mutex_unlock(&inode->i_mutex); 152 mutex_unlock(&inode->i_mutex);
157 153
158 if (retval > 0) { 154 if (retval > 0) {
@@ -240,12 +236,10 @@ static int udf_release_file(struct inode *inode, struct file *filp)
240} 236}
241 237
242const struct file_operations udf_file_operations = { 238const struct file_operations udf_file_operations = {
243 .read = new_sync_read,
244 .read_iter = generic_file_read_iter, 239 .read_iter = generic_file_read_iter,
245 .unlocked_ioctl = udf_ioctl, 240 .unlocked_ioctl = udf_ioctl,
246 .open = generic_file_open, 241 .open = generic_file_open,
247 .mmap = generic_file_mmap, 242 .mmap = generic_file_mmap,
248 .write = new_sync_write,
249 .write_iter = udf_file_write_iter, 243 .write_iter = udf_file_write_iter,
250 .release = udf_release_file, 244 .release = udf_release_file,
251 .fsync = generic_file_fsync, 245 .fsync = generic_file_fsync,
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index a445d599098d..6afac3d561ac 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -33,12 +33,11 @@
33#include <linux/mm.h> 33#include <linux/mm.h>
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/pagemap.h> 35#include <linux/pagemap.h>
36#include <linux/buffer_head.h>
37#include <linux/writeback.h> 36#include <linux/writeback.h>
38#include <linux/slab.h> 37#include <linux/slab.h>
39#include <linux/crc-itu-t.h> 38#include <linux/crc-itu-t.h>
40#include <linux/mpage.h> 39#include <linux/mpage.h>
41#include <linux/aio.h> 40#include <linux/uio.h>
42 41
43#include "udf_i.h" 42#include "udf_i.h"
44#include "udf_sb.h" 43#include "udf_sb.h"
@@ -215,8 +214,7 @@ static int udf_write_begin(struct file *file, struct address_space *mapping,
215 return ret; 214 return ret;
216} 215}
217 216
218static ssize_t udf_direct_IO(int rw, struct kiocb *iocb, 217static ssize_t udf_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
219 struct iov_iter *iter,
220 loff_t offset) 218 loff_t offset)
221{ 219{
222 struct file *file = iocb->ki_filp; 220 struct file *file = iocb->ki_filp;
@@ -225,8 +223,8 @@ static ssize_t udf_direct_IO(int rw, struct kiocb *iocb,
225 size_t count = iov_iter_count(iter); 223 size_t count = iov_iter_count(iter);
226 ssize_t ret; 224 ssize_t ret;
227 225
228 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, udf_get_block); 226 ret = blockdev_direct_IO(iocb, inode, iter, offset, udf_get_block);
229 if (unlikely(ret < 0 && (rw & WRITE))) 227 if (unlikely(ret < 0 && iov_iter_rw(iter) == WRITE))
230 udf_write_failed(mapping, offset + count); 228 udf_write_failed(mapping, offset + count);
231 return ret; 229 return ret;
232} 230}
@@ -1637,7 +1635,7 @@ static int udf_update_inode(struct inode *inode, int do_sync)
1637 udf_get_lb_pblock(inode->i_sb, &iinfo->i_location, 0)); 1635 udf_get_lb_pblock(inode->i_sb, &iinfo->i_location, 0));
1638 if (!bh) { 1636 if (!bh) {
1639 udf_debug("getblk failure\n"); 1637 udf_debug("getblk failure\n");
1640 return -ENOMEM; 1638 return -EIO;
1641 } 1639 }
1642 1640
1643 lock_buffer(bh); 1641 lock_buffer(bh);
diff --git a/fs/udf/misc.c b/fs/udf/misc.c
index c175b4dabc14..71d1c25f360d 100644
--- a/fs/udf/misc.c
+++ b/fs/udf/misc.c
@@ -23,7 +23,6 @@
23 23
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/buffer_head.h>
27#include <linux/crc-itu-t.h> 26#include <linux/crc-itu-t.h>
28 27
29#include "udf_i.h" 28#include "udf_i.h"
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 33b246b82c98..39661977c89c 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -27,7 +27,6 @@
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/mm.h> 28#include <linux/mm.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/buffer_head.h>
31#include <linux/sched.h> 30#include <linux/sched.h>
32#include <linux/crc-itu-t.h> 31#include <linux/crc-itu-t.h>
33#include <linux/exportfs.h> 32#include <linux/exportfs.h>
@@ -569,8 +568,8 @@ static int udf_add_nondir(struct dentry *dentry, struct inode *inode)
569 *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = 568 *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
570 cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL); 569 cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL);
571 udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); 570 udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
572 if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) 571 dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
573 mark_inode_dirty(dir); 572 mark_inode_dirty(dir);
574 if (fibh.sbh != fibh.ebh) 573 if (fibh.sbh != fibh.ebh)
575 brelse(fibh.ebh); 574 brelse(fibh.ebh);
576 brelse(fibh.sbh); 575 brelse(fibh.sbh);
@@ -683,6 +682,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
683 cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY; 682 cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY;
684 udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); 683 udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
685 inc_nlink(dir); 684 inc_nlink(dir);
685 dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
686 mark_inode_dirty(dir); 686 mark_inode_dirty(dir);
687 unlock_new_inode(inode); 687 unlock_new_inode(inode);
688 d_instantiate(dentry, inode); 688 d_instantiate(dentry, inode);
@@ -1024,6 +1024,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
1024 inc_nlink(inode); 1024 inc_nlink(inode);
1025 inode->i_ctime = current_fs_time(inode->i_sb); 1025 inode->i_ctime = current_fs_time(inode->i_sb);
1026 mark_inode_dirty(inode); 1026 mark_inode_dirty(inode);
1027 dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
1028 mark_inode_dirty(dir);
1027 ihold(inode); 1029 ihold(inode);
1028 d_instantiate(dentry, inode); 1030 d_instantiate(dentry, inode);
1029 1031
@@ -1127,7 +1129,9 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1127 inode_dec_link_count(new_inode); 1129 inode_dec_link_count(new_inode);
1128 } 1130 }
1129 old_dir->i_ctime = old_dir->i_mtime = current_fs_time(old_dir->i_sb); 1131 old_dir->i_ctime = old_dir->i_mtime = current_fs_time(old_dir->i_sb);
1132 new_dir->i_ctime = new_dir->i_mtime = current_fs_time(new_dir->i_sb);
1130 mark_inode_dirty(old_dir); 1133 mark_inode_dirty(old_dir);
1134 mark_inode_dirty(new_dir);
1131 1135
1132 if (dir_fi) { 1136 if (dir_fi) {
1133 dir_fi->icb.extLocation = cpu_to_lelb(UDF_I(new_dir)->i_location); 1137 dir_fi->icb.extLocation = cpu_to_lelb(UDF_I(new_dir)->i_location);
diff --git a/fs/udf/partition.c b/fs/udf/partition.c
index d6caf01a2097..5f861ed287c3 100644
--- a/fs/udf/partition.c
+++ b/fs/udf/partition.c
@@ -24,7 +24,6 @@
24 24
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/string.h> 26#include <linux/string.h>
27#include <linux/buffer_head.h>
28#include <linux/mutex.h> 27#include <linux/mutex.h>
29 28
30uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, 29uint32_t udf_get_pblock(struct super_block *sb, uint32_t block,
diff --git a/fs/udf/super.c b/fs/udf/super.c
index f169411c4ea0..6299f341967b 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -48,7 +48,6 @@
48#include <linux/stat.h> 48#include <linux/stat.h>
49#include <linux/cdrom.h> 49#include <linux/cdrom.h>
50#include <linux/nls.h> 50#include <linux/nls.h>
51#include <linux/buffer_head.h>
52#include <linux/vfs.h> 51#include <linux/vfs.h>
53#include <linux/vmalloc.h> 52#include <linux/vmalloc.h>
54#include <linux/errno.h> 53#include <linux/errno.h>
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index ac10ca939f26..8dfbc4025e2f 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -27,7 +27,6 @@
27#include <linux/mm.h> 27#include <linux/mm.h>
28#include <linux/stat.h> 28#include <linux/stat.h>
29#include <linux/pagemap.h> 29#include <linux/pagemap.h>
30#include <linux/buffer_head.h>
31#include "udf_i.h" 30#include "udf_i.h"
32 31
33static int udf_pc_to_char(struct super_block *sb, unsigned char *from, 32static int udf_pc_to_char(struct super_block *sb, unsigned char *from,
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
index 8a9657d7f7c6..42b8c57795cb 100644
--- a/fs/udf/truncate.c
+++ b/fs/udf/truncate.c
@@ -22,7 +22,6 @@
22#include "udfdecl.h" 22#include "udfdecl.h"
23#include <linux/fs.h> 23#include <linux/fs.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/buffer_head.h>
26 25
27#include "udf_i.h" 26#include "udf_i.h"
28#include "udf_sb.h" 27#include "udf_sb.h"