linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e4defrag: remove local sync_file_range and fallocate
@ 2014-01-07  8:29 Baruch Siach
  2014-01-20  7:31 ` Baruch Siach
  2014-02-19  1:05 ` Theodore Ts'o
  0 siblings, 2 replies; 4+ messages in thread
From: Baruch Siach @ 2014-01-07  8:29 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4, Baruch Siach

The locally defined versions of both sync_file_range and fallocate are broken
on 32bit systems. On these systems two 32bit registers are needed for each
64bit parameter. Also, sync_file_range on MIPS32 needs a dummy parameters
after the fd parameter. Just leave all these subtleties to the C library.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 misc/e4defrag.c | 50 +++-----------------------------------------------
 1 file changed, 3 insertions(+), 47 deletions(-)

diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index c2695e825d6b..620f4e7981c8 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -39,7 +39,6 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/statfs.h>
-#include <sys/syscall.h>
 #include <sys/vfs.h>
 
 /* A relatively new ioctl interface ... */
@@ -194,56 +193,13 @@ static struct frag_statistic_ino	frag_rank[SHOW_FRAG_FILES];
 #error posix_fadvise not available!
 #endif
 
-/*
- * Local definitions of some syscalls glibc may not yet have
- */
 #ifndef HAVE_SYNC_FILE_RANGE
-#warning Using locally defined sync_file_range interface.
-
-#ifndef __NR_sync_file_range
-#ifndef __NR_sync_file_range2 /* ppc */
-#error Your kernel headers dont define __NR_sync_file_range
-#endif
-#endif
-
-/*
- * sync_file_range() -	Sync file region.
- *
- * @fd:			defrag target file's descriptor.
- * @offset:		file offset.
- * @length:		area length.
- * @flag:		process flag.
- */
-int sync_file_range(int fd, loff_t offset, loff_t length, unsigned int flag)
-{
-#ifdef __NR_sync_file_range
-	return syscall(__NR_sync_file_range, fd, offset, length, flag);
-#else
-	return syscall(__NR_sync_file_range2, fd, flag, offset, length);
-#endif
-}
+#error sync_file_range not available!
 #endif /* ! HAVE_SYNC_FILE_RANGE */
 
 #ifndef HAVE_FALLOCATE64
-#warning Using locally defined fallocate syscall interface.
-
-#ifndef __NR_fallocate
-#error Your kernel headers dont define __NR_fallocate
-#endif

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

* Re: [PATCH] e4defrag: remove local sync_file_range and fallocate
  2014-01-07  8:29 [PATCH] e4defrag: remove local sync_file_range and fallocate Baruch Siach
@ 2014-01-20  7:31 ` Baruch Siach
  2014-01-31  5:29   ` Baruch Siach
  2014-02-19  1:05 ` Theodore Ts'o
  1 sibling, 1 reply; 4+ messages in thread
From: Baruch Siach @ 2014-01-20  7:31 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4

Hi Ted,

On Tue, Jan 07, 2014 at 10:29:52AM +0200, Baruch Siach wrote:
> The locally defined versions of both sync_file_range and fallocate are broken
> on 32bit systems. On these systems two 32bit registers are needed for each
> 64bit parameter. Also, sync_file_range on MIPS32 needs a dummy parameters
> after the fd parameter. Just leave all these subtleties to the C library.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Ping? Any alternatives?

baruch

> ---
>  misc/e4defrag.c | 50 +++-----------------------------------------------
>  1 file changed, 3 insertions(+), 47 deletions(-)
> 
> diff --git a/misc/e4defrag.c b/misc/e4defrag.c
> index c2695e825d6b..620f4e7981c8 100644
> --- a/misc/e4defrag.c
> +++ b/misc/e4defrag.c
> @@ -39,7 +39,6 @@
>  #include <sys/mman.h>
>  #include <sys/stat.h>
>  #include <sys/statfs.h>
> -#include <sys/syscall.h>
>  #include <sys/vfs.h>
>  
>  /* A relatively new ioctl interface ... */
> @@ -194,56 +193,13 @@ static struct frag_statistic_ino	frag_rank[SHOW_FRAG_FILES];
>  #error posix_fadvise not available!
>  #endif
>  
> -/*
> - * Local definitions of some syscalls glibc may not yet have
> - */
>  #ifndef HAVE_SYNC_FILE_RANGE
> -#warning Using locally defined sync_file_range interface.
> -
> -#ifndef __NR_sync_file_range
> -#ifndef __NR_sync_file_range2 /* ppc */
> -#error Your kernel headers dont define __NR_sync_file_range
> -#endif
> -#endif
> -
> -/*
> - * sync_file_range() -	Sync file region.
> - *
> - * @fd:			defrag target file's descriptor.
> - * @offset:		file offset.
> - * @length:		area length.
> - * @flag:		process flag.
> - */
> -int sync_file_range(int fd, loff_t offset, loff_t length, unsigned int flag)
> -{
> -#ifdef __NR_sync_file_range
> -	return syscall(__NR_sync_file_range, fd, offset, length, flag);
> -#else
> -	return syscall(__NR_sync_file_range2, fd, flag, offset, length);
> -#endif
> -}
> +#error sync_file_range not available!
>  #endif /* ! HAVE_SYNC_FILE_RANGE */
>  
>  #ifndef HAVE_FALLOCATE64
> -#warning Using locally defined fallocate syscall interface.
> -
> -#ifndef __NR_fallocate
> -#error Your kernel headers dont define __NR_fallocate
> -#endif
> -
> -/*
> - * fallocate64() -	Manipulate file space.
> - *
> - * @fd:			defrag target file's descriptor.
> - * @mode:		process flag.
> - * @offset:		file offset.
> - * @len:		file size.
> - */
> -static int fallocate64(int fd, int mode, loff_t offset, loff_t len)
> -{
> -	return syscall(__NR_fallocate, fd, mode, offset, len);
> -}
> -#endif /* ! HAVE_FALLOCATE */
> +#error fallocate64 not available!
> +#endif /* ! HAVE_FALLOCATE64 */
>  
>  /*
>   * get_mount_point() -	Get device's mount point.
> -- 
> 1.8.5.2
> 

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

* Re: [PATCH] e4defrag: remove local sync_file_range and fallocate
  2014-01-20  7:31 ` Baruch Siach
