linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] vfs: Small cleanups
@ 2011-12-20 12:32 Tetsuo Handa
  2011-12-20 12:33 ` [PATCH 1/3] vfs: Mark some functions static Tetsuo Handa
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Tetsuo Handa @ 2011-12-20 12:32 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel

Marks some functions static and deletes unused function.

[PATCH 1/3] vfs: Mark some functions static.
[PATCH 2/3] vfs: Remove unused d_path_with_unreachable().
[PATCH 3/3] vfs: Mark d_clear_need_lookup() static.

Made on current linux.git HEAD.

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

* [PATCH 1/3] vfs: Mark some functions static.
  2011-12-20 12:32 [PATCH 0/3] vfs: Small cleanups Tetsuo Handa
@ 2011-12-20 12:33 ` Tetsuo Handa
  2011-12-20 14:19   ` Oleg Nesterov
  2011-12-20 12:33 ` [PATCH 0/3] vfs: Small cleanups Tetsuo Handa
  2011-12-20 12:34 ` [PATCH 3/3] vfs: Mark d_clear_need_lookup() static Tetsuo Handa
  2 siblings, 1 reply; 8+ messages in thread
From: Tetsuo Handa @ 2011-12-20 12:33 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, oleg, kosaki.motohiro

>From 26e839b0130548fe05566a2a3a831b0905b40fcd Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Tue, 20 Dec 2011 21:02:00 +0900
Subject: [PATCH 1/3] vfs: Mark some functions static.

Commit 0e028465 "exec: unify do_execve/compat_do_execve code" removed external
reference to bprm_mm_init()/prepare_bprm_creds()/check_unsafe_exec()/free_bprm().

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: <stable@vger.kernel.org> [3.0+]
---
 fs/exec.c               |    8 ++++----
 fs/internal.h           |    5 -----
 include/linux/binfmts.h |    3 ---
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 3625464..c1993f2 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -367,7 +367,7 @@ static bool valid_arg_len(struct linux_binprm *bprm, long len)
  * flags, permissions, and offset, so we use temporary values.  We'll update
  * them later in setup_arg_pages().
  */
-int bprm_mm_init(struct linux_binprm *bprm)
+static int bprm_mm_init(struct linux_binprm *bprm)
 {
 	int err;
 	struct mm_struct *mm = NULL;
@@ -1178,7 +1178,7 @@ EXPORT_SYMBOL(setup_new_exec);
  * Or, if exec fails before, free_bprm() should release ->cred and
  * and unlock.
  */
-int prepare_bprm_creds(struct linux_binprm *bprm)
+static int prepare_bprm_creds(struct linux_binprm *bprm)
 {
 	if (mutex_lock_interruptible(&current->signal->cred_guard_mutex))
 		return -ERESTARTNOINTR;
@@ -1191,7 +1191,7 @@ int prepare_bprm_creds(struct linux_binprm *bprm)
 	return -ENOMEM;
 }
 
-void free_bprm(struct linux_binprm *bprm)
+static void free_bprm(struct linux_binprm *bprm)
 {
 	free_arg_pages(bprm);
 	if (bprm->cred) {
@@ -1225,7 +1225,7 @@ EXPORT_SYMBOL(install_exec_creds);
  * - the caller must hold ->cred_guard_mutex to protect against
  *   PTRACE_ATTACH
  */
-int check_unsafe_exec(struct linux_binprm *bprm)
+static int check_unsafe_exec(struct linux_binprm *bprm)
 {
 	struct task_struct *p = current, *t;
 	unsigned n_fs;
diff --git a/fs/internal.h b/fs/internal.h
index fe327c2..6aa3f96 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -52,11 +52,6 @@ static inline int __sync_blockdev(struct block_device *bdev, int wait)
 extern void __init chrdev_init(void);
 
 /*
- * exec.c
- */
-extern int check_unsafe_exec(struct linux_binprm *);
-
-/*
  * namespace.c
  */
 extern int copy_mount_options(const void __user *, unsigned long *);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index fd88a39..0410a1b 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -126,14 +126,11 @@ extern int suid_dumpable;
 extern int setup_arg_pages(struct linux_binprm * bprm,
 			   unsigned long stack_top,
 			   int executable_stack);
-extern int bprm_mm_init(struct linux_binprm *bprm);
 extern int copy_strings_kernel(int argc, const char *const *argv,
 			       struct linux_binprm *bprm);
-extern int prepare_bprm_creds(struct linux_binprm *bprm);
 extern void install_exec_creds(struct linux_binprm *bprm);
 extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
 extern void set_binfmt(struct linux_binfmt *new);
-extern void free_bprm(struct linux_binprm *);
 
 #endif /* __KERNEL__ */
 #endif /* _LINUX_BINFMTS_H */
-- 
1.7.1

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

* Re: [PATCH 0/3] vfs: Small cleanups
  2011-12-20 12:32 [PATCH 0/3] vfs: Small cleanups Tetsuo Handa
  2011-12-20 12:33 ` [PATCH 1/3] vfs: Mark some functions static Tetsuo Handa
