linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET 0/3] exofs: Exportable by NFS
@ 2009-03-25  9:45 Boaz Harrosh
  2009-03-25  9:47 ` [PATCH 1/3] [SQUASHME] prints in hex Boaz Harrosh
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Boaz Harrosh @ 2009-03-25  9:45 UTC (permalink / raw)
  To: Andrew Morton, Jeff Garzik, open-osd mailing-list, linux-fsdevel
  Cc: Evgeniy Polyakov, Marcin Slusarz


I'm adding three more patches to the exofs tree to be submitted for 2.6.30

With these patches I'm able to export an exofs filesystem via NFS and
pass Connectathon tests. The test exposed the 2G bug which is
fixed with a one liner in patch 2.

List of patches:
[PATCH 1/3] [SQUASHME] prints in hex

  Offsets and length should be printed in HEX for
  easier debugging, when they get big.
  (This patch will be squashed into the appropriate place
  in the original patchset)

[PATCH 2/3] [SQUASHME] exofs does support 64bit file sizes

  This fixes the BUG exposed by the Connectathon test. The Kernel
  assumes 32-bitness for filesystems unless told otherwise.
  (This patch will be squashed into the appropriate place
  in the original patchset)

[PATCH 3/3] exofs: export_operations

  In this patch we implement the export_operations vector
  to enable NFS
  (This patch is added to the original set)



Thanks for reviewing
Boaz

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

* [PATCH 1/3] [SQUASHME] prints in hex
  2009-03-25  9:45 [PATCHSET 0/3] exofs: Exportable by NFS Boaz Harrosh
@ 2009-03-25  9:47 ` Boaz Harrosh
  2009-03-25  9:50 ` [PATCH 2/3] [SQUASHME] exofs does support 64bit file sizes Boaz Harrosh
  2009-03-25 10:07 ` [PATCH 3/3] exofs: export_operations Boaz Harrosh
  2 siblings, 0 replies; 4+ messages in thread
From: Boaz Harrosh @ 2009-03-25  9:47 UTC (permalink / raw)
  To: Andrew Morton, Jeff Garzik, open-osd mailing-list, linux-fsdevel
  Cc: Evgeniy Polyakov, Marcin Slusarz

Offsets and length should be printed in HEX for
easier debugging, when they get big.

[This patch will be squashed into: exofs: address_space_operations]

Boaz
---
 fs/exofs/inode.c |   49 +++++++++++++++++++++++++------------------------
 1 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 739629a..b77c197 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -145,6 +145,7 @@ static int update_read_page(struct page *page, int ret)
 		if (PageError(page))
 			ClearPageError(page);
 		ret = 0; /* recovered error */
+		EXOFS_DBGMSG("recovered read error\n");
 	} else /* Error */
 		SetPageError(page);
 
