Skip to contentSkip to conversation

e4defrag: Use blk64_t instead of ext4_fsblk_t

PATCH RESEND Superseded Kazuya Mio 2 participants 2 messages Jun 15, 2011 – Jun 16, 2011

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Kazuya Mio

author
#0 lore raw

PATCH RESEND 8/11 e4defrag: Use blk64_t instead of ext4_fsblk_t

e2fsprogs has blk64_t defined for the physical block number. e4defrag uses it instead of ext4_fsblk_t.

---
 misc/e4defrag.c |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
misc/e4defrag.c +8 -11
index ba0d424..6365103 100644
@@ -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;
#1 lore raw
Quoted 2 lines · Kazuya Mio

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.

Quoted 78 lines

---
misc/e4defrag.c | 19 ++++++++-----------

1 file changed, 8 insertions(+), 11 deletions(-)
misc/e4defrag.c +8 -12
index ba0d424..6365103 100644
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html