[pnfs] [PATCH 26/28] pnfsblock: write_end
Fred Isaman
iisaman at citi.umich.edu
Tue Mar 11 15:32:07 EDT 2008
Implements bl_write_end, which basically just calls SetPageUptodate.
Signed-off-by: Fred Isaman <iisaman at citi.umich.edu>
---
fs/nfs/blocklayout/blocklayout.c | 31 ++++++++++++++++++++++++++-----
1 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index f74836c..c648533 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -870,6 +870,22 @@ 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\n", __func__, count, pos);
+ print_page(page);
+ if (fsdata) {
+ if (fsdata == bl_use_pnfs) {
+ dprintk("%s using pnfs\n", __func__);
+ SetPageUptodate(page);
+ }
+ }
+ return 0;
+}
+
static void
bl_new_request(struct pnfs_layout_segment *lseg, struct nfs_page *req,
loff_t pos, unsigned count, struct pnfs_fsdata *fsdata)
@@ -883,8 +899,10 @@ bl_new_request(struct pnfs_layout_segment *lseg, struct nfs_page *req,
if (fsdata) {
/* A write request */
int use_pnfs = (fsdata == bl_use_pnfs);
- if (use_pnfs)
+ if (use_pnfs) {
+ dprintk("%s setting PG_USE_PNFS\n", __func__);
set_bit(PG_USE_PNFS, &req->wb_flags);
+ }
} else {
/* STUB - what whould we do for read requests? */
}
@@ -916,15 +934,17 @@ bl_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
return 1;
}
+/* 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 == bl_use_pnfs) : (lseg != NULL);
+ return (will_try_pnfs != test_bit(PG_USE_PNFS, &req->wb_flags));
}
static struct layoutdriver_io_operations blocklayout_io_operations = {
@@ -932,6 +952,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,
.new_request = bl_new_request,
.alloc_layout = bl_alloc_layout,
.free_layout = bl_free_layout,
--
1.5.3.3
More information about the pNFS
mailing list