Whamcloud - gitweb
LU-11848 filefrag: rework port PFL and FLR file 89/40889/6
authorBobi Jam <bobijam@whamcloud.com>
Mon, 7 Dec 2020 08:57:10 +0000 (16:57 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 10 Dec 2020 08:43:04 +0000 (08:43 +0000)
Lustre uses the high 16bits of fiemap_extent:fe_device to record
the absolute stripe number is under process, so that next fiemap
call continues from that stripe.

Fixes: 0b6718f5e22d ("filefrag: support PFL and FLR file")
Change-Id: I111bcb100307aebacbffed99109057accdc27f5b
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/40889
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lib/ext2fs/fiemap.h
misc/filefrag.c

index 4df139d..5749dd1 100644 (file)
@@ -20,7 +20,7 @@ struct fiemap_extent {
        __u64 fe_reserved64[2];
        __u32 fe_flags;    /* FIEMAP_EXTENT_* flags for this extent */
        __u32 fe_device;   /* device number (fs-specific if FIEMAP_EXTENT_NET)
-                           * only use the low 16 bits */
+                           * low 16bits are used */
        __u32 fe_reserved[2];
 };
 
@@ -77,8 +77,6 @@ struct fiemap {
 #define FIEMAP_EXTENT_SHARED           0x00002000 /* Space shared with other
                                                    * files. */
 
-#define FIEMAP_EXTENT_DATA_MIRROR      0x40000000 /* indicate will start to
-                                                     map a new mirror */
 /* Network filesystem flags - use a high bit, don't conflict with upstream */
 #define FIEMAP_EXTENT_NET              0x80000000 /* Data stored remotely. */
 
index 84edfc7..12f05a4 100644 (file)
@@ -162,7 +162,6 @@ static void print_flags(__u32 fe_flags, char *flags, int print_unknown)
        print_flag(&fe_flags, FIEMAP_EXTENT_MERGED, flags, "merged,");
        print_flag(&fe_flags, FIEMAP_EXTENT_SHARED, flags, "shared,");
        print_flag(&fe_flags, FIEMAP_EXTENT_NET, flags, "net,");
-       print_flag(&fe_flags, FIEMAP_EXTENT_DATA_MIRROR, flags,"next_mirror");
 
        if (!print_unknown)
                return;
@@ -320,10 +319,6 @@ retry_wo_device_order:
                                                fm_ext[i - 1].fe_length;
                        fm_ext[0].fe_device &= 0xffff0000;
                        fm_ext[0].fe_device |= fm_ext[i - 1].fe_device & 0xffff;
-                       if (fm_ext[i - 1].fe_flags & FIEMAP_EXTENT_DATA_MIRROR) {
-                               fiemap->fm_start = 0;
-                               fm_ext[0].fe_logical = 0;
-                       }
                } else {
                        fiemap->fm_start =      fm_ext[i - 1].fe_logical +
                                                fm_ext[i - 1].fe_length;
@@ -351,8 +346,7 @@ static int filefrag_fibmap(int fd, int blk_shift, int *num_extents,
        memset(&fm_ext, 0, sizeof(fm_ext));
        memset(&fm_last, 0, sizeof(fm_last));
        if (force_extent) {
-               fm_ext.fe_device &= 0xffff0000;
-               fm_ext.fe_device |= st->st_dev;
+               fm_ext.fe_device = st->st_dev;
                fm_ext.fe_flags = FIEMAP_EXTENT_MERGED;
        }