@ 2011-12-20 12:33 ` Tetsuo Handa
  2011-12-20 12:34 ` [PATCH 3/3] vfs: Mark d_clear_need_lookup() static Tetsuo Handa
  2 siblings, 0 replies; 8+ messages in thread
From: Tetsuo Handa @ 2011-12-20 12:33 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, mszeredi, ebiederm

>From ad60bef3cca88617d8d183275eeea0496f64ae17 Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Tue, 20 Dec 2011 21:04:34 +0900
Subject: [PATCH 2/3] vfs: Remove unused d_path_with_unreachable().

Commit 8df9d1a4 "vfs: show unreachable paths in getcwd and proc" introduced
d_path_with_unreachable(). However, reference to it was soon removed by commit
7b2a69ba "Revert "vfs: show unreachable paths in getcwd and proc"".
As a reuslt, d_path_with_unreachable() is never used in released versions.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Miklos Szeredi <mszeredi@suse.cz>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: <stable@vger.kernel.org> [2.6.36+]
---
 fs/dcache.c            |   31 -------------------------------
 include/linux/dcache.h |    1 -
 2 files changed, 0 insertions(+), 32 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 89509b5..d0d4ae7 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2624,37 +2624,6 @@ char *d_path(const struct path *path, char *buf, int buflen)
 }
 EXPORT_SYMBOL(d_path);
 
-/**
- * d_path_with_unreachable - return the path of a dentry
- * @path: path to report
- * @buf: buffer to return value in
- * @buflen: buffer length
- *
- * The difference from d_path() is that this prepends "(unreachable)"
- * to paths which are unreachable from the current process' root.
- */
-char *d_path_with_unreachable(const struct path *path, char *buf, int buflen)
-{
-	char *res = buf + buflen;
-	struct path root;
-	int error;
-
-	if (path->dentry->d_op && path->dentry->d_op->d_dname)
-		return path->dentry->d_op->d_dname(path->dentry, buf, buflen);
-
-	get_fs_root(current->fs, &root);
-	write_seqlock(&rename_lock);
-	error = path_with_deleted(path, &root, &res, &buflen);
-	if (error > 0)
-		error = prepend_unreachable(&res, &buflen);
-	write_sequnlock(&rename_lock);
-	path_put(&root);
-	if (error)
-		res =  ERR_PTR(error);
-
-	return res;
-}
-
 /*
  * Helper function for dentry_operations.d_dname() members
  */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index ed9f74f..8f92eb4 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -342,7 +342,6 @@ extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
 extern char *__d_path(const struct path *, const struct path *, char *, int);
 extern char *d_absolute_path(const struct path *, char *, int);
 extern char *d_path(const struct path *, char *, int);
-extern char *d_path_with_unreachable(const struct path *, char *, int);
 extern char *dentry_path_raw(struct dentry *, char *, int);
 extern char *dentry_path(struct dentry *, char *, int);
 
-- 
1.7.1

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

* [PATCH 3/3] vfs: Mark d_clear_need_lookup() static.
  2011-12-20 12:32 [PATCH 0/3] vfs: Small cleanups Tetsuo Handa
  2011-12-20 12:33 ` [PATCH 1/3] vfs: Mark some functions static Tetsuo Handa
  2011-12-20 12:33 ` [PATCH 0/3] vfs: Small cleanups Tetsuo Handa
@ 2011-12-20 12:34 ` Tetsuo Handa
  2011-12-20 14:41   ` Christoph Hellwig
  2 siblings, 1 reply; 8+ messages in thread
From: Tetsuo Handa @ 2011-12-20 12:34 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, josef

>From f0b6c91506dadba668b5d7d40909ef8f589c20ff Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Tue, 20 Dec 2011 21:18:40 +0900
Subject: [PATCH 3/3] vfs: Mark d_clear_need_lookup() static.

Commit 44396f4b "fs: add a DCACHE_NEED_LOOKUP flag for d_flags" introduced
d_clear_need_lookup() but there is no external references.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Josef Bacik <josef@redhat.com>
Cc: <stable@vger.kernel.org> [3.1]
---
 fs/dcache.c            |    3 +--
 include/linux/dcache.h |    2 --
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index d0d4ae7..cb4291b 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -384,14 +384,13 @@ EXPORT_SYMBOL(d_drop);
  * the lookup code, but now needs to be unhashed while we do the actual lookup
  * and clear the DCACHE_NEED_LOOKUP flag.
  */
-void d_clear_need_lookup(struct dentry *dentry)
+static void d_clear_need_lookup(struct dentry *dentry)
 {
 	spin_lock(&dentry->d_lock);
 	__d_drop(dentry);
 	dentry->d_flags &= ~DCACHE_NEED_LOOKUP;
 	spin_unlock(&dentry->d_lock);
 }
