All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] obj/block {alloc,free}_layout api updates
@ 2010-07-12 18:42 Benny Halevy
  2010-07-12 18:42 ` [PATCH 1/1] SQUASHME: pnfs-block: use new alloc/free_layout API Benny Halevy
  2010-07-12 18:43 ` [PATCH 2/2] SQUASHME: pnfs-obj: " Benny Halevy
  0 siblings, 2 replies; 3+ messages in thread
From: Benny Halevy @ 2010-07-12 18:42 UTC (permalink / raw)
  To: NFS list

[PATCH 1/1] SQUASHME: pnfs-block: use new alloc/free_layout API
[PATCH 2/2] SQUASHME: pnfs-obj: use new alloc/free_layout API

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] SQUASHME: pnfs-block: use new alloc/free_layout API
  2010-07-12 18:42 [PATCH 0/2] obj/block {alloc,free}_layout api updates Benny Halevy
@ 2010-07-12 18:42 ` Benny Halevy
  2010-07-12 18:43 ` [PATCH 2/2] SQUASHME: pnfs-obj: " Benny Halevy
  1 sibling, 0 replies; 3+ messages in thread
From: Benny Halevy @ 2010-07-12 18:42 UTC (permalink / raw)
  To: linux-nfs

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 fs/nfs/blocklayout/blocklayout.c    |    9 ++++-----
 fs/nfs/blocklayout/blocklayout.h    |   15 +++++++++++++--
 fs/nfs/blocklayout/blocklayoutdev.c |    2 +-
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 92f0b4b..63d3b5a 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -552,18 +552,17 @@ release_inval_marks(struct pnfs_inval_markings *marks)
 
 /* Note we are relying on caller locking to prevent nasty races. */
 static void
-bl_free_layout(void *p)
+bl_free_layout(struct pnfs_layout_type *lo)
 {
-	struct pnfs_block_layout	*bl = p;
+	struct pnfs_block_layout *bl = BLK_LO2EXT(lo);
 
 	dprintk("%s enter\n", __func__);
 	release_extents(bl, NULL);
 	release_inval_marks(&bl->bl_inval);
 	kfree(bl);
-	return;
 }
 
-static void *
+static struct pnfs_layout_type *
 bl_alloc_layout(struct inode *inode)
 {
 	struct pnfs_block_layout	*bl;
@@ -579,7 +578,7 @@ bl_alloc_layout(struct inode *inode)
 	bl->bl_count = 0;
 	bl->bl_blocksize = NFS_SERVER(inode)->pnfs_blksize >> 9;
 	INIT_INVAL_MARKS(&bl->bl_inval, bl->bl_blocksize);
-	return bl;
+	return &bl->bl_layout;
 }
 
 static void
diff --git a/fs/nfs/blocklayout/blocklayout.h b/fs/nfs/blocklayout/blocklayout.h
index 0efed8d..d316b7f 100644
--- a/fs/nfs/blocklayout/blocklayout.h
+++ b/fs/nfs/blocklayout/blocklayout.h
@@ -177,6 +177,7 @@ static inline int choose_list(enum exstate4 state)
 }
 
 struct pnfs_block_layout {
+	struct pnfs_layout_type bl_layout;
 	struct pnfs_inval_markings bl_inval; /* tracks INVAL->RW transition */
 	spinlock_t		bl_ext_lock;   /* Protects list manipulation */
 	struct list_head	bl_extents[EXTENT_LISTS]; /* R and RW extents */
@@ -193,8 +194,18 @@ struct bl_layoutupdate_data {
 };
 
 #define BLK_ID(lo) ((struct block_mount_id *)(PNFS_NFS_SERVER(lo)->pnfs_ld_data))
-#define BLK_LSEG2EXT(lseg) ((struct pnfs_block_layout *)lseg->layout->ld_data)
-#define BLK_LO2EXT(lo) ((struct pnfs_block_layout *)lo->ld_data)
+
+static inline struct pnfs_block_layout *
+BLK_LO2EXT(struct pnfs_layout_type *lo)
+{
+	return container_of(lo, struct pnfs_block_layout, bl_layout);
+}
+
+static inline struct pnfs_block_layout *
+BLK_LSEG2EXT(struct pnfs_layout_segment *lseg)
+{
+	return BLK_LO2EXT(lseg->layout);
+}
 
 uint32_t *blk_overflow(uint32_t *p, uint32_t *end, size_t nbytes);
 
diff --git a/fs/nfs/blocklayout/blocklayoutdev.c b/fs/nfs/blocklayout/blocklayoutdev.c
index a866f5c..7285d5e 100644
--- a/fs/nfs/blocklayout/blocklayoutdev.c
+++ b/fs/nfs/blocklayout/blocklayoutdev.c
@@ -620,7 +620,7 @@ int
 nfs4_blk_process_layoutget(struct pnfs_layout_type *lo,
 			   struct nfs4_pnfs_layoutget_res *lgr)
 {
-	struct pnfs_block_layout *bl = PNFS_LD_DATA(lo);
+	struct pnfs_block_layout *bl = BLK_LO2EXT(lo);
 	uint32_t *p = (uint32_t *)lgr->layout.buf;
 	uint32_t *end = (uint32_t *)((char *)lgr->layout.buf + lgr->layout.len);
 	int i, status = -EIO;
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] SQUASHME: pnfs-obj: use new alloc/free_layout API
  2010-07-12 18:42 [PATCH 0/2] obj/block {alloc,free}_layout api updates Benny Halevy
  2010-07-12 18:42 ` [PATCH 1/1] SQUASHME: pnfs-block: use new alloc/free_layout API Benny Halevy
@ 2010-07-12 18:43 ` Benny Halevy
  1 sibling, 0 replies; 3+ messages in thread
From: Benny Halevy @ 2010-07-12 18:43 UTC (permalink / raw)
  To: linux-nfs

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 fs/nfs/objlayout/objlayout.c |   14 +++++++-------
 fs/nfs/objlayout/objlayout.h |   10 +++++++++-
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c
index c380bf6..1381c60 100644
--- a/fs/nfs/objlayout/objlayout.c
+++ b/fs/nfs/objlayout/objlayout.c
@@ -49,7 +49,7 @@ struct pnfs_client_operations *pnfs_client_ops;
 /*
  * Create a objlayout layout structure for the given inode and return it.
  */
-static void *
+static struct pnfs_layout_type *
 objlayout_alloc_layout(struct inode *inode)
 {
 	struct objlayout *objlay;
@@ -60,16 +60,16 @@ objlayout_alloc_layout(struct inode *inode)
 		INIT_LIST_HEAD(&objlay->err_list);
 	}
 	dprintk("%s: Return %p\n", __func__, objlay);
-	return objlay;
+	return &objlay->pnfs_layout;
 }
 
 /*
  * Free an objlayout layout structure
  */
 static void
