diff options
Diffstat (limited to 'fs/ubifs/file.c')
-rw-r--r-- | fs/ubifs/file.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 1009adc8d602..5692cf72b807 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -45,13 +45,14 @@ | |||
45 | * | 45 | * |
46 | * Similarly, @i_mutex is not always locked in 'ubifs_readpage()', e.g., the | 46 | * Similarly, @i_mutex is not always locked in 'ubifs_readpage()', e.g., the |
47 | * read-ahead path does not lock it ("sys_read -> generic_file_aio_read -> | 47 | * read-ahead path does not lock it ("sys_read -> generic_file_aio_read -> |
48 | * ondemand_readahead -> readpage"). In case of readahead, @I_LOCK flag is not | 48 | * ondemand_readahead -> readpage"). In case of readahead, @I_SYNC flag is not |
49 | * set as well. However, UBIFS disables readahead. | 49 | * set as well. However, UBIFS disables readahead. |
50 | */ | 50 | */ |
51 | 51 | ||
52 | #include "ubifs.h" | 52 | #include "ubifs.h" |
53 | #include <linux/mount.h> | 53 | #include <linux/mount.h> |
54 | #include <linux/namei.h> | 54 | #include <linux/namei.h> |
55 | #include <linux/slab.h> | ||
55 | 56 | ||
56 | static int read_block(struct inode *inode, void *addr, unsigned int block, | 57 | static int read_block(struct inode *inode, void *addr, unsigned int block, |
57 | struct ubifs_data_node *dn) | 58 | struct ubifs_data_node *dn) |
@@ -1011,7 +1012,7 @@ static int ubifs_writepage(struct page *page, struct writeback_control *wbc) | |||
1011 | /* Is the page fully inside @i_size? */ | 1012 | /* Is the page fully inside @i_size? */ |
1012 | if (page->index < end_index) { | 1013 | if (page->index < end_index) { |
1013 | if (page->index >= synced_i_size >> PAGE_CACHE_SHIFT) { | 1014 | if (page->index >= synced_i_size >> PAGE_CACHE_SHIFT) { |
1014 | err = inode->i_sb->s_op->write_inode(inode, 1); | 1015 | err = inode->i_sb->s_op->write_inode(inode, NULL); |
1015 | if (err) | 1016 | if (err) |
1016 | goto out_unlock; | 1017 | goto out_unlock; |
1017 | /* | 1018 | /* |
@@ -1039,7 +1040,7 @@ static int ubifs_writepage(struct page *page, struct writeback_control *wbc) | |||
1039 | kunmap_atomic(kaddr, KM_USER0); | 1040 | kunmap_atomic(kaddr, KM_USER0); |
1040 | 1041 | ||
1041 | if (i_size > synced_i_size) { | 1042 | if (i_size > synced_i_size) { |
1042 | err = inode->i_sb->s_op->write_inode(inode, 1); | 1043 | err = inode->i_sb->s_op->write_inode(inode, NULL); |
1043 | if (err) | 1044 | if (err) |
1044 | goto out_unlock; | 1045 | goto out_unlock; |
1045 | } | 1046 | } |
@@ -1242,7 +1243,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode, | |||
1242 | if (release) | 1243 | if (release) |
1243 | ubifs_release_budget(c, &req); | 1244 | ubifs_release_budget(c, &req); |
1244 | if (IS_SYNC(inode)) | 1245 | if (IS_SYNC(inode)) |
1245 | err = inode->i_sb->s_op->write_inode(inode, 1); | 1246 | err = inode->i_sb->s_op->write_inode(inode, NULL); |
1246 | return err; | 1247 | return err; |
1247 | 1248 | ||
1248 | out: | 1249 | out: |
@@ -1316,7 +1317,7 @@ int ubifs_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
1316 | * the inode unless this is a 'datasync()' call. | 1317 | * the inode unless this is a 'datasync()' call. |
1317 | */ | 1318 | */ |
1318 | if (!datasync || (inode->i_state & I_DIRTY_DATASYNC)) { | 1319 | if (!datasync || (inode->i_state & I_DIRTY_DATASYNC)) { |
1319 | err = inode->i_sb->s_op->write_inode(inode, 1); | 1320 | err = inode->i_sb->s_op->write_inode(inode, NULL); |
1320 | if (err) | 1321 | if (err) |
1321 | return err; | 1322 | return err; |
1322 | } | 1323 | } |
@@ -1389,7 +1390,6 @@ static ssize_t ubifs_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
1389 | unsigned long nr_segs, loff_t pos) | 1390 | unsigned long nr_segs, loff_t pos) |
1390 | { | 1391 | { |
1391 | int err; | 1392 | int err; |
1392 | ssize_t ret; | ||
1393 | struct inode *inode = iocb->ki_filp->f_mapping->host; | 1393 | struct inode *inode = iocb->ki_filp->f_mapping->host; |
1394 | struct ubifs_info *c = inode->i_sb->s_fs_info; | 1394 | struct ubifs_info *c = inode->i_sb->s_fs_info; |
1395 | 1395 | ||
@@ -1397,17 +1397,7 @@ static ssize_t ubifs_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
1397 | if (err) | 1397 | if (err) |
1398 | return err; | 1398 | return err; |
1399 | 1399 | ||
1400 | ret = generic_file_aio_write(iocb, iov, nr_segs, pos); | 1400 | return generic_file_aio_write(iocb, iov, nr_segs, pos); |
1401 | if (ret < 0) | ||
1402 | return ret; | ||
1403 | |||
1404 | if (ret > 0 && (IS_SYNC(inode) || iocb->ki_filp->f_flags & O_SYNC)) { | ||
1405 | err = ubifs_sync_wbufs_by_inode(c, inode); | ||
1406 | if (err) | ||
1407 | return err; | ||
1408 | } | ||
1409 | |||
1410 | return ret; | ||
1411 | } | 1401 | } |
1412 | 1402 | ||
1413 | static int ubifs_set_page_dirty(struct page *page) | 1403 | static int ubifs_set_page_dirty(struct page *page) |