@ 2014-01-31  5:29   ` Baruch Siach
  0 siblings, 0 replies; 4+ messages in thread
From: Baruch Siach @ 2014-01-31  5:29 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4

Hi Ted,

On Mon, Jan 20, 2014 at 09:31:23AM +0200, Baruch Siach wrote:
> On Tue, Jan 07, 2014 at 10:29:52AM +0200, Baruch Siach wrote:
> > The locally defined versions of both sync_file_range and fallocate are broken
> > on 32bit systems. On these systems two 32bit registers are needed for each
> > 64bit parameter. Also, sync_file_range on MIPS32 needs a dummy parameters
> > after the fd parameter. Just leave all these subtleties to the C library.
> > 
> > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> 
> Ping? Any alternatives?

Just one last reminder.

baruch

> > ---
> >  misc/e4defrag.c | 50 +++-----------------------------------------------
> >  1 file changed, 3 insertions(+), 47 deletions(-)
> > 
> > diff --git a/misc/e4defrag.c b/misc/e4defrag.c
> > index c2695e825d6b..620f4e7981c8 100644
> > --- a/misc/e4defrag.c
> > +++ b/misc/e4defrag.c
> > @@ -39,7 +39,6 @@
> >  #include <sys/mman.h>
> >  #include <sys/stat.h>
> >  #include <sys/statfs.h>
> > -#include <sys/syscall.h>
> >  #include <sys/vfs.h>
> >  
> >  /* A relatively new ioctl interface ... */
> > @@ -194,56 +193,13 @@ static struct frag_statistic_ino	frag_rank[SHOW_FRAG_FILES];
> >  #error posix_fadvise not available!
> >  #endif
> >  
> > -/*
> > - * Local definitions of some syscalls glibc may not yet have
> > - */
> >  #ifndef HAVE_SYNC_FILE_RANGE
> > -#warning Using locally defined sync_file_range interface.
> > -
> > -#ifndef __NR_sync_file_range
> > -#ifndef __NR_sync_file_range2 /* ppc */
> > -#error Your kernel headers dont define __NR_sync_file_range
> > -#endif
> > -#endif
> > -
> > -/*
> > - * sync_file_range() -	Sync file region.
> > - *
> > - * @fd:			defrag target file's descriptor.
> > - * @offset:		file offset.
> > - * @length:		area length.
> > - * @flag:		process flag.
> > - */
> > -int sync_file_range(int fd, loff_t offset, loff_t length, unsigned int flag)
> > -{
> > -#ifdef __NR_sync_file_range
> > -	return syscall(__NR_sync_file_range, fd, offset, length, flag);
> > -#else
> > -	return syscall(__NR_sync_file_range2, fd, flag, offset, length);
> > -#endif
> > -}
> > +#error sync_file_range not available!
> >  #endif /* ! HAVE_SYNC_FILE_RANGE */
> >  
> >  #ifndef HAVE_FALLOCATE64
> > -#warning Using locally defined fallocate syscall interface.
> > -
> > -#ifndef __NR_fallocate
> > -#error Your kernel headers dont define __NR_fallocate
> > -#endif
> > -
> > -/*
> > - * fallocate64() -	Manipulate file space.
> > - *
> > - * @fd:			defrag target file's descriptor.
> > - * @mode:		process flag.
> > - * @offset:		file offset.
> > - * @len:		file size.
> > - */
> > -static int fallocate64(int fd, int mode, loff_t offset, loff_t len)
> > -{
> > -	return syscall(__NR_fallocate, fd, mode, offset, len);
> > -}
> > -#endif /* ! HAVE_FALLOCATE */
> > +#error fallocate64 not available!
> > +#endif /* ! HAVE_FALLOCATE64 */
> >  
> >  /*
> >   * get_mount_point() -	Get device's mount point.
> > -- 
> > 1.8.5.2

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

* Re: [PATCH] e4defrag: remove local sync_file_range and fallocate
  2014-01-07  8:29 [PATCH] e4defrag: remove local sync_file_range and fallocate Baruch Siach
  2014-01-20  7:31 ` Baruch Siach
@ 2014-02-19  1:05 ` Theodore Ts'o
  1 sibling, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2014-02-19  1:05 UTC (permalink / raw)
  To: Baruch Siach; +Cc: linux-ext4

On Tue, Jan 07, 2014 at 10:29:52AM +0200, Baruch Siach wrote:
> The locally defined versions of both sync_file_range and fallocate are broken
> on 32bit systems. On these systems two 32bit registers are needed for each
> 64bit parameter. Also, sync_file_range on MIPS32 needs a dummy parameters
> after the fd parameter. Just leave all these subtleties to the C library.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Thanks, applied.

Apologies for the delay.

						- Ted

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

end of thread, other threads:[~2014-02-19  1:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07  8:29 [PATCH] e4defrag: remove local sync_file_range and fallocate Baruch Siach
2014-01-20  7:31 ` Baruch Siach
2014-01-31  5:29   ` Baruch Siach
2014-02-19  1:05 ` Theodore Ts'o

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