All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pnfsd-lexp: simulate layout segments
@ 2011-04-22  8:11 Benny Halevy
  0 siblings, 0 replies; only message in thread
From: Benny Halevy @ 2011-04-22  8:11 UTC (permalink / raw)
  To: linux-nfs

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 fs/nfsd/Kconfig      |   20 ++++++++++++++++++++
 fs/nfsd/pnfsd_lexp.c |   12 +++++++++++-
 2 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig
index 82f46bb..d0f8527 100644
--- a/fs/nfsd/Kconfig
+++ b/fs/nfsd/Kconfig
@@ -113,3 +113,23 @@ config PNFSD_LOCAL_EXPORT
 	  useful for development and debugging purposes.
 
 	  If unsure, say N.
+
+config PNFSD_LEXP_LAYOUT_SEGMENTS
+	bool "Simulate layout segments"
+	depends on PNFSD_LOCAL_EXPORT
+	help
+	  Say Y here if you want your pNFS server to simulate layout segments
+	  when exporting local filesystems for debugging purposes.
+	  over the files layout type.
+	  This is mostly useful for development and debugging purposes.
+
+	  If unsure, say N.
+
+config PNFSD_LEXP_LAYOUT_SEGMENT_SIZE
+	int "Simulated layout segment size"
+	depends on PNFSD_LEXP_LAYOUT_SEGMENTS
+	default 65536
+	help
+	  Set simulated layout segment size.
+
+	  If unsure, say N.
diff --git a/fs/nfsd/pnfsd_lexp.c b/fs/nfsd/pnfsd_lexp.c
index e9382da..5610490 100644
--- a/fs/nfsd/pnfsd_lexp.c
+++ b/fs/nfsd/pnfsd_lexp.c
@@ -143,8 +143,16 @@ pnfsd_lexp_layout_get(struct inode *inode,
 	dprintk("--> %s: inode=%p\n", __func__, inode);
 
 	res->lg_seg.layout_type = LAYOUT_NFSV4_1_FILES;
+#ifdef     CONFIG_PNFSD_LEXP_LAYOUT_SEGMENTS
+#if CONFIG_PNFSD_LEXP_LAYOUT_SEGMENT_SIZE <= 0
+#error CONFIG_PNFSD_LEXP_LAYOUT_SEGMENT_SIZE must be greater than zero
+#endif
+	res->lg_seg.offset -= res->lg_seg.offset % CONFIG_PNFSD_LEXP_LAYOUT_SEGMENT_SIZE;
+	res->lg_seg.length = CONFIG_PNFSD_LEXP_LAYOUT_SEGMENT_SIZE;
+#else   /* CONFIG_PNFSD_LEXP_LAYOUT_SEGMENTS */
 	res->lg_seg.offset = 0;
 	res->lg_seg.length = NFS4_MAX_UINT64;
+#endif  /* CONFIG_PNFSD_LEXP_LAYOUT_SEGMENTS */
 
 	layout = kzalloc(sizeof(*layout), GFP_KERNEL);
 	if (layout == NULL) {
@@ -178,7 +186,9 @@ pnfsd_lexp_layout_get(struct inode *inode,
 exit:
 	kfree(layout);
 	kfree(fhp);
-	dprintk("<-- %s: return %d\n", __func__, rc);
+	dprintk("<-- %s: return %d offset=%llu length=%llu\n", __func__, rc,
+		(unsigned long long)res->lg_seg.offset,
+		(unsigned long long)res->lg_seg.length);
 	return rc;
 
 error:
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-22  8:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-22  8:11 [PATCH] pnfsd-lexp: simulate layout segments 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.