@@ -73,6 +73,19 @@ static int is_hole(struct pnfs_block_extent *be, sector_t isect)
return !is_sector_initialized(be->be_inval, isect);
}
+/* Given the be associated with isect, determine if page data can be
+ * written to disk.
+ */
+static int is_writable(struct pnfs_block_extent *be, sector_t isect)
+{
+ if (be->be_state == PNFS_BLOCK_READWRITE_DATA)
+ return 1;
+ else if (be->be_state != PNFS_BLOCK_INVALID_DATA)
+ return 0;
+ else
+ return is_sector_initialized(be->be_inval, isect);
+}
+
static int
dont_like_caller(struct nfs_page *req)
{
@@ -441,7 +454,19 @@ static int
bl_setup_layoutcommit(struct pnfs_layout_type *lo,
struct pnfs_layoutcommit_arg *arg)
{
+ struct nfs_server *nfss = PNFS_NFS_SERVER(lo);
+ struct pnfs_layoutcommit_arg *arg = &data->args;
+
dprintk("%s enter\n", __func__);
+ /* Need to ensure commit is block-size aligned */
+ if (nfss->pnfs_blksize) {
+ u64 mask = nfss->pnfs_blksize - 1;
+ u64 offset = arg->lseg.offset & mask;
+
+ arg->lseg.offset -= offset;
+ arg->lseg.length += offset + mask;
+ arg->lseg.length &= ~mask;
+ }
return 0;
}
@@ -916,7 +941,12 @@ bl_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
struct nfs_page *req)
{
dprintk("%s enter\n", __func__);
- return 1;
+ if (pgio->pg_iswrite) {
+ return test_bit(PG_USE_PNFS, &prev->wb_flags) ==
+ test_bit(PG_USE_PNFS, &req->wb_flags);
+ } else {
+ return 1;
+ }
}
/* This checks if old req will likely use same io method as soon