Skip to contentSkip to conversation

exofs: Exportable by NFS

PATCH New Boaz Harrosh 1 participant 4 messages Mar 25, 2009 VFS

lore
Share & tools
lore
#0 lore raw

cover exofs: Exportable by NFS

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

#1 lore raw

PATCH 1/3 prints in hex

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(-)
fs/exofs/inode.c +25 -24
index 739629a..b77c197 100644
@@ -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);
 
Signature · 1 line
1.6.2.1
#2 lore raw

PATCH 2/3 exofs does support 64bit file sizes

In reply to Boaz Harrosh

Tell VFS that we support 64-bit files

[SQUASH TO: exofs: super_operations and file_system_type]

---
 fs/exofs/super.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/exofs/super.c +1 -0
index feed8d2..7cfaaa0 100644
@@ -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;
Signature · 1 line
1.6.2.1
#3 lore raw

PATCH 3/3 exofs: export_operations

In reply to Boaz Harrosh

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

---
 fs/exofs/dir.c   |   15 +++++++++++++++
 fs/exofs/exofs.h |    2 ++
 fs/exofs/super.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 0 deletions(-)
fs/exofs/dir.c +15 -0
index 0ca733a..55ebbb1 100644
@@ -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;
fs/exofs/exofs.h +2 -0
index d54753d..da1397a 100644
@@ -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;
fs/exofs/super.c +51 -0

69 lines not on this page · raw message

Signature · 1 line
1.6.2.1