From d99d208e73cd5b9c3edbc8fea3bb66875b706df7 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Mon, 7 Dec 2020 16:57:10 +0800 Subject: [PATCH] LU-11848 filefrag: rework port PFL and FLR file 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 Reviewed-on: https://review.whamcloud.com/40889 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lib/ext2fs/fiemap.h | 4 +--- misc/filefrag.c | 8 +------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/ext2fs/fiemap.h b/lib/ext2fs/fiemap.h index 4df139d..5749dd1 100644 --- a/lib/ext2fs/fiemap.h +++ b/lib/ext2fs/fiemap.h @@ -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. */ diff --git a/misc/filefrag.c b/misc/filefrag.c index 84edfc7..12f05a4 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -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; } -- 1.8.3.1