[PATCH v2] fs: Conditionally compile out statfs

6 views
Skip to first unread message

Iulia Manda

unread,
Jan 6, 2015, 5:30:04 PM1/6/15
to jo...@joshtriplett.org, opw-k...@googlegroups.com
This patch adds a Kconfig symbol to enable the compilation of statfs and
related syscalls.

The places where the functions from statfs.c were called select this symbol.

Bloat-o-meter output:

add/remove: 0/13 grow/shrink: 0/0 up/down: 0/-967 (-967)
function old new delta
sys_ustat 14 - -14
sys_statfs 37 - -37
sys_fstatfs 37 - -37
do_statfs64 43 - -43
vfs_ustat 50 - -50
sys_statfs64 51 - -51
sys_fstatfs64 51 - -51
fd_statfs 60 - -60
statfs_by_dentry 68 - -68
user_statfs 93 - -93
SYSC_ustat 105 - -105
vfs_statfs 128 - -128
do_statfs_native 230 - -230

Signed-off-by: Iulia Manda <iulia....@gmail.com>
---
Changes since v1:
- fix other function calls dependencies on the present changes

arch/alpha/Kconfig | 1 +
arch/parisc/Kconfig | 1 +
fs/Makefile | 3 ++-
fs/cachefiles/Kconfig | 1 +
fs/compat.c | 2 ++
fs/nfsd/Kconfig | 1 +
fs/overlayfs/Kconfig | 1 +
init/Kconfig | 9 +++++++++
kernel/sys_ni.c | 10 ++++++++++
9 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index b7ff9a3..5dea7cb 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -27,6 +27,7 @@ config ALPHA
select MODULES_USE_ELF_RELA
select ODD_RT_SIGACTION
select OLD_SIGSUSPEND
+ select STATFS
help
The Alpha is a 64-bit general-purpose processor designed and
marketed by the Digital Equipment Corporation of blessed memory,
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 1554a6f..849a384 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -293,6 +293,7 @@ config AUDIT_ARCH

config HPUX
bool "Support for HP-UX binaries"
+ select STATFS
depends on !64BIT

config NR_CPUS
diff --git a/fs/Makefile b/fs/Makefile
index bedff48..d12a3e8 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -11,7 +11,7 @@ obj-y := open.o read_write.o file_table.o super.o \
attr.o bad_inode.o file.o filesystems.o namespace.o \
seq_file.o xattr.o libfs.o fs-writeback.o \
pnode.o splice.o sync.o utimes.o \
- stack.o fs_struct.o statfs.o fs_pin.o nsfs.o
+ stack.o fs_struct.o fs_pin.o nsfs.o

ifeq ($(CONFIG_BLOCK),y)
obj-y += buffer.o block_dev.o direct-io.o mpage.o
@@ -20,6 +20,7 @@ obj-y += no-block.o
endif

obj-$(CONFIG_PROC_FS) += proc_namespace.o
+obj-$(CONFIG_STATFS) += statfs.o

obj-y += notify/
obj-$(CONFIG_EPOLL) += eventpoll.o
diff --git a/fs/cachefiles/Kconfig b/fs/cachefiles/Kconfig
index 80e9c61..151ead9 100644
--- a/fs/cachefiles/Kconfig
+++ b/fs/cachefiles/Kconfig
@@ -2,6 +2,7 @@
config CACHEFILES
tristate "Filesystem caching on files"
depends on FSCACHE && BLOCK
+ select STATFS
help
This permits use of a mounted filesystem as a cache for other
filesystems - primarily networking filesystems - thus allowing fast
diff --git a/fs/compat.c b/fs/compat.c
index 6fd272d..adbebae 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -209,6 +209,7 @@ COMPAT_SYSCALL_DEFINE2(newfstat, unsigned int, fd,
return error;
}

+#ifdef CONFIG_STATFS
static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *kbuf)
{

@@ -346,6 +347,7 @@ COMPAT_SYSCALL_DEFINE2(ustat, unsigned, dev, struct compat_ustat __user *, u)
return -EFAULT;
return 0;
}
+#endif

static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
{
diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig
index 7339515..83a5c47 100644
--- a/fs/nfsd/Kconfig
+++ b/fs/nfsd/Kconfig
@@ -6,6 +6,7 @@ config NFSD
select SUNRPC
select EXPORTFS
select NFS_ACL_SUPPORT if NFSD_V2_ACL
+ select STATFS
help
Choose Y here if you want to allow other computers to access
files residing on this system using Sun's Network File System
diff --git a/fs/overlayfs/Kconfig b/fs/overlayfs/Kconfig
index 3435581..dc14388 100644
--- a/fs/overlayfs/Kconfig
+++ b/fs/overlayfs/Kconfig
@@ -1,5 +1,6 @@
config OVERLAY_FS
tristate "Overlay filesystem support"
+ select STATFS
help
An overlay filesystem combines two filesystems - an 'upper' filesystem
and a 'lower' filesystem. When a name exists in both filesystems, the
diff --git a/init/Kconfig b/init/Kconfig
index 9afb971..2314905 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -394,6 +394,7 @@ endchoice

config BSD_PROCESS_ACCT
bool "BSD Process Accounting"
+ select STATFS
help
If you say Y here, a user level program will be able to instruct the
kernel (via a special system call) to write process accounting
@@ -1541,6 +1542,14 @@ config SHMEM
option replaces shmem and tmpfs with the much simpler ramfs code,
which may be appropriate on small systems without swap.

+config STATFS
+ bool "Enable statfs syscalls" if EXPERT
+ default y
+ help
+ This option enables statfs syscalls, used to get filesystem
+ statistics. If building an embedded system where no applications
+ use these syscalls, you can disable this option to save space.
+
config AIO
bool "Enable AIO support" if EXPERT
default y
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 5adcb0a..a622ce3 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -159,6 +159,16 @@ cond_syscall(sys_uselib);
cond_syscall(sys_fadvise64);
cond_syscall(sys_fadvise64_64);
cond_syscall(sys_madvise);
+cond_syscall(sys_ustat);
+cond_syscall(sys_statfs);
+cond_syscall(sys_fstatfs);
+cond_syscall(sys_statfs64);
+cond_syscall(sys_fstatfs64);
+cond_syscall(compat_sys_ustat);
+cond_syscall(compat_sys_statfs);
+cond_syscall(compat_sys_fstatfs);
+cond_syscall(compat_sys_statfs64);
+cond_syscall(compat_sys_fstatfs64);

/* arch-specific weak syscall entries */
cond_syscall(sys_pciconfig_read);
--
1.7.10.4

Reply all
Reply to author
Forward
0 new messages