exofs patches for after 2.6.32
Subsystems (2)
PATCH 1/1 exofs patches for after 2.6.32
Assorted bunch of patches to the exofs file system. Most of these are a resend, they did not make it to 2.6.32 because the dependent bits from drivers/scsi/osd did not make it into 2.6.32. I hope they finally will for 2.6.33.
These patches are just preliminary cleanups to some new fixtures that will be sent next.
Thank you for reviewing
list of patches:
[PATCH 1/6] trivial: some small fixes in exofs documentation [PATCH 2/6] exofs: More sane debug print
[PATCH 3/6] exofs: dbg-print less
[PATCH 4/6] exofs: refactor exofs_i_info initialization into common helper [PATCH 5/6] exofs: Prints on mount and unmout
[PATCH 6/6] exofs: statfs blocks is sectors not FS blocks
Boaz
PATCH 1/6 trivial: some small fixes in exofs documentation
From: Thadeu Lima de Souza Cascardo <[email protected]>
Add exofs.txt to filesystems Documentation index and fix some typos, identation and grammar.
--- Documentation/filesystems/00-INDEX | 2 ++ Documentation/filesystems/exofs.txt | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-)
Documentation/filesystems/00-INDEX +2 -0
@@ -36,6 +36,8 @@ dnotify.txt - info about directory notification in Linux. ecryptfs.txt - docs on eCryptfs: stacked cryptographic filesystem for Linux. +exofs.txt + - info, usage, mount options, design about EXOFS. ext2.txt - info, mount options and specifications for the Ext2 filesystem. ext3.txt
Documentation/filesystems/exofs.txt +12 -11
@@ -60,13 +60,13 @@ USAGE mkfs.exofs --pid=65536 --format /dev/osd0 - The --format is optional if not specified no OSD_FORMAT will be - preformed and a clean file system will be created in the specified pid, + The --format is optional. If not specified, no OSD_FORMAT will be + performed and a clean file system will be created in the specified pid, in the available space of the target. (Use --format=size_in_meg to limit the total LUN space available) - If pid already exist it will be deleted and a new one will be created in it's - place. Be careful. + If pid already exists, it will be deleted and a new one will be created in + its place. Be careful. An exofs lives inside a single OSD partition. You can create multiple exofs filesystems on the same device using multiple pids.
@@ -81,7 +81,7 @@ USAGE 7. For reference (See do-exofs example script): do-exofs start - an example of how to perform the above steps. - do-exofs stop - an example of how to unmount the file system. + do-exofs stop - an example of how to unmount the file system. do-exofs format - an example of how to format and mkfs a new exofs. 8. Extra compilation flags (uncomment in fs/exofs/Kbuild):
@@ -104,8 +104,8 @@ Where: exofs specific options: Options are separated by commas (,) pid=<integer> - The partition number to mount/create as container of the filesystem. - This option is mandatory - to=<integer> - Timeout in ticks for a single command + This option is mandatory. + to=<integer> - Timeout in ticks for a single command. default is (60 * HZ) [for debugging only] ===============================================================================
@@ -116,7 +116,7 @@ DESIGN with a special ID (defined in common.h). Information included in the file system control block is used to fill the in-memory superblock structure at mount time. This object is created before - the file system is used by mkexofs.c It contains information such as: + the file system is used by mkexofs.c. It contains information such as: - The file system's magic number - The next inode number to be allocated
@@ -134,8 +134,8 @@ DESIGN attributes. This applies to both regular files and other types (directories, device files, symlinks, etc.). -* Credentials are generated per object (inode and superblock) when they is - created in memory (read off disk or created). The credential works for all +* Credentials are generated per object (inode and superblock) when they are + created in memory (read from disk or created). The credential works for all operations and is used as long as the object remains in memory. * Async OSD operations are used whenever possible, but the target may execute
@@ -145,7 +145,8 @@ DESIGN from executing in reverse order: - The following are handled with the OBJ_CREATED and OBJ_2BCREATED flags. OBJ_CREATED is set when we know the object exists on the OSD - - in create's callback function, and when we successfully do a read_inode. + in create's callback function, and when we successfully do a + read_inode. OBJ_2BCREATED is set in the beginning of the create function, so we know that we should wait. - create/delete: delete should wait until the object is created
Signature · 1 line
1.6.5.1
PATCH 2/6 exofs: More sane debug print
In reply to Boaz Harroshdebug prints should be somewhat useful without actually reading the source code
--- fs/exofs/inode.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
fs/exofs/inode.c +1 -2
@@ -950,8 +950,7 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino)#ifdef EXOFS_DEBUG_OBJ_ISIZE if ((inode->i_size != sanity) && (!exofs_inode_is_fast_symlink (inode))) { -EXOFS_ERR ("WARNING: Size of object from inode and " -"attributes differ (%lld != %llu)\n" , +EXOFS_ERR ("WARNING: Size of inode=%llu != object=%llu\n" , inode->i_size,_LLU (sanity)); }#endif
Signature · 1 line
1.6.5.1
PATCH 3/6 exofs: dbg-print less
In reply to Boaz HarroshIner-loops printing is converted to EXOFS_DBG2 which is #defined to nothing.
It is now almost bareable to just leave debug-on. Every operation is printed once, with most relevant info (I hope).
--- fs/exofs/inode.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
fs/exofs/inode.c +6 -4
@@ -41,6 +41,8 @@# define EXOFS_DEBUG_OBJ_ISIZE 1#endif +#define EXOFS_DBGMSG2(M...) do{}while(0) +struct page_collect {struct exofs_sb_info *sbi;struct request_queue *req_q;
@@ -198,7 +200,7 @@ static int __readpages_done(struct osd_request *or, struct page_collect *pcol,else page_stat = ret; -EXOFS_DBGMSG (" readpages_done(0x%lx, 0x%lx) %s\n" , +EXOFS_DBGMSG2 (" readpages_done(0x%lx, 0x%lx) %s\n" , inode->i_ino, page->index, page_stat ?"bad_bytes" :"good_bytes" );
@@ -370,7 +372,7 @@ try_again:if (len !=PAGE_CACHE_SIZE )zero_user (page, len,PAGE_CACHE_SIZE - len); -EXOFS_DBGMSG (" readpage_strip(0x%lx, 0x%lx) len=0x%zx\n" , +EXOFS_DBGMSG2 (" readpage_strip(0x%lx, 0x%lx) len=0x%zx\n" , inode->i_ino, page->index, len); ret =pcol_add_page (pcol, page, len);
@@ -482,7 +484,7 @@ static void writepages_done(struct osd_request *or, void *p)update_write_page (page, page_stat);unlock_page (page); -EXOFS_DBGMSG (" writepages_done(0x%lx, 0x%lx) status=%d\n" , +EXOFS_DBGMSG2 (" writepages_done(0x%lx, 0x%lx) status=%d\n" , inode->i_ino, page->index, page_stat); length += bvec->bv_len;
@@ -609,7 +611,7 @@ try_again: goto fail; } -EXOFS_DBGMSG (" writepage_strip(0x%lx, 0x%lx) len=0x%zx\n" , +EXOFS_DBGMSG2 (" writepage_strip(0x%lx, 0x%lx) len=0x%zx\n" , inode->i_ino, page->index, len); ret =pcol_add_page (pcol, page, len);
Signature · 1 line
1.6.5.1
PATCH 4/6 exofs: refactor exofs_i_info initialization into common helper
In reply to Boaz HarroshThere are two places that initialize inodes: exofs_iget() and exofs_new_inode()
As more members of exofs_i_info that need initialization are added this code will grow. (soon)
--- fs/exofs/inode.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
fs/exofs/inode.c +8 -2
@@ -908,6 +908,12 @@ out:return ret; } + +static void __oi_init (struct exofs_i_info *oi) +{ +init_waitqueue_head (&oi->i_wq); + oi->i_flags =0 ; +}/* * Fill in an inode read from the OSD and set it up for use */
@@ -925,13 +931,13 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino)if (!(inode->i_state &I_NEW ))return inode; oi =exofs_i (inode); +__oi_init (oi);/* read the inode from the osd */ ret =exofs_get_inode (sb, oi, &fcb, &sanity);if (ret) goto bad_inode; -init_waitqueue_head (&oi->i_wq);set_obj_created (oi);/* copy stuff from on-disk struct to in-memory struct */
@@ -1062,8 +1068,8 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)return ERR_PTR (-ENOMEM ); oi =exofs_i (inode); +__oi_init (oi); -init_waitqueue_head (&oi->i_wq);set_obj_2bcreated (oi); sbi = sb->s_fs_info;
Signature · 1 line
1.6.5.1
PATCH 5/6 exofs: Prints on mount and unmout
In reply to Boaz HarroshIt is important to print in the logs when a filesystem was mounted and eventually unmounted.
Print the osd-device's osd_name and pid the FS was mounted/unmounted on.
TODO: How to also print the namespace path the filesystem was
mounted on?
--- fs/exofs/super.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
fs/exofs/super.c +11 -0
@@ -257,6 +257,15 @@ static void exofs_write_super(struct super_block *sb) sb->s_dirt =0 ; } +static void _exofs_print_device (const char *msg,const char *dev_path, +struct osd_dev *od,u64 pid) +{ +const struct osd_dev_info *odi =osduld_device_info (od); + +printk (KERN_NOTICE "exofs: %s %s osd_name-%s pid-0x%llx\n" , + msg, dev_path ?:"" , odi->osdname,_LLU (pid)); +} +/* * This function is called when the vfs is freeing the superblock. We just * need to free our own part.
@@ -279,6 +288,7 @@ static void exofs_put_super(struct super_block *sb) msecs_to_jiffies(100)); } +_exofs_print_device ("Unmounting" ,NULL , sbi->s_dev, sbi->s_pid);osduld_put_device (sbi->s_dev);kfree (sb->s_fs_info); sb->s_fs_info =NULL ;
@@ -395,6 +405,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) goto free_sbi; } +_exofs_print_device ("Mounting" , opts->dev_name, sbi->s_dev, sbi->s_pid); ret =0 ; out:if (or)
Signature · 1 line
1.6.5.1
PATCH 6/6 exofs: statfs blocks is sectors not FS blocks
In reply to Boaz HarroshEven though exofs has a 4k block size, statfs blocks is in sectors (512 bytes).
Also if target returns 0 for capacity then make it ULLONG_MAX. df does not like zero-size filesystems
--- fs/exofs/super.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
fs/exofs/super.c +6 -4
@@ -473,9 +473,11 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf) goto out; ret =extract_attr_from_req (or, &attrs[0 ]); -if (likely (!ret)) +if (likely (!ret)) { capacity =get_unaligned_be64 (attrs[0 ].val_ptr); -else +if (unlikely (!capacity)) + capacity =ULLONG_MAX ; + }else EXOFS_DBGMSG ("exofs_statfs: get capacity failed.\n" ); ret =extract_attr_from_req (or, &attrs[1 ]);
@@ -487,8 +489,8 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)/* fill in the stats buffer */ buf->f_type =EXOFS_SUPER_MAGIC ; buf->f_bsize =EXOFS_BLKSIZE ; - buf->f_blocks = (capacity >>EXOFS_BLKSHIFT ); - buf->f_bfree = ((capacity - used) >>EXOFS_BLKSHIFT ); + buf->f_blocks = capacity >>9 ; + buf->f_bfree = (capacity - used) >>9 ; buf->f_bavail = buf->f_bfree; buf->f_files = sbi->s_numfiles; buf->f_ffree =EXOFS_MAX_ID - sbi->s_numfiles;
Signature · 1 line
1.6.5.1