-objlayout_free_layout(void *p)
+objlayout_free_layout(struct pnfs_layout_type *lo)
 {
-	struct objlayout *objlay = p;
+	struct objlayout *objlay = OBJLAYOUT(lo);
 
 	dprintk("%s: objlay %p\n", __func__, objlay);
 
@@ -232,7 +232,7 @@ objlayout_iodone(struct objlayout_io_state *state)
 	if (likely(state->status >= 0)) {
 		objlayout_free_io_state(state);
 	} else {
-		struct objlayout *objlay = PNFS_LD_DATA(state->lseg->layout);
+		struct objlayout *objlay = OBJLAYOUT(state->lseg->layout);
 
 		spin_lock(&objlay->lock);
 		objlay->delta_space_valid = OBJ_DSU_INVALID;
@@ -485,7 +485,7 @@ objlayout_encode_layoutcommit(struct pnfs_layout_type *pnfslay,
 			      struct xdr_stream *xdr,
 			      const struct pnfs_layoutcommit_arg *args)
 {
-	struct objlayout *objlay = PNFS_LD_DATA(pnfslay);
+	struct objlayout *objlay = OBJLAYOUT(pnfslay);
 	struct pnfs_osd_layoutupdate lou;
 	__be32 *start;
 
@@ -621,7 +621,7 @@ objlayout_encode_layoutreturn(struct pnfs_layout_type *pnfslay,
 			      struct xdr_stream *xdr,
 			      const struct nfs4_pnfs_layoutreturn_arg *args)
 {
-	struct objlayout *objlay = PNFS_LD_DATA(pnfslay);
+	struct objlayout *objlay = OBJLAYOUT(pnfslay);
 	struct objlayout_io_state *state, *tmp;
 	__be32 *start, *uninitialized_var(last_xdr);
 
diff --git a/fs/nfs/objlayout/objlayout.h b/fs/nfs/objlayout/objlayout.h
index 248a562..8bc3c94 100644
--- a/fs/nfs/objlayout/objlayout.h
+++ b/fs/nfs/objlayout/objlayout.h
@@ -59,6 +59,8 @@ struct objlayout_segment {
  * per-inode layout
  */
 struct objlayout {
+	struct pnfs_layout_type pnfs_layout;
+
 	 /* for layout_commit */
 	enum osd_delta_space_valid_enum {
 		OBJ_DSU_INIT = 0,
@@ -72,6 +74,12 @@ struct objlayout {
 	struct list_head err_list;
 };
 
+static inline struct objlayout *
+OBJLAYOUT(struct pnfs_layout_type *lo)
+{
+	return container_of(lo, struct objlayout, pnfs_layout);
+}
+
 /*
  * per-I/O operation state
  * embedded in objects provider io_state data structure
@@ -131,7 +139,7 @@ extern void objlayout_io_set_result(struct objlayout_io_state *state,
 static inline void
 objlayout_add_delta_space_used(struct objlayout_io_state *state, s64 space_used)
 {
-	struct objlayout *objlay = PNFS_LD_DATA(state->lseg->layout);
+	struct objlayout *objlay = OBJLAYOUT(state->lseg->layout);
 
 	/* If one of the I/Os errored out and the delta_space_used was
 	 * invalid we render the complete report as invalid. Protocol mandate
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-12 18:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-12 18:42 [PATCH 0/2] obj/block {alloc,free}_layout api updates Benny Halevy
2010-07-12 18:42 ` [PATCH 1/1] SQUASHME: pnfs-block: use new alloc/free_layout API Benny Halevy
2010-07-12 18:43 ` [PATCH 2/2] SQUASHME: pnfs-obj: " Benny Halevy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.