[pnfs] [PATCH 19/21] pnfsblock: write_end
Fred Isaman
iisaman at citi.umich.edu
Thu Apr 10 10:07:35 EDT 2008
Implements bl_write_end, which basically just calls SetPageUptodate.
Signed-off-by: Fred Isaman <iisaman at citi.umich.edu>
Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
fs/nfs/blocklayout/blocklayout.c | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index c541a32..1d73cc6 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -899,6 +899,23 @@ cleanup:
return ret;
}
+/* CAREFUL - what happens if copied < count??? */
+static int
+bl_write_end(struct inode *inode, struct page *page, loff_t pos,
+ unsigned count, unsigned copied, struct pnfs_fsdata *fsdata)
+{
+ dprintk("%s enter, %u@%Ld, %i\n", __func__, count, pos,
+ fsdata ? fsdata->ok_to_use_pnfs : -1);
+ print_page(page);
+ if (fsdata) {
+ if (fsdata->ok_to_use_pnfs) {
+ dprintk("%s using pnfs\n", __func__);
+ SetPageUptodate(page);
+ }
+ }
+ return 0;
+}
+
static ssize_t
bl_get_stripesize(struct pnfs_layout_type *layoutid)
{
@@ -930,15 +947,17 @@ bl_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
}
}
+/* This checks if old req will likely use same io method as soon
+ * to be created request, and returns False if they are the same.
+ */
static int
bl_do_flush(struct pnfs_layout_segment *lseg, struct nfs_page *req,
struct pnfs_fsdata *fsdata)
{
+ int will_try_pnfs;
dprintk("%s enter\n", __func__);
- /* This checks if old req will likely use same io method as soon
- * to be created request, and returns False if they are the same.
- */
- return (!lseg != !test_bit(PG_USE_PNFS, &req->wb_flags));
+ will_try_pnfs = fsdata ? (fsdata->ok_to_use_pnfs) : (lseg != NULL);
+ return (will_try_pnfs != test_bit(PG_USE_PNFS, &req->wb_flags));
}
static struct layoutdriver_io_operations blocklayout_io_operations = {
@@ -946,6 +965,7 @@ static struct layoutdriver_io_operations blocklayout_io_operations = {
.read_pagelist = bl_read_pagelist,
.write_pagelist = bl_write_pagelist,
.write_begin = bl_write_begin,
+ .write_end = bl_write_end,
.alloc_layout = bl_alloc_layout,
.free_layout = bl_free_layout,
.alloc_lseg = bl_alloc_lseg,
--
1.5.3.3
More information about the pNFS
mailing list