From 2f7fb681aafc846937c9339a34054430ff6bdec5 Mon Sep 17 00:00:00 2001 From: Xiaole He Date: Tue, 13 Dec 2022 00:08:05 +0800 Subject: [PATCH] xfs_db: use preferable macro to seek offset for local dir3 entry fields Backport from xfs kernel git repository: This fix has already been merged into xfs kernel git repository: Link: https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/?id=d878935dd9af126801d499afd9c6c1224797eeee And the original discussion for this patch can be found: Link: https://marc.info/?l=linux-xfs&m=166178369302374&w=2 Signed-off-by: Xiaole He --- ...rable-macro-to-seek-offset-for-local.patch | 63 +++++++++++++++++++ xfsprogs.spec | 6 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 0005-xfs_db-use-preferable-macro-to-seek-offset-for-local.patch diff --git a/0005-xfs_db-use-preferable-macro-to-seek-offset-for-local.patch b/0005-xfs_db-use-preferable-macro-to-seek-offset-for-local.patch new file mode 100644 index 0000000..c987400 --- /dev/null +++ b/0005-xfs_db-use-preferable-macro-to-seek-offset-for-local.patch @@ -0,0 +1,63 @@ +From 51b2f6c6a9ac5d1294d36d2d826914e8e2fbfe06 Mon Sep 17 00:00:00 2001 +From: Xiaole He +Date: Mon, 29 Aug 2022 17:50:25 +0800 +Subject: [PATCH] xfs_db: use preferable macro to seek offset for local dir3 + entry fields + +In 'xfsprogs-dev' source: + +/* db/dir2sf.c begin */ + #define EOFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f)) +const field_t dir2_sf_entry_flds[] = { + { "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE }, +... + #define E3OFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f)) +const field_t dir3_sf_entry_flds[] = { + { "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE }, +... +/* db/dir2sf.c end */ + +The macro definitions of 'EOFF' and 'E3OFF' are same, so no matter to +use either to seek field offset in 'dir3_sf_entry_flds'. +But it seems the intent of defining 'E3OFF' macro is to be used in +'dir3_sf_entry_flds', and 'E3OFF' macro has not been used at any place +of the 'xfsprogs-dev' source: + +/* command begin */ +$ grep -r E3OFF /path/to/xfsprogs-dev/git/repository/ +./db/dir2sf.c:#define E3OFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f)) +$ +/* command end */ + +Above command shows the 'E3OFF' is only been defined but nerver been +used, that is weird, so there has reason to suspect using 'EOFF' +rather than 'E3OFF' in 'dir3_sf_entry_flds' is a typo, this patch fix +it, there has no logical change in this commit at all. + +Signed-off-by: Xiaole He +Reviewed-by: Darrick J. Wong +Signed-off-by: Carlos Maiolino +--- + db/dir2sf.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/db/dir2sf.c b/db/dir2sf.c +index 8165b79..9f1880d 100644 +--- a/db/dir2sf.c ++++ b/db/dir2sf.c +@@ -246,9 +246,9 @@ const field_t dir3sf_flds[] = { + + #define E3OFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f)) + const field_t dir3_sf_entry_flds[] = { +- { "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE }, +- { "offset", FLDT_DIR2_SF_OFF, OI(EOFF(offset)), C1, 0, TYP_NONE }, +- { "name", FLDT_CHARNS, OI(EOFF(name)), dir2_sf_entry_name_count, ++ { "namelen", FLDT_UINT8D, OI(E3OFF(namelen)), C1, 0, TYP_NONE }, ++ { "offset", FLDT_DIR2_SF_OFF, OI(E3OFF(offset)), C1, 0, TYP_NONE }, ++ { "name", FLDT_CHARNS, OI(E3OFF(name)), dir2_sf_entry_name_count, + FLD_COUNT, TYP_NONE }, + { "inumber", FLDT_DIR2_INOU, dir3_sf_entry_inumber_offset, C1, + FLD_OFFSET, TYP_NONE }, +-- +2.27.0 + diff --git a/xfsprogs.spec b/xfsprogs.spec index f686bcb..dfd1694 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 5.14.1 -Release: 6 +Release: 7 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -22,6 +22,7 @@ Patch1: 0001-xfs-correct-nlink-printf-specifier-from-hd-to-PRIu32.patch Patch2: 0002-libxfs-fix-inode-reservation-space-for-removing-tran.patch Patch3: 0003-mkfs-prevent-corruption-of-passed-in-suboption-strin.patch Patch4: 0004-xfsprogs-Add-sw64-architecture.patch +Patch5: 0005-xfs_db-use-preferable-macro-to-seek-offset-for-local.patch %description xfsprogs are the userspace utilities that manage XFS filesystems. @@ -105,6 +106,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Tue Dec 13 2022 Xiaole He - 5.14.1-7 +- add Patch5: xfs_db: use preferable macro to seek offset for local dir3 entry fields + * Wed Oct 26 2022 wuzx - 5.14.1-6 - Add sw64 architecture -- Gitee