aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAmit Arora <aarora@in.ibm.com>2007-07-17 21:42:44 -0400
committerTheodore Ts'o <tytso@mit.edu>2007-07-17 21:42:44 -0400
commit97ac73506c0ba93f30239bb57b4cfc5d73e68a62 (patch)
tree4d02848d6c792a70b413deadcaffd7bf8c8d61de /arch
parentcb32da0416b823b7f4b65e7e85d6cba16ca4d1e1 (diff)
sys_fallocate() implementation on i386, x86_64 and powerpc
fallocate() is a new system call being proposed here which will allow applications to preallocate space to any file(s) in a file system. Each file system implementation that wants to use this feature will need to support an inode operation called ->fallocate(). Applications can use this feature to avoid fragmentation to certain level and thus get faster access speed. With preallocation, applications also get a guarantee of space for particular file(s) - even if later the the system becomes full. Currently, glibc provides an interface called posix_fallocate() which can be used for similar cause. Though this has the advantage of working on all file systems, but it is quite slow (since it writes zeroes to each block that has to be preallocated). Without a doubt, file systems can do this more efficiently within the kernel, by implementing the proposed fallocate() system call. It is expected that posix_fallocate() will be modified to call this new system call first and incase the kernel/filesystem does not implement it, it should fall back to the current implementation of writing zeroes to the new blocks. ToDos: 1. Implementation on other architectures (other than i386, x86_64, and ppc). Patches for s390(x) and ia64 are already available from previous posts, but it was decided that they should be added later once fallocate is in the mainline. Hence not including those patches in this take. 2. Changes to glibc, a) to support fallocate() system call b) to make posix_fallocate() and posix_fallocate64() call fallocate() Signed-off-by: Amit Arora <aarora@in.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/syscall_table.S1
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c7
-rw-r--r--arch/x86_64/ia32/ia32entry.S1
-rw-r--r--arch/x86_64/ia32/sys_ia32.c8
4 files changed, 17 insertions, 0 deletions
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index bf6adce52267..8344c70adf61 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -323,3 +323,4 @@ ENTRY(sys_call_table)
323 .long sys_signalfd 323 .long sys_signalfd
324 .long sys_timerfd 324 .long sys_timerfd
325 .long sys_eventfd 325 .long sys_eventfd
326 .long sys_fallocate
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index b42cbf1e2d7d..bd85b5fd08c8 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -773,6 +773,13 @@ asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4,
773 return sys_truncate(path, (high << 32) | low); 773 return sys_truncate(path, (high << 32) | low);
774} 774}
775 775
776asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo,
777 u32 lenhi, u32 lenlo)
778{
779 return sys_fallocate(fd, mode, ((loff_t)offhi << 32) | offlo,
780 ((loff_t)lenhi << 32) | lenlo);
781}
782
776asmlinkage int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long high, 783asmlinkage int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long high,
777 unsigned long low) 784 unsigned long low)
778{ 785{
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 782dea819438..3f66e970d86f 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -719,4 +719,5 @@ ia32_sys_call_table:
719 .quad compat_sys_signalfd 719 .quad compat_sys_signalfd
720 .quad compat_sys_timerfd 720 .quad compat_sys_timerfd
721 .quad sys_eventfd 721 .quad sys_eventfd
722 .quad sys32_fallocate
722ia32_syscall_end: 723ia32_syscall_end:
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index 99a78a3cce7c..bee96d614432 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -879,3 +879,11 @@ asmlinkage long sys32_fadvise64(int fd, unsigned offset_lo, unsigned offset_hi,
879 return sys_fadvise64_64(fd, ((u64)offset_hi << 32) | offset_lo, 879 return sys_fadvise64_64(fd, ((u64)offset_hi << 32) | offset_lo,
880 len, advice); 880 len, advice);
881} 881}
882
883asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_lo,
884 unsigned offset_hi, unsigned len_lo,
885 unsigned len_hi)
886{
887 return sys_fallocate(fd, mode, ((u64)offset_hi << 32) | offset_lo,
888 ((u64)len_hi << 32) | len_lo);
889}