@@ -181,8 +182,8 @@ static int __readpages_done(struct osd_request *or, struct page_collect *pcol,
 	else
 		good_bytes = pcol->length - resid;
 
-	EXOFS_DBGMSG("readpages_done(%ld) good_bytes=%llx"
-		     " length=%zx nr_pages=%u\n",
+	EXOFS_DBGMSG("readpages_done(0x%lx) good_bytes=0x%llx"
+		     " length=0x%zx nr_pages=%u\n",
 		     pcol->inode->i_ino, _LLU(good_bytes), pcol->length,
 		     pcol->nr_pages);
 
@@ -197,7 +198,7 @@ static int __readpages_done(struct osd_request *or, struct page_collect *pcol,
 			ret = update_read_page(page, (i == 0) ? ret : 0);
 			if (do_unlock)
 				unlock_page(page);
-			EXOFS_DBGMSG("    readpages_done(%ld, %ld)\n",
+			EXOFS_DBGMSG("    readpages_done(0x%lx, 0x%lx)\n",
 				     inode->i_ino, page->index);
 		} else {
 			/* can not happen on single sync_readpage */
@@ -206,8 +207,8 @@ static int __readpages_done(struct osd_request *or, struct page_collect *pcol,
 			/* try a single page read and only then it is
 			 * marked as SetPageError()
 			 */
-			EXOFS_ERR("    readpages_done(%ld, %ld) bad_bytes\n",
-				     inode->i_ino, page->index);
+			EXOFS_ERR("    readpages_done(0x%lx, 0x%lx)"
+				  " bad_bytes\n", inode->i_ino, page->index);
 			_readpage(page, false);
 		}
 
@@ -288,7 +289,7 @@ static int read_exec(struct page_collect *pcol, bool is_sync)
 
 	atomic_inc(&pcol->sbi->s_curr_pending);
 
-	EXOFS_DBGMSG("read_exec obj=%llx start=%llx length=%zx\n",
+	EXOFS_DBGMSG("read_exec obj=0x%llx start=0x%llx length=0x%zx\n",
 		  obj.id, _LLU(i_start), pcol->length);
 
 	/* pages ownership was passed to pcol_copy */
@@ -316,7 +317,7 @@ static int readpage_strip(void *data, struct page *page)
 
 	/* FIXME: Just for debugging, will be removed */
 	if (PageUptodate(page))
-		EXOFS_ERR("PageUptodate(%ld, %ld)\n", pcol->inode->i_ino,
+		EXOFS_ERR("PageUptodate(0x%lx, 0x%lx)\n", pcol->inode->i_ino,
 			  page->index);
 
 	if (page->index < end_index)
@@ -337,8 +338,8 @@ static int readpage_strip(void *data, struct page *page)
 			ClearPageError(page);
 
 		unlock_page(page);
-		EXOFS_DBGMSG("readpage_strip(%ld, %ld) empty page, splitting\n",
-			     inode->i_ino, page->index);
+		EXOFS_DBGMSG("readpage_strip(0x%lx, 0x%lx) empty page,"
+			     " splitting\n", inode->i_ino, page->index);
 
 		return read_exec(pcol, false);
 	}
@@ -365,13 +366,13 @@ try_again:
 	if (len != PAGE_CACHE_SIZE)
 		zero_user(page, len, PAGE_CACHE_SIZE - len);
 
-	EXOFS_DBGMSG("    readpage_strip(%ld, %ld) len=%zx\n", inode->i_ino,
-		  page->index, len);
+	EXOFS_DBGMSG("    readpage_strip(0x%lx, 0x%lx) len=0x%zx\n",
+		     inode->i_ino, page->index, len);
 
 	ret = pcol_add_page(pcol, page, len);
 	if (ret) {
 		EXOFS_DBGMSG("Failed pcol_add_page pages[i]=%p "
-			  "len=%zx nr_pages=%u length=%zx\n",
+			  "this_len=0x%zx nr_pages=%u length=0x%zx\n",
 			  page, len, pcol->nr_pages, pcol->length);
 
 		/* split the request, and start again with current page */
@@ -458,8 +459,8 @@ static void writepages_done(struct osd_request *or, void *p)
 	else
 		good_bytes = pcol->length - resid;
 
-	EXOFS_DBGMSG("writepages_done(%lx) good_bytes=%llx"
-		     " length=%zx nr_pages=%u\n",
+	EXOFS_DBGMSG("writepages_done(0x%lx) good_bytes=0x%llx"
+		     " length=0x%zx nr_pages=%u\n",
 		     pcol->inode->i_ino, _LLU(good_bytes), pcol->length,
 		     pcol->nr_pages);
 
@@ -473,15 +474,15 @@ static void writepages_done(struct osd_request *or, void *p)
 		if ((length < good_bytes) || (i == 0)) {
 			update_write_page(page, ret);
 			unlock_page(page);
-			EXOFS_DBGMSG("    writepages_done(%lx, %lx)"
-				     " good_bytes ret=%x\n",
+			EXOFS_DBGMSG("    writepages_done(0x%lx, 0x%lx)"
+				     " good_bytes ret=%d\n",
 				     inode->i_ino, page->index, ret);
 		} else {
 			/* try a single page write and only then it is
 			 * marked as SetPageError()
 			 */
-			EXOFS_ERR("    writepages_done(%lx, %lx) bad_bytes\n",
-				     inode->i_ino, page->index);
+			EXOFS_ERR("    writepages_done(0x%lx, 0x%lx)"
+				  " bad_bytes\n", inode->i_ino, page->index);
 
 			exofs_writepage(page, NULL);
 		}
@@ -531,7 +532,7 @@ static int write_exec(struct page_collect *pcol)
 	}
 
 	atomic_inc(&pcol->sbi->s_curr_pending);
-	EXOFS_DBGMSG("write_exec(%lx, %lx) start=%llx length=%zx\n",
+	EXOFS_DBGMSG("write_exec(0x%lx, 0x%lx) start=0x%llx length=0x%zx\n",
 		  pcol->inode->i_ino, pcol->pg_first, _LLU(i_start),
 		  pcol->length);
 	/* pages ownership was passed to pcol_copy */
@@ -602,13 +603,13 @@ try_again:
 			goto fail;
 	}
 
-	EXOFS_DBGMSG("    writepage_strip(%lx, %lx) len=%zx\n", inode->i_ino,
-		  page->index, len);
+	EXOFS_DBGMSG("    writepage_strip(0x%lx, 0x%lx) len=0x%zx\n",
+		     inode->i_ino, page->index, len);
 
 	ret = pcol_add_page(pcol, page, len);
 	if (unlikely(ret)) {
 		EXOFS_DBGMSG("Failed pcol_add_page "
-			     "nr_pages=%u total_length=%zx\n",
+			     "nr_pages=%u total_length=0x%zx\n",
 			     pcol->nr_pages, pcol->length);
 
 		/* split the request, next loop will start again */
@@ -649,8 +650,8 @@ static int exofs_writepages(struct address_space *mapping,
 	else
 		expected_pages = mapping->nrpages;
 
-	EXOFS_DBGMSG("inode(%lx) wbc->start=0x%llx wbc->end=0x%llx"
-		     " m->nrpages=%lu start=%ld end=%ld\n",
+	EXOFS_DBGMSG("inode(0x%lx) wbc->start=0x%llx wbc->end=0x%llx"
+		     " m->nrpages=%lu start=0x%lx end=0x%lx\n",
 		     mapping->host->i_ino, wbc->range_start, wbc->range_end,
 		     mapping->nrpages, start, end);
 
-- 
1.6.2.1


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

* [PATCH 2/3] [SQUASHME] exofs does support 64bit file sizes
  2009-03-25  9:45 [PATCHSET 0/3] exofs: Exportable by NFS Boaz Harrosh
  2009-03-25  9:47 ` [PATCH 1/3] [SQUASHME] prints in hex Boaz Harrosh
@ 2009-03-25  9:50 ` Boaz Harrosh
  2009-03-25 10:07 ` [PATCH 3/3] exofs: export_operations Boaz Harrosh
  2 siblings, 0 replies; 4+ messages in thread
From: Boaz Harrosh @ 2009-03-25  9:50 UTC (permalink / raw)
  To: Andrew Morton, Jeff Garzik, open-osd mailing-list, linux-fsdevel
  Cc: Evgeniy Polyakov, Marcin Slusarz


Tell VFS that we support 64-bit files

[SQUASH TO: exofs: super_operations and file_system_type]

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/exofs/super.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index feed8d2..7cfaaa0 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -305,6 +305,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
 	strcpy(sb->s_id, "exofs");
 	sb->s_blocksize = EXOFS_BLKSIZE;
 	sb->s_blocksize_bits = EXOFS_BLKSHIFT;
+	sb->s_maxbytes = MAX_LFS_FILESIZE;
 	atomic_set(&sbi->s_curr_pending, 0);
 	sb->s_bdev = NULL;
 	sb->s_dev = 0;
-- 
1.6.2.1



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

* [PATCH 3/3] exofs: export_operations
  2009-03-25  9:45 [PATCHSET 0/3] exofs: Exportable by NFS Boaz Harrosh
  2009-03-25  9:47 ` [PATCH 1/3] [SQUASHME] prints in hex Boaz Harrosh
  2009-03-25  9:50 ` [PATCH 2/3] [SQUASHME] exofs does support 64bit file sizes Boaz Harrosh
@ 2009-03-25 10:07 ` Boaz Harrosh
  2 siblings, 0 replies; 4+ messages in thread
From: Boaz Harrosh @ 2009-03-25 10:07 UTC (permalink / raw)
  To: Andrew Morton, Jeff Garzik, open-osd mailing-list, linux-fsdevel
  Cc: Evgeniy Polyakov, Marcin Slusarz


implement export_operations and set in superblock.
It is now posible to export exofs via nfs

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/exofs/dir.c   |   15 +++++++++++++++
 fs/exofs/exofs.h |    2 ++
 fs/exofs/super.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c
index 0ca733a..55ebbb1 100644
--- a/fs/exofs/dir.c
+++ b/fs/exofs/dir.c
@@ -380,6 +380,21 @@ struct exofs_dir_entry *exofs_dotdot(struct inode *dir, struct page **p)
 	return de;
 }
 
+ino_t exofs_parent_ino(struct dentry *child)
+{
+	struct page *page;
+	struct exofs_dir_entry *de;
+	ino_t ino;
+
+	de = exofs_dotdot(child->d_inode, &page);
+	if (!de)
+		return 0;
+
+	ino = le64_to_cpu(de->inode_no);
+	exofs_put_page(page);
+	return ino;
+}
+
 ino_t exofs_inode_by_name(struct inode *dir, struct dentry *dentry)
 {
 	ino_t res = 0;
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h
index d54753d..da1397a 100644
--- a/fs/exofs/exofs.h
+++ b/fs/exofs/exofs.h
@@ -152,6 +152,7 @@ struct exofs_dir_entry *exofs_find_entry(struct inode *, struct dentry *,
 					 struct page **);
 int exofs_empty_dir(struct inode *);
 struct exofs_dir_entry *exofs_dotdot(struct inode *, struct page **);
+ino_t exofs_parent_ino(struct dentry *child);
 int exofs_set_link(struct inode *, struct exofs_dir_entry *, struct page *,
 		    struct inode *);
 
@@ -174,6 +175,7 @@ extern const struct inode_operations exofs_special_inode_operations;
 
 /* super.c           */
 extern const struct super_operations exofs_sops;
+extern const struct export_operations exofs_export_ops;
 
 /* symlink.c         */
 extern const struct inode_operations exofs_symlink_inode_operations;
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 7fd8866..8a07d6d 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -37,6 +37,7 @@
 #include <linux/parser.h>
 #include <linux/vfs.h>
 #include <linux/random.h>
+#include <linux/exportfs.h>
 
 #include "exofs.h"
 
@@ -357,6 +358,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
 
 	/* set up operation vectors */
 	sb->s_op = &exofs_sops;
+	sb->s_export_op = &exofs_export_ops;
 	root = exofs_iget(sb, EXOFS_ROOT_ID - EXOFS_OBJ_OFF);
 	if (IS_ERR(root)) {
 		EXOFS_ERR("ERROR: exofs_iget failed\n");
@@ -484,6 +486,55 @@ const struct super_operations exofs_sops = {
 };
 
 /******************************************************************************
+ * EXPORT OPERATIONS
+ *****************************************************************************/
+struct dentry *exofs_get_parent(struct dentry *child)
+{
+	unsigned long ino = exofs_parent_ino(child);
+
+	if (!ino)
+		return NULL;
+
+	return d_obtain_alias(exofs_iget(child->d_inode->i_sb, ino));
+}
+
+static struct inode *exofs_nfs_get_inode(struct super_block *sb,
+		u64 ino, u32 generation)
+{
+	struct inode *inode;
+
+	inode = exofs_iget(sb, ino);
+	if (IS_ERR(inode))
+		return ERR_CAST(inode);
+	if (generation && inode->i_generation != generation) {
+		/* we didn't find the right inode.. */
+		iput(inode);
+		return ERR_PTR(-ESTALE);
+	}
+	return inode;
+}
+
+static struct dentry *exofs_fh_to_dentry(struct super_block *sb,
+				struct fid *fid, int fh_len, int fh_type)
+{
+	return generic_fh_to_dentry(sb, fid, fh_len, fh_type,
+				    exofs_nfs_get_inode);
+}
+
+static struct dentry *exofs_fh_to_parent(struct super_block *sb,
+				struct fid *fid, int fh_len, int fh_type)
+{
+	return generic_fh_to_parent(sb, fid, fh_len, fh_type,
+				    exofs_nfs_get_inode);
+}
+
+const struct export_operations exofs_export_ops = {
+	.fh_to_dentry = exofs_fh_to_dentry,
+	.fh_to_parent = exofs_fh_to_parent,
+	.get_parent = exofs_get_parent,
+};
+
+/******************************************************************************
  * INSMOD/RMMOD
  *****************************************************************************/
 
-- 
1.6.2.1



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

end of thread, other threads:[~2009-03-25 10:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-25  9:45 [PATCHSET 0/3] exofs: Exportable by NFS Boaz Harrosh
2009-03-25  9:47 ` [PATCH 1/3] [SQUASHME] prints in hex Boaz Harrosh
2009-03-25  9:50 ` [PATCH 2/3] [SQUASHME] exofs does support 64bit file sizes Boaz Harrosh
2009-03-25 10:07 ` [PATCH 3/3] exofs: export_operations Boaz Harrosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).