[pnfs] [PATCH 22/37] pnfs: client layout cache: introduce pnfs_layout_segment
Benny Halevy
bhalevy at panasas.com
Tue Jan 1 05:51:04 EST 2008
struct pnfs_layout_segment is used to cache layout metadata
for a specific byte range and iomode. It is allocated, referenced
by and passed down to the layout driver by the generic pnfs client layer.
new layoutdriver_io_operations.{alloc,free}_lseg methods are used
to allocate/set and free a layout segment.
Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
include/linux/nfs4_pnfs.h | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
index 7ea5c33..f59e6c2 100644
--- a/include/linux/nfs4_pnfs.h
+++ b/include/linux/nfs4_pnfs.h
@@ -91,6 +91,20 @@ PNFS_LD_POLICY_OPS(struct pnfs_layout_type *lo)
return PNFS_LD(lo)->ld_policy_ops;
}
+struct pnfs_layout_segment {
+ struct list_head fi_list;
+ struct nfs4_pnfs_layout_segment range;
+ struct kref kref;
+ struct pnfs_layout_type *layout;
+ u8 ld_data[]; /* layout driver private data */
+};
+
+static inline void *
+LSEG_LD_DATA(struct pnfs_layout_segment *lseg)
+{
+ return lseg->ld_data;
+}
+
/* Layout driver I/O operations.
* Either the pagecache or non-pagecache read/write operations must be implemented
*/
@@ -115,6 +129,8 @@ struct layoutdriver_io_operations {
int (*has_layout) (struct pnfs_layout_type *layoutid, struct inode *inode, struct nfs4_pnfs_layout_segment *range);
void (*free_layout) (struct pnfs_layout_type **layoutidp, struct nfs4_pnfs_layout_segment *range);
struct pnfs_layout_type * (*set_layout) (struct pnfs_layout_type *layoutid, struct nfs4_pnfs_layoutget_res *lgr);
+ struct pnfs_layout_segment * (*alloc_lseg) (struct pnfs_layout_type *layoutid, struct nfs4_pnfs_layoutget_res *lgr);
+ void (*free_lseg) (struct pnfs_layout_type *layoutid, struct pnfs_layout_segment *lseg);
int (*setup_layoutcommit) (struct pnfs_layout_type *layoutid, struct pnfs_layoutcommit_arg *arg);
void (*cleanup_layoutcommit) (struct pnfs_layout_type *layoutid, struct pnfs_layoutcommit_arg *arg, struct pnfs_layoutcommit_res *res);
--
1.5.3.3
More information about the pNFS
mailing list