Re: [PATCHSET 0/8 version 4] exofs for kernel 2.6.30
From: Boaz Harrosh
Date: Mon Mar 23 2009 - 09:08:25 EST
Boaz Harrosh wrote:
> What's new since last iteration:
>
> * I completely re-wrote the [PATCH 4/8] exofs: address_space_operations
> in which we actually write/read to/from osd-storage. The difference is
> that now we try to accumulate as many contiguous pages as possible and
> send them as one large request. As opposed to writing each page at a
> time, in the previous patchset.
>
> * [PATCH 5/8] exofs: dir_inode and directory operations received lots
> of love thanks to Evgeniy Polyakov's grate comments.
>
> exofs is a file system that uses an OSD device as it's back store.
>
> OSD is a new T10 command set that views storage devices not as a large/flat
> array of sectors but as a container of objects, each having a length, quota,
> time attributes and more. Each object is addressed by a 64bit ID, and is
> contained in a 64bit ID partition. Each object has associated attributes
> attached to it, which are integral part of the object and provide metadata about
> the object. The standard defines some common obligatory attributes, but user
> attributes can be added as needed.
>
> Here is the list of patches
> [PATCH 1/8] exofs: Kbuild, Headers and osd utils
I have updated this patch on git.open-osd.org
Kbuild fallout
> [PATCH 2/8] exofs: file and file_inode operations
> [PATCH 3/8] exofs: symlink_inode and fast_symlink_inode operations
> [PATCH 4/8] exofs: address_space_operations
I have posted a new version of this patch
> [PATCH 5/8] exofs: dir_inode and directory operations
> [PATCH 6/8] exofs: super_operations and file_system_type
Minor clean-up to this patch
(moved local structures to c file from header, remove unused function)
> [PATCH 7/8] exofs: Documentation
> [PATCH 8/8] fs: Add exofs to Kernel build
>
Revised patchset can be found on link below
Attached the total diff from last HEAD
> This patchset is also available on:
> git-clone git://git.open-osd.org/linux-open-osd.git linux-next
> or on the web at:
> http://git.open-osd.org/gitweb.cgi?p=linux-open-osd.git;a=shortlog;h=refs/heads/linux-next
>
> (Above tree is based on Linus v2.6.29-rc8-212-g8144737)
>
> If anyone wants to actually run this code and test it
> then please start reading at:
> http://open-osd.org
> You will need to checkout the out-of-tree git (below) for the user-mode utilities.
> Also the exofs.txt file in patch 7/8 should help
>
> If you want to review the user-mode library and supporting plumbings,
> git-clone git://git.open-osd.org/open-osd.git
> or on the web at:
> http://git.open-osd.org/gitweb.cgi?p=open-osd.git;a=summary
>
> Boaz
>
Thanks
Boaz
git diff --stat -p 690dd5e9e739cb0c66a792c5d7949f6e97113427..linux-next -- fs/exofs/
fs/exofs/Kbuild | 2 +-
fs/exofs/exofs.h | 17 -----------------
fs/exofs/file.c | 4 ++++
fs/exofs/inode.c | 45 ++++++++++++++++++++++-----------------------
fs/exofs/super.c | 9 +++++++++
5 files changed, 36 insertions(+), 41 deletions(-)
diff --git a/fs/exofs/Kbuild b/fs/exofs/Kbuild
index 592f40d..8c5253e 100644
--- a/fs/exofs/Kbuild
+++ b/fs/exofs/Kbuild
@@ -22,7 +22,7 @@ ccflags-y += -DCONFIG_EXOFS_FS -DCONFIG_EXOFS_FS_MODULE
# if we are built out-of-tree and the hosting kernel has OSD headers
# then "ccflags-y +=" will not pick the out-off-tree headers. Only by doing
# this it will work. This might break in future kernels
-KBUILD_CPPFLAGS := -I$(OSD_INC) $(KBUILD_CPPFLAGS)
+LINUXINCLUDE := -I$(OSD_INC) $(LINUXINCLUDE)
endif
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h
index 76155d7..d54753d 100644
--- a/fs/exofs/exofs.h
+++ b/fs/exofs/exofs.h
@@ -54,15 +54,6 @@
#define _LLU(x) (unsigned long long)(x)
/*
- * struct to hold what we get from mount options
- */
-struct exofs_mountopt {
- const char *dev_name;
- uint64_t pid;
- int timeout;
-};
-
-/*
* our extension to the in-memory superblock
*/
struct exofs_sb_info {
@@ -134,14 +125,6 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode)
}
/*
- * ugly struct so that we can pass two arguments to update_inode's callback
- */
-struct updatei_args {
- struct exofs_sb_info *sbi;
- struct exofs_fcb fcb;
-};
-
-/*
* Maximum count of links to a file
*/
#define EXOFS_LINK_MAX 32000
diff --git a/fs/exofs/file.c b/fs/exofs/file.c
index 4738c3f..2712f68 100644
--- a/fs/exofs/file.c
+++ b/fs/exofs/file.c
@@ -49,6 +49,10 @@ static int exofs_file_fsync(struct file *filp, struct dentry *dentry,
struct address_space *mapping = filp->f_mapping;
ret1 = filemap_write_and_wait(mapping);
+ /*Note: file_fsync below also calles sync_blockdev, which is a no-op
+ * for exofs, but other then that it does sync_inode and
+ * sync_superblock which is what we need here.
+ */
ret2 = file_fsync(filp, dentry, datasync);
return ret1 ? ret1 : ret2;
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 0f52e76..739629a 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -55,7 +55,7 @@ struct page_collect {
long pg_first;
};
-void _pcol_init(struct page_collect *pcol, unsigned expected_pages,
+static void _pcol_init(struct page_collect *pcol, unsigned expected_pages,
struct inode *inode)
{
struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
@@ -75,7 +75,7 @@ void _pcol_init(struct page_collect *pcol, unsigned expected_pages,
expected_pages);
}
-void _pcol_reset(struct page_collect *pcol)
+static void _pcol_reset(struct page_collect *pcol)
{
pcol->expected_pages -= min(pcol->nr_pages, pcol->expected_pages);
@@ -93,7 +93,7 @@ void _pcol_reset(struct page_collect *pcol)
pcol->expected_pages = 128;
}
-int pcol_try_alloc(struct page_collect *pcol)
+static int pcol_try_alloc(struct page_collect *pcol)
{
int pages = min_t(unsigned, pcol->expected_pages, BIO_MAX_PAGES);
@@ -103,18 +103,19 @@ int pcol_try_alloc(struct page_collect *pcol)
return 0;
}
- EXOFS_ERR("Failed to kcalloc expected_pages=%d\n",
+ EXOFS_ERR("Failed to kcalloc expected_pages=%u\n",
pcol->expected_pages);
return -ENOMEM;
}
-void pcol_free(struct page_collect *pcol)
+static void pcol_free(struct page_collect *pcol)
{
bio_put(pcol->bio);
pcol->bio = NULL;
}
-int pcol_add_page(struct page_collect *pcol, struct page *page, unsigned len)
+static int pcol_add_page(struct page_collect *pcol, struct page *page,
+ unsigned len)
{
int added_len = bio_add_pc_page(pcol->req_q, pcol->bio, page, len, 0);
if (unlikely(len != added_len))
@@ -173,9 +174,9 @@ static int __readpages_done(struct osd_request *or, struct page_collect *pcol,
osd_end_request(or);
- if (!ret)
+ if (likely(!ret))
good_bytes = pcol->length;
- else if (ret && !resid)
+ else if (!resid)
good_bytes = 0;
else
good_bytes = pcol->length - resid;
@@ -227,7 +228,7 @@ static void readpages_done(struct osd_request *or, void *p)
kfree(p);
}
-void _unlock_pcol_pages(struct page_collect *pcol, int ret, int rw)
+static void _unlock_pcol_pages(struct page_collect *pcol, int ret, int rw)
{
struct bio_vec *bvec;
int i;
@@ -245,7 +246,7 @@ void _unlock_pcol_pages(struct page_collect *pcol, int ret, int rw)
pcol_free(pcol);
}
-int read_exec(struct page_collect *pcol, bool is_sync)
+static int read_exec(struct page_collect *pcol, bool is_sync)
{
struct exofs_i_info *oi = exofs_i(pcol->inode);
struct osd_obj_id obj = {pcol->sbi->s_pid,
@@ -452,7 +453,7 @@ static void writepages_done(struct osd_request *or, void *p)
if (likely(!ret))
good_bytes = pcol->length;
- else if (ret && !resid)
+ else if (!resid)
good_bytes = 0;
else
good_bytes = pcol->length - resid;
@@ -493,7 +494,7 @@ static void writepages_done(struct osd_request *or, void *p)
EXOFS_DBGMSG("writepages_done END\n");
}
-int write_exec(struct page_collect *pcol)
+static int write_exec(struct page_collect *pcol)
{
struct exofs_i_info *oi = exofs_i(pcol->inode);
struct osd_obj_id obj = {pcol->sbi->s_pid,
@@ -631,7 +632,7 @@ fail:
return ret;
}
-int exofs_writepages(struct address_space *mapping,
+static int exofs_writepages(struct address_space *mapping,
struct writeback_control *wbc)
{
struct page_collect pcol;
@@ -1110,6 +1111,14 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
}
/*
+ * struct to pass two arguments to update_inode's callback
+ */
+struct updatei_args {
+ struct exofs_sb_info *sbi;
+ struct exofs_fcb fcb;
+};
+
+/*
* Callback function from exofs_update_inode().
*/
static void updatei_done(struct osd_request *or, void *p)
@@ -1218,16 +1227,6 @@ int exofs_write_inode(struct inode *inode, int wait)
return exofs_update_inode(inode, wait);
}
-int exofs_sync_inode(struct inode *inode)
-{
- struct writeback_control wbc = {
- .sync_mode = WB_SYNC_ALL,
- .nr_to_write = 0, /* sys_fsync did this */
- };
-
- return sync_inode(inode, &wbc);
-}
-
/*
* Callback function from exofs_delete_inode() - don't have much cleaning up to
* do.
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 9153db2..989952b 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -45,6 +45,15 @@
*****************************************************************************/
/*
+ * struct to hold what we get from mount options
+ */
+struct exofs_mountopt {
+ const char *dev_name;
+ uint64_t pid;
+ int timeout;
+};
+
+/*
* exofs-specific mount-time options.
*/
enum { Opt_pid, Opt_to, Opt_mkfs, Opt_format, Opt_err };