-EXPORT_SYMBOL(d_clear_need_lookup);
 
 /*
  * Finish off a dentry we've decided to kill.
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 8f92eb4..6805a15 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -420,8 +420,6 @@ static inline bool d_need_lookup(struct dentry *dentry)
 	return dentry->d_flags & DCACHE_NEED_LOOKUP;
 }
 
-extern void d_clear_need_lookup(struct dentry *dentry);
-
 extern int sysctl_vfs_cache_pressure;
 
 #endif	/* __LINUX_DCACHE_H */
-- 
1.7.1

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

* Re: [PATCH 1/3] vfs: Mark some functions static.
  2011-12-20 12:33 ` [PATCH 1/3] vfs: Mark some functions static Tetsuo Handa
@ 2011-12-20 14:19   ` Oleg Nesterov
  2011-12-20 19:35     ` KOSAKI Motohiro
  2011-12-20 21:47     ` Tetsuo Handa
  0 siblings, 2 replies; 8+ messages in thread
From: Oleg Nesterov @ 2011-12-20 14:19 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: viro, linux-fsdevel, kosaki.motohiro

On 12/20, Tetsuo Handa wrote:
>
> Commit 0e028465 "exec: unify do_execve/compat_do_execve code" removed external
> reference to bprm_mm_init()/prepare_bprm_creds()/check_unsafe_exec()/free_bprm().

Thanks,

Acked-by: Oleg Nesterov <oleg@redhat.com>


> Cc: <stable@vger.kernel.org> [3.0+]

Why? I don't think -stable needs this cleanup.

Oleg.


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

* Re: [PATCH 3/3] vfs: Mark d_clear_need_lookup() static.
  2011-12-20 12:34 ` [PATCH 3/3] vfs: Mark d_clear_need_lookup() static Tetsuo Handa
@ 2011-12-20 14:41   ` Christoph Hellwig
  0 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2011-12-20 14:41 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: viro, linux-fsdevel, josef

On Tue, Dec 20, 2011 at 09:34:45PM +0900, Tetsuo Handa wrote:
> >From f0b6c91506dadba668b5d7d40909ef8f589c20ff Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Date: Tue, 20 Dec 2011 21:18:40 +0900
> Subject: [PATCH 3/3] vfs: Mark d_clear_need_lookup() static.
> 
> Commit 44396f4b "fs: add a DCACHE_NEED_LOOKUP flag for d_flags" introduced
> d_clear_need_lookup() but there is no external references.

That's because btrfs opencoded it.   Please replace the opencoded
version in btrfs with the helper.


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

* Re: [PATCH 1/3] vfs: Mark some functions static.
  2011-12-20 14:19   ` Oleg Nesterov
@ 2011-12-20 19:35     ` KOSAKI Motohiro
  2011-12-20 21:47     ` Tetsuo Handa
  1 sibling, 0 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2011-12-20 19:35 UTC (permalink / raw)
  To: oleg; +Cc: penguin-kernel, viro, linux-fsdevel

On 12/20/2011 9:19 AM, Oleg Nesterov wrote:
> On 12/20, Tetsuo Handa wrote:
>>
>> Commit 0e028465 "exec: unify do_execve/compat_do_execve code" removed external
>> reference to bprm_mm_init()/prepare_bprm_creds()/check_unsafe_exec()/free_bprm().
> 
> Thanks,
> 
> Acked-by: Oleg Nesterov <oleg@redhat.com>

Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>


> 
> 
>> Cc: <stable@vger.kernel.org> [3.0+]
> 
> Why? I don't think -stable needs this cleanup.
> 
> Oleg.
> 
> 


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

* Re: [PATCH 1/3] vfs: Mark some functions static.
  2011-12-20 14:19   ` Oleg Nesterov
  2011-12-20 19:35     ` KOSAKI Motohiro
@ 2011-12-20 21:47     ` Tetsuo Handa
  1 sibling, 0 replies; 8+ messages in thread
From: Tetsuo Handa @ 2011-12-20 21:47 UTC (permalink / raw)
  To: oleg, viro; +Cc: linux-fsdevel, kosaki.motohiro

Oleg Nesterov wrote:
> > Cc: <stable@vger.kernel.org> [3.0+]
> 
> Why? I don't think -stable needs this cleanup.

OK. I just thought it helps compiler optimize code and reduce
object size. Al, you can remove this line whien applying.

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

end of thread, other threads:[~2011-12-20 21:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-20 12:32 [PATCH 0/3] vfs: Small cleanups Tetsuo Handa
2011-12-20 12:33 ` [PATCH 1/3] vfs: Mark some functions static Tetsuo Handa
2011-12-20 14:19   ` Oleg Nesterov
2011-12-20 19:35     ` KOSAKI Motohiro
2011-12-20 21:47     ` Tetsuo Handa
2011-12-20 12:33 ` [PATCH 0/3] vfs: Small cleanups Tetsuo Handa
2011-12-20 12:34 ` [PATCH 3/3] vfs: Mark d_clear_need_lookup() static Tetsuo Handa
2011-12-20 14:41   ` Christoph Hellwig

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).