[PATCH 1/3] fs/block_dev.c: need not to check inode->i_bdev in bd_forget()

2012-09-26 Thread Yan Hong
Its only caller evict() has promised a non-NULL inode->i_bdev. Signed-off-by: Yan Hong --- fs/block_dev.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 38e721b..9bdbd9b 100644 --- a/fs/block_dev.c +++ b/fs/block_de

[PATCH 3/3] fs/fs-writeback.c: remove unneccesary parameter of __writeback_single_inode()

2012-09-26 Thread Yan Hong
The parameter 'wb' is never used in this function. Cc: Wu Fengguang Signed-off-by: Yan Hong --- fs/fs-writeback.c |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index be3efc4..da746e8 100644 --- a/fs/fs-writeback.

[PATCH 2/3] fs/debugsfs: get rid of unnecessary inode->i_private initialization

2012-09-26 Thread Yan Hong
inode->i_private is promised to be NULL on allocation, no need to set it explicitly. Signed-off-by: Yan Hong --- fs/debugfs/inode.c |1 - 1 file changed, 1 deletion(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 4733eab..de2698d 100644 --- a/fs/debugfs/inode.c +++ b

[PATCH] scripts/checkpatch.pl: seperate mutiple results with black line

2012-09-26 Thread Yan Hong
. total: 0 errors, 0 warnings, 25 lines checked .patch has no obvious style problems and is ready for submission. Also leave two blank lines after the error message if check fails. Signed-off-by: Yan Hong --- scripts/checkpatch.pl |6 -- 1 file changed, 4 insertions(+), 2 deletions

[PATCH 1/3] debugfs: pass NULL as the last parameter of debugfs_print_regs32()

2012-10-26 Thread Yan Hong
Pass NULL instead of empty string to debugfs_print_regs32() when prefix is not used, according to the intention of the code. Signed-off-by: Yan Hong --- drivers/usb/dwc3/debugfs.c |2 +- fs/debugfs/file.c |3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a

[PATCH 2/3] debugfs: code clean and refactor

2012-10-26 Thread Yan Hong
debug_fill_super(): return directly if failed to allocate debugfs_fs_info. __create_file(): remove redundant initialization. __debugfs_remove(): remove redundant check. debugfs_positive() already checked dentry->inode is not NULL. Signed-off-by: Yan Hong ---

[PATCH 3/3] debugfs: break long lines

2012-10-26 Thread Yan Hong
Signed-off-by: Yan Hong --- fs/debugfs/file.c | 42 -- fs/debugfs/inode.c | 10 ++ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 3915cc9..b37eee1 100644 --- a/fs/debugfs/file.c

[PATCH 1/5] debugfs: pass NULL as the last parameter of debugfs_print_regs32()

2012-10-27 Thread Yan Hong
If 'prefix' is not used, pass NULL instead of empty string as the last parameter of debugfs_print_regs32(). Cc: Alessandro Rubini Signed-off-by: Yan Hong --- This function is only used (twice) by the author of it, and the 'prefix' feature is never used. But it's a we

[PATCH 3/5] debugfs: remove redundant initialization in __create_file()

2012-10-27 Thread Yan Hong
'dentry' has been set to NULL at the beginning of the function. Signed-off-by: Yan Hong --- fs/debugfs/inode.c |1 - 1 file changed, 1 deletion(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 11f6514..12f1282 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c

[PATCH 5/5] debugfs: remove goto in debugfs_remount()

2012-10-27 Thread Yan Hong
Simple code clean to remove goto. Signed-off-by: Yan Hong --- fs/debugfs/inode.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 58eadc1..c0b06a3 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -221,12 +221,11

[PATCH 4/5] debugfs: remove redundant check in __debugfs_remove()

2012-10-27 Thread Yan Hong
debugfs_positive() already checked dentry->d_inode is not NUUL, no need to check it again. Signed-off-by: Yan Hong --- fs/debugfs/inode.c | 30 ++ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 12f1

[PATCH 2/5] debugfs: return directly if failed to allocate memory in debug_fill_super()

2012-10-27 Thread Yan Hong
If kzalloc failed, memory is not allocated, sb->s_fs_info is NULL. No need to go through clean up code, return -ENOMEM directly. Signed-off-by: Yan Hong --- fs/debugfs/inode.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inod

Re: [PATCH 5/5] debugfs: remove goto in debugfs_remount()

2012-10-27 Thread Yan Hong
2012/10/27 Greg KH : > On Sat, Oct 27, 2012 at 04:05:29PM +0800, Yan Hong wrote: >> Simple code clean to remove goto. > > There is nothing wrong with gotos on error paths, so this one should > stay. > > greg k-h I thought we use goto on error path because there is no othe

[PATCH] writeback: fix a typo in comment

2012-11-22 Thread Yan Hong
Signed-off-by: Yan Hong --- fs/fs-writeback.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 51ea267..e9e619a 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1032,7 +1032,7 @@ int bdi_writeback_thread(void *data

[PATCH 1/2] fs/buffer.c: do not inline exported function

2012-11-22 Thread Yan Hong
It makes no sense to inlines exported function. Signed-off-by: Yan Hong --- init_buffer() is trivial and only get two module users. Maybe we can move it to buffer_head.h. Remove inline is much more simple to make it clean though. fs/buffer.c |3 +-- 1 file changed, 1 insertion(+), 2

[PATCH 2/2] fs/buffer.c: remove redundant initialization in alloc_page_buffers()

2012-11-22 Thread Yan Hong
buffer_head comes from kmem_cache_zalloc(), no need to zero its field. Signed-off-by: Yan Hong --- init_buffer() can be actually removed too, but I'm afraid someday its semantic will beyond initializing ->b_end_io and ->b_private. fs/buffer.c |3 --- 1 file changed, 3 deletio

[PATCH 0/8] Misc vfs code clean

2012-09-27 Thread Yan Hong
Yan Hong (8): fs/namespace.c: introduce helper function path_unmounted() fs/namespace.c: remove unused macro MNT_WRITER_UNDERFLOW_LIMIT fs/namespace.c: trivial code clean fs/namespace.c: check permission early in sys_[u]mount fs/namei.c: introduce macro AT_FDINV fs/inode.c: call

[PATCH 1/8] fs/namespace.c: introduce helper function path_unmounted()

2012-09-27 Thread Yan Hong
In fs/namespace.c, we verify whether a path is a mountpoint by comparing path->dentry and path->mnt->mnt_root. Introduce path_unmounted() to make code more readable. Signed-off-by: Yan Hong --- fs/namespace.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions

[PATCH 3/8] fs/namespace.c: trivial code clean

2012-09-27 Thread Yan Hong
Signed-off-by: Yan Hong --- fs/namespace.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index dd969f8..bbe9014 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -763,7 +763,7 @@ vfs_kern_mount(struct file_system_type *type, int

[PATCH 2/8] fs/namespace.c: remove unused macro MNT_WRITER_UNDERFLOW_LIMIT

2012-09-27 Thread Yan Hong
Its users have gone. Signed-off-by: Yan Hong --- fs/namespace.c |1 - 1 file changed, 1 deletion(-) diff --git a/fs/namespace.c b/fs/namespace.c index 3fdc239..dd969f8 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -59,7 +59,6 @@ static inline unsigned long hash(struct vfsmount *mnt

[PATCH 4/8] fs/namespace.c: check permission early in sys_[u]mount

2012-09-27 Thread Yan Hong
We have several branches in sys_mount, each of them will check CAP_SYS_ADMIN capability seperately. Do this check at the beginning of sys_mount. Also check permission as early as possible in sys_umount. Signed-off-by: Yan Hong --- fs/namespace.c | 26 +++--- 1 file

[PATCH 5/8] fs/namei.c: introduce macro AT_FDINV

2012-09-27 Thread Yan Hong
File descriptor is irrelevent when LOOKUP_ROOT is set. Introduce AT_FDINV to avoid using hard coded value or reusing existing macro. Signed-off-by: Yan Hong --- fs/namei.c| 11 ++- include/linux/fcntl.h |2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff

[PATCH 6/8] fs/inode.c: call alloc_inode() in new_inode() directly

2012-09-27 Thread Yan Hong
This saves us a list head initialization. Signed-off-by: Yan Hong --- fs/inode.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index ac8d904..3a2cd41 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -921,9 +921,11 @@ struct inode *new_inode

[PATCH 7/8] fs/inode.c: remove outstanding spin lock prefetch

2012-09-27 Thread Yan Hong
Do we have particular reason to do this here? Signed-off-by: Yan Hong --- fs/inode.c |3 --- 1 file changed, 3 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 3a2cd41..e89d30c 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -14,7 +14,6 @@ #include #include #include -#include

[PATCH 8/8] vfs: misc comment clean

2012-09-27 Thread Yan Hong
Mostly fix comments which reference inexist locks or parameters. Signed-off-by: Yan Hong --- fs/dcache.c| 12 fs/inode.c |4 ++-- fs/namei.c |2 +- fs/namespace.c |9 +++-- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/fs/dcache.c b