xfs
[Top] [All Lists]

[PATCH 1/2] vfs: Create filemap_flush_range()

To: hch@xxxxxxxxxxxxx
Subject: [PATCH 1/2] vfs: Create filemap_flush_range()
From: Jan Kara <jack@xxxxxxx>
Date: Wed, 3 Aug 2011 22:49:04 +0200
Cc: xfs@xxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, Jan Kara <jack@xxxxxxx>
In-reply-to: <1312404545-15400-1-git-send-email-jack@xxxxxxx>
References: <1312404545-15400-1-git-send-email-jack@xxxxxxx>
Create a version of filemap_flush() function which can take a range.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 include/linux/fs.h |    2 ++
 mm/filemap.c       |   16 ++++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 786b3b1..091cf90 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2177,6 +2177,8 @@ extern int invalidate_inode_pages2_range(struct 
address_space *mapping,
 extern int write_inode_now(struct inode *, int);
 extern int filemap_fdatawrite(struct address_space *);
 extern int filemap_flush(struct address_space *);
+extern int filemap_flush_range(struct address_space *mapping, loff_t start,
+                               loff_t end);
 extern int filemap_fdatawait(struct address_space *);
 extern int filemap_fdatawait_range(struct address_space *, loff_t lstart,
                                   loff_t lend);
diff --git a/mm/filemap.c b/mm/filemap.c
index 867d402..8fd2347 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -253,6 +253,22 @@ int filemap_flush(struct address_space *mapping)
 EXPORT_SYMBOL(filemap_flush);
 
 /**
+ * filemap_flush_range - mostly a non-blocking flush of a mapping range
+ * @mapping:   target address_space
+ * @start:     offset in bytes where the range starts
+ * @end:       offset in bytes where the range ends (inclusive)
+ *
+ * This is a mostly non-blocking flush.  Not suitable for data-integrity
+ * purposes - I/O may not be started against all dirty pages.
+ */
+int filemap_flush_range(struct address_space *mapping, loff_t start,
+                       loff_t end)
+{
+       return __filemap_fdatawrite_range(mapping, start, end, WB_SYNC_NONE);
+}
+EXPORT_SYMBOL(filemap_flush_range);
+
+/**
  * filemap_fdatawait_range - wait for writeback to complete
  * @mapping:           address space structure to wait for
  * @start_byte:                offset in bytes where the range starts
-- 
1.7.1

<Prev in Thread] Current Thread [Next in Thread>