Commit db205bd6 authored by Suparna Bhattacharya's avatar Suparna Bhattacharya Committed by Linus Torvalds

[PATCH] filemap_fdatawrite range interface

Range based equivalent of filemap_fdatawrite for O_SYNC writers (to go with
writepages range support added to mpage_writepages).  If both <start> and
<end> are zero, then it defaults to writing back all of the mapping's dirty
pages.
Signed-off-by: default avatarSuparna Bhattacharya <suparna@in.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0a9237b2
......@@ -142,20 +142,26 @@ static inline int sync_page(struct page *page)
}
/**
* filemap_fdatawrite - start writeback against all of a mapping's dirty pages
* filemap_fdatawrite_range - start writeback against all of a mapping's
* dirty pages that lie within the byte offsets <start, end>
* @mapping: address space structure to write
* @start: offset in bytes where the range starts
* @end : offset in bytes where the range ends
*
* If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as
* opposed to a regular memory * cleansing writeback. The difference between
* these two operations is that if a dirty page/buffer is encountered, it must
* be waited upon, and not just skipped over.
*/
static int __filemap_fdatawrite(struct address_space *mapping, int sync_mode)
static int __filemap_fdatawrite_range(struct address_space *mapping,
loff_t start, loff_t end, int sync_mode)
{
int ret;
struct writeback_control wbc = {
.sync_mode = sync_mode,
.nr_to_write = mapping->nrpages * 2,
.start = start,
.end = end,
};
if (mapping->backing_dev_info->memory_backed)
......@@ -165,12 +171,25 @@ static int __filemap_fdatawrite(struct address_space *mapping, int sync_mode)
return ret;
}
static inline int __filemap_fdatawrite(struct address_space *mapping,
int sync_mode)
{
return __filemap_fdatawrite_range(mapping, 0, 0, sync_mode);
}
int filemap_fdatawrite(struct address_space *mapping)
{
return __filemap_fdatawrite(mapping, WB_SYNC_ALL);
}
EXPORT_SYMBOL(filemap_fdatawrite);
int filemap_fdatawrite_range(struct address_space *mapping,
loff_t start, loff_t end)
{
return __filemap_fdatawrite_range(mapping, start, end, WB_SYNC_ALL);
}
EXPORT_SYMBOL(filemap_fdatawrite_range);
/*
* This is a mostly non-blocking flush. Not suitable for data-integrity
* purposes - I/O may not be started against all dirty pages.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment