nilfs2: fix missed-sync issue for do_sync_mapping_range()
Chris Mason pointed out that there is a missed sync issue in
nilfs_writepages():
On Wed, 17 Dec 2008 21:52:55 -0500, Chris Mason wrote:
> It looks like nilfs_writepage ignores WB_SYNC_NONE, which is used by
> do_sync_mapping_range().
where WB_SYNC_NONE in do_sync_mapping_range() was replaced with
WB_SYNC_ALL by Nick's patch (commit:
ee53a891f4
).
This fixes the problem by letting nilfs_writepages() write out the log of
file data within the range if sync_mode is WB_SYNC_ALL.
This involves removal of nilfs_file_aio_write() which was previously
needed to ensure O_SYNC sync writes.
Cc: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
9ff05123e3
commit
f30bf3e40f
@@ -24,6 +24,7 @@
|
||||
#include <linux/buffer_head.h>
|
||||
#include <linux/mpage.h>
|
||||
#include <linux/writeback.h>
|
||||
#include <linux/uio.h>
|
||||
#include "nilfs.h"
|
||||
#include "segment.h"
|
||||
#include "page.h"
|
||||
@@ -145,8 +146,14 @@ static int nilfs_readpages(struct file *file, struct address_space *mapping,
|
||||
static int nilfs_writepages(struct address_space *mapping,
|
||||
struct writeback_control *wbc)
|
||||
{
|
||||
/* This empty method is required not to call generic_writepages() */
|
||||
return 0;
|
||||
struct inode *inode = mapping->host;
|
||||
int err = 0;
|
||||
|
||||
if (wbc->sync_mode == WB_SYNC_ALL)
|
||||
err = nilfs_construct_dsync_segment(inode->i_sb, inode,
|
||||
wbc->range_start,
|
||||
wbc->range_end);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int nilfs_writepage(struct page *page, struct writeback_control *wbc)
|
||||
@@ -225,11 +232,6 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
ssize_t size;
|
||||
int err;
|
||||
|
||||
err = nilfs_construct_dsync_segment(inode->i_sb, inode);
|
||||
if (unlikely(err))
|
||||
return err;
|
||||
|
||||
if (rw == WRITE)
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user