Patchwork [08/11,RESEND] e4defrag: Use blk64_t instead of ext4_fsblk_t

login
register
mail settings
Submitter Kazuya Mio
Date June 15, 2011, 6:37 a.m.
Message ID <4DF85313.7000404@sx.jp.nec.com>
Download mbox | patch
Permalink /patch/100486/
State Superseded
Headers show

Comments

Kazuya Mio - June 15, 2011, 6:37 a.m.
e2fsprogs has blk64_t defined for the physical block number. e4defrag uses it
instead of ext4_fsblk_t.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
---
 misc/e4defrag.c |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Dilger - June 16, 2011, 3:19 a.m.
On 2011-06-15, at 12:37 AM, Kazuya Mio <k-mio@sx.jp.nec.com> wrote:
> e2fsprogs has blk64_t defined for the physical block number. e4defrag uses it
> instead of ext4_fsblk_t.

On a related note, I'd like to make a patch to e2fsprogs to make the type names consistent with the kernel.

> Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
> ---
> misc/e4defrag.c |   19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
> diff --git a/misc/e4defrag.c b/misc/e4defrag.c
> index ba0d424..6365103 100644
> --- a/misc/e4defrag.c
> +++ b/misc/e4defrag.c
> @@ -41,6 +41,7 @@
> 
> #include "e2p/e2p.h"
> #include "ext2fs/ext2_types.h"
> +#include "ext2fs/ext2fs.h"
> #include "ext2fs/fiemap.h"
> 
> /* A relatively new ioctl interface ... */
> @@ -111,13 +112,10 @@
> #define NGMSG_LOST_FOUND    "Can not process \"lost+found\""
> #define NGMSG_EXT_FORMAT    "File is not extent format"
> 
> -/* Data type for filesystem-wide blocks number */
> -typedef unsigned long long ext4_fsblk_t;
> -
> struct fiemap_extent_data {
>    __u64 len;            /* blocks count */
>    __u64 logical;        /* start logical block number */
> -    ext4_fsblk_t physical;        /* start physical block number */
> +    blk64_t physical;        /* start physical block number */
> };
> 
> struct fiemap_extent_list {
> @@ -461,9 +459,9 @@ static int defrag_fadvise(int fd, struct move_extent defrag_data,
>  * @file:        file name.
>  * @blk_count:        file blocks.
>  */
> -static int check_free_size(int fd, const char *file, ext4_fsblk_t blk_count)
> +static int check_free_size(int fd, const char *file, blk64_t blk_count)
> {
> -    ext4_fsblk_t    free_blk_count;
> +    blk64_t        free_blk_count;
>    struct statfs64    fsbuf;
>    uid_t        current_uid = getuid();
> 
> @@ -521,8 +519,7 @@ static int file_frag_count(int fd)
>  * @extents:        file extents.
>  * @blk_count:        file blocks.
>  */
> -static int file_check(int fd, const char *file, int extents,
> -                    ext4_fsblk_t blk_count)
> +static int file_check(int fd, const char *file, int extents, blk64_t blk_count)
> {
>    int    ret;
>    struct flock    lock;
> @@ -761,9 +758,9 @@ static int get_exts_count(struct fiemap_extent_list *ext_list_head)
>  *
>  * @ext_list_head:    the extent list head of the target file
>  */
> -static ext4_fsblk_t get_file_blocks(struct fiemap_extent_list *ext_list_head)
> +static blk64_t get_file_blocks(struct fiemap_extent_list *ext_list_head)
> {
> -    ext4_fsblk_t blk_count = 0;
> +    blk64_t blk_count = 0;
>    struct fiemap_extent_list *ext_list_tmp = ext_list_head;
> 
>    do {
> @@ -954,7 +951,7 @@ static int file_defrag(const char *file, const struct stat64 *buf,
>    int    file_frags_start, file_frags_end;
>    char    tmp_inode_name[PATH_MAX + 8];
>    size_t    threshold;
> -    ext4_fsblk_t            blk_count = 0;
> +    blk64_t                blk_count = 0;
>    struct fiemap_extent_list    *orig_list = NULL;
>    struct fiemap_extent_list    *donor_list = NULL;
>    struct fiemap_extent_group    *orig_group_head = NULL;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index ba0d424..6365103 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -41,6 +41,7 @@ 
 
 #include "e2p/e2p.h"
 #include "ext2fs/ext2_types.h"
+#include "ext2fs/ext2fs.h"
 #include "ext2fs/fiemap.h"
 
 /* A relatively new ioctl interface ... */
@@ -111,13 +112,10 @@ 
 #define NGMSG_LOST_FOUND	"Can not process \"lost+found\""
 #define NGMSG_EXT_FORMAT	"File is not extent format"
 
-/* Data type for filesystem-wide blocks number */
-typedef unsigned long long ext4_fsblk_t;
-
 struct fiemap_extent_data {
 	__u64 len;			/* blocks count */
 	__u64 logical;		/* start logical block number */
-	ext4_fsblk_t physical;		/* start physical block number */
+	blk64_t physical;		/* start physical block number */
 };
 
 struct fiemap_extent_list {
@@ -461,9 +459,9 @@  static int defrag_fadvise(int fd, struct move_extent defrag_data,
  * @file:		file name.
  * @blk_count:		file blocks.
  */
-static int check_free_size(int fd, const char *file, ext4_fsblk_t blk_count)
+static int check_free_size(int fd, const char *file, blk64_t blk_count)
 {
-	ext4_fsblk_t	free_blk_count;
+	blk64_t		free_blk_count;
 	struct statfs64	fsbuf;
 	uid_t		current_uid = getuid();
 
@@ -521,8 +519,7 @@  static int file_frag_count(int fd)
  * @extents:		file extents.
  * @blk_count:		file blocks.
  */
-static int file_check(int fd, const char *file, int extents,
-					ext4_fsblk_t blk_count)
+static int file_check(int fd, const char *file, int extents, blk64_t blk_count)
 {
 	int	ret;
 	struct flock	lock;
@@ -761,9 +758,9 @@  static int get_exts_count(struct fiemap_extent_list *ext_list_head)
  *
  * @ext_list_head:	the extent list head of the target file
  */
-static ext4_fsblk_t get_file_blocks(struct fiemap_extent_list *ext_list_head)
+static blk64_t get_file_blocks(struct fiemap_extent_list *ext_list_head)
 {
-	ext4_fsblk_t blk_count = 0;
+	blk64_t blk_count = 0;
 	struct fiemap_extent_list *ext_list_tmp = ext_list_head;
 
 	do {
@@ -954,7 +951,7 @@  static int file_defrag(const char *file, const struct stat64 *buf,
 	int	file_frags_start, file_frags_end;
 	char	tmp_inode_name[PATH_MAX + 8];
 	size_t	threshold;
-	ext4_fsblk_t			blk_count = 0;
+	blk64_t				blk_count = 0;
 	struct fiemap_extent_list	*orig_list = NULL;
 	struct fiemap_extent_list	*donor_list = NULL;
 	struct fiemap_extent_group	*orig_group_head = NULL;