@@ -625,7 +625,7 @@ 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;
+ struct bl_layoutupdate_data *layoutupdate_data;
dprintk("%s enter\n", __func__);
/* Need to ensure commit is block-size aligned */
@@ -637,6 +637,14 @@ bl_setup_layoutcommit(struct pnfs_layout_type *lo,
arg->lseg.length += offset + mask;
arg->lseg.length &= ~mask;
}
+
+ layoutupdate_data = kmalloc(sizeof(struct bl_layoutupdate_data),
+ GFP_KERNEL);
+ if (unlikely(!layoutupdate_data))
+ return -ENOMEM;
+ INIT_LIST_HEAD(&layoutupdate_data->ranges);
+ arg->layoutdriver_data = layoutupdate_data;
+
return 0;
}
@@ -181,6 +181,13 @@ struct pnfs_block_layout {
sector_t bl_blocksize; /* Server blocksize in sectors */
};
+/* this struct is comunicated between:
+ * bl_setup_layoutcommit && bl_encode_layoutcommit && bl_cleanup_layoutcommit
+ */
+struct bl_layoutupdate_data {
+ struct list_head ranges;
+};
+
#define BLK_ID(lo) ((struct block_mount_id *)(PNFS_MOUNTID(lo)->mountid))
#define BLK_LSEG2EXT(lseg) ((struct pnfs_block_layout *)lseg->layout->ld_data)
#define BLK_LO2EXT(lo) ((struct pnfs_block_layout *)lo->ld_data)
@@ -218,6 +225,18 @@ uint32_t *blk_overflow(uint32_t *p, uint32_t *end, size_t nbytes);
(x) = tmp >> 9; \
} while (0)
+#define WRITE32(n) do { \
+ *p++ = htonl(n); \
+ } while (0)
+#define WRITE64(n) do { \
+ *p++ = htonl((uint32_t)((n) >> 32)); \
+ *p++ = htonl((uint32_t)(n)); \
+} while (0)
+#define WRITEMEM(ptr, nbytes) do { \
+ p = xdr_encode_opaque_fixed(p, ptr, nbytes); \
+} while (0)
+#define WRITE_DEVID(x) WRITEMEM((x)->data, NFS4_PNFS_DEVICEID4_SIZE)
+
/* blocklayoutdev.c */
struct block_device *nfs4_blkdev_get(dev_t dev);
int nfs4_blkdev_put(struct block_device *bdev);