Whamcloud - gitweb
LU-11848 filefrag: further PFL and FLR fixes 32/40932/3
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 10 Dec 2020 11:04:56 +0000 (04:04 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 10 Dec 2020 13:02:57 +0000 (13:02 +0000)
Revert some of the changes from the earlier patches to bring the
filefrag functionality closer to the original behavior.

The kernel is instead changed to return the device number with
every extent.  This allows the previous filefrag to work for PFL
and FLR files without any changes by just copying the fe_device
from the last returned extent to the next call.  The only gap in
old filefrag is that it prints the stripe number with OST index.

Fixes: d99d208e73cd ("LU-11848 filefrag: rework port PFL and FLR file")
Fixes: 0b6718f5e22d ("filefrag: support PFL and FLR file")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ie6a8d93ebceb1e70894b21f0dadc9655083ebbe5
Reviewed-on: https://review.whamcloud.com/40932
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
misc/filefrag.c

index 12f05a4..c0e815c 100644 (file)
@@ -304,9 +304,7 @@ retry_wo_device_order:
                                last = 1;
                        fm_last = fm_ext[i];
                        n++;
-                       if (previous_device != (fm_ext[i].fe_device & 0xffff))
-                               previous_device = fm_ext[i].fe_device & 0xffff;
-
+                       previous_device = fm_ext[i].fe_device & 0xffff;
                }
 
                /* For DEVICE_ORDER mappings, if EXTENT_LAST not yet found then
@@ -317,8 +315,8 @@ retry_wo_device_order:
                if (flags & FIEMAP_FLAG_DEVICE_ORDER) {
                        fm_ext[0].fe_logical =  fm_ext[i - 1].fe_logical +
                                                fm_ext[i - 1].fe_length;
-                       fm_ext[0].fe_device &= 0xffff0000;
-                       fm_ext[0].fe_device |= fm_ext[i - 1].fe_device & 0xffff;
+                       fm_ext[0].fe_device =   fm_ext[i - 1].fe_device;
+                       fiemap->fm_start =      0;
                } else {
                        fiemap->fm_start =      fm_ext[i - 1].fe_logical +
                                                fm_ext[i - 1].fe_length;