From: Chandan Babu R <chandan.babu@oracle.com>
To: linux-xfs@vger.kernel.org
Cc: Chandan Babu R <chandan.babu@oracle.com>, djwong@kernel.org
Subject: [PATCH V3 08/16] xfsprogs: Rename inode's extent counter fields based on their width
Date: Thu, 16 Sep 2021 15:38:14 +0530 [thread overview]
Message-ID: <20210916100822.176306-9-chandan.babu@oracle.com> (raw)
In-Reply-To: <20210916100822.176306-1-chandan.babu@oracle.com>
This commit renames extent counter fields in "struct xfs_dinode" and "struct
xfs_log_dinode" based on the width of the fields. As of this commit, the
32-bit field will be used to count data fork extents and the 16-bit field will
be used to count attr fork extents.
This change is done to enable a future commit to introduce a new 64-bit extent
counter field.
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
---
db/inode.c | 4 ++--
libxfs/xfs_format.h | 8 ++++----
libxfs/xfs_inode_buf.c | 4 ++--
libxfs/xfs_log_format.h | 4 ++--
logprint/log_misc.c | 4 ++--
logprint/log_print_all.c | 2 +-
repair/bmap_repair.c | 4 ++--
repair/dinode.c | 6 +++---
8 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/db/inode.c b/db/inode.c
index c45ec1f7..33dfffd0 100644
--- a/db/inode.c
+++ b/db/inode.c
@@ -100,8 +100,8 @@ const field_t inode_core_flds[] = {
{ "size", FLDT_FSIZE, OI(COFF(size)), C1, 0, TYP_NONE },
{ "nblocks", FLDT_DRFSBNO, OI(COFF(nblocks)), C1, 0, TYP_NONE },
{ "extsize", FLDT_EXTLEN, OI(COFF(extsize)), C1, 0, TYP_NONE },
- { "nextents", FLDT_EXTNUM, OI(COFF(nextents)), C1, 0, TYP_NONE },
- { "naextents", FLDT_AEXTNUM, OI(COFF(anextents)), C1, 0, TYP_NONE },
+ { "nextents32", FLDT_EXTNUM, OI(COFF(nextents32)), C1, 0, TYP_NONE },
+ { "nextents16", FLDT_AEXTNUM, OI(COFF(nextents16)), C1, 0, TYP_NONE },
{ "forkoff", FLDT_UINT8D, OI(COFF(forkoff)), C1, 0, TYP_NONE },
{ "aformat", FLDT_DINODE_FMT, OI(COFF(aformat)), C1, 0, TYP_NONE },
{ "dmevmask", FLDT_UINT32X, OI(COFF(dmevmask)), C1, 0, TYP_NONE },
diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h
index 49e627ad..36c382e7 100644
--- a/libxfs/xfs_format.h
+++ b/libxfs/xfs_format.h
@@ -802,8 +802,8 @@ typedef struct xfs_dinode {
__be64 di_size; /* number of bytes in file */
__be64 di_nblocks; /* # of direct & btree blocks used */
__be32 di_extsize; /* basic/minimum extent size for file */
- __be32 di_nextents; /* number of extents in data fork */
- __be16 di_anextents; /* number of extents in attribute fork*/
+ __be32 di_nextents32; /* 32-bit extent counter */
+ __be16 di_nextents16; /* 16-bit extent counter */
__u8 di_forkoff; /* attr fork offs, <<3 for 64b align */
__s8 di_aformat; /* format of attr fork's data */
__be32 di_dmevmask; /* DMIG event mask */
@@ -940,11 +940,11 @@ xfs_dfork_nextents(
switch (whichfork) {
case XFS_DATA_FORK:
- *nextents = be32_to_cpu(dip->di_nextents);
+ *nextents = be32_to_cpu(dip->di_nextents32);
break;
case XFS_ATTR_FORK:
- *nextents = be16_to_cpu(dip->di_anextents);
+ *nextents = be16_to_cpu(dip->di_nextents16);
break;
default:
diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c
index 5ed923ae..5909bc26 100644
--- a/libxfs/xfs_inode_buf.c
+++ b/libxfs/xfs_inode_buf.c
@@ -310,8 +310,8 @@ xfs_inode_to_disk(
to->di_size = cpu_to_be64(ip->i_disk_size);
to->di_nblocks = cpu_to_be64(ip->i_nblocks);
to->di_extsize = cpu_to_be32(ip->i_extsize);
- to->di_nextents = cpu_to_be32(xfs_ifork_nextents(&ip->i_df));
- to->di_anextents = cpu_to_be16(xfs_ifork_nextents(ip->i_afp));
+ to->di_nextents32 = cpu_to_be32(xfs_ifork_nextents(&ip->i_df));
+ to->di_nextents16 = cpu_to_be16(xfs_ifork_nextents(ip->i_afp));
to->di_forkoff = ip->i_forkoff;
to->di_aformat = xfs_ifork_format(ip->i_afp);
to->di_flags = cpu_to_be16(ip->i_diflags);
diff --git a/libxfs/xfs_log_format.h b/libxfs/xfs_log_format.h
index bd711d24..9f352ff4 100644
--- a/libxfs/xfs_log_format.h
+++ b/libxfs/xfs_log_format.h
@@ -402,8 +402,8 @@ struct xfs_log_dinode {
xfs_fsize_t di_size; /* number of bytes in file */
xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */
xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
- xfs_extnum_t di_nextents; /* number of extents in data fork */
- xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/
+ uint32_t di_nextents32; /* number of extents in data fork */
+ uint16_t di_nextents16; /* number of extents in attribute fork*/
uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
int8_t di_aformat; /* format of attr fork's data */
uint32_t di_dmevmask; /* DMIG event mask */
diff --git a/logprint/log_misc.c b/logprint/log_misc.c
index c06fd233..4e8760c4 100644
--- a/logprint/log_misc.c
+++ b/logprint/log_misc.c
@@ -452,9 +452,9 @@ xlog_print_trans_inode_core(
xlog_extract_dinode_ts(ip->di_ctime));
printf(_("size 0x%llx nblocks 0x%llx extsize 0x%x nextents 0x%x\n"),
(unsigned long long)ip->di_size, (unsigned long long)ip->di_nblocks,
- ip->di_extsize, ip->di_nextents);
+ ip->di_extsize, ip->di_nextents32);
printf(_("naextents 0x%x forkoff %d dmevmask 0x%x dmstate 0x%hx\n"),
- ip->di_anextents, (int)ip->di_forkoff, ip->di_dmevmask,
+ ip->di_nextents16, (int)ip->di_forkoff, ip->di_dmevmask,
ip->di_dmstate);
printf(_("flags 0x%x gen 0x%x\n"),
ip->di_flags, ip->di_gen);
diff --git a/logprint/log_print_all.c b/logprint/log_print_all.c
index 37669372..403c5637 100644
--- a/logprint/log_print_all.c
+++ b/logprint/log_print_all.c
@@ -257,7 +257,7 @@ xlog_recover_print_inode_core(
printf(_(" size:0x%llx nblks:0x%llx exsize:%d "
"nextents:%d anextents:%d\n"), (unsigned long long)
di->di_size, (unsigned long long)di->di_nblocks,
- di->di_extsize, di->di_nextents, (int)di->di_anextents);
+ di->di_extsize, di->di_nextents32, (int)di->di_nextents16);
printf(_(" forkoff:%d dmevmask:0x%x dmstate:%d flags:0x%x "
"gen:%u\n"),
(int)di->di_forkoff, di->di_dmevmask, (int)di->di_dmstate,
diff --git a/repair/bmap_repair.c b/repair/bmap_repair.c
index adb798f7..847538b1 100644
--- a/repair/bmap_repair.c
+++ b/repair/bmap_repair.c
@@ -579,7 +579,7 @@ rebuild_bmap(
if (nextents == 0)
return 0;
(*dinop)->di_format = XFS_DINODE_FMT_EXTENTS;
- (*dinop)->di_nextents = 0;
+ (*dinop)->di_nextents32 = 0;
libxfs_dinode_calc_crc(mp, *dinop);
*dirty = 1;
break;
@@ -590,7 +590,7 @@ rebuild_bmap(
if (nextents == 0)
return 0;
(*dinop)->di_aformat = XFS_DINODE_FMT_EXTENTS;
- (*dinop)->di_anextents = 0;
+ (*dinop)->di_nextents16 = 0;
libxfs_dinode_calc_crc(mp, *dinop);
*dirty = 1;
break;
diff --git a/repair/dinode.c b/repair/dinode.c
index 46f82f64..4e95766e 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -78,7 +78,7 @@ _("would have cleared inode %" PRIu64 " attributes\n"), ino_num);
if (anextents != 0) {
if (no_modify)
return(1);
- dino->di_anextents = cpu_to_be16(0);
+ dino->di_nextents16 = cpu_to_be16(0);
}
if (dino->di_aformat != XFS_DINODE_FMT_EXTENTS) {
@@ -1872,7 +1872,7 @@ _("too many data fork extents (%" PRIu64 ") in inode %" PRIu64 "\n"),
do_warn(
_("correcting nextents for inode %" PRIu64 ", was %d - counted %" PRIu64 "\n"),
lino, dnextents, nextents);
- dino->di_nextents = cpu_to_be32(nextents);
+ dino->di_nextents32 = cpu_to_be32(nextents);
*dirty = 1;
} else {
do_warn(
@@ -1896,7 +1896,7 @@ _("too many attr fork extents (%" PRIu64 ") in inode %" PRIu64 "\n"),
do_warn(
_("correcting anextents for inode %" PRIu64 ", was %d - counted %" PRIu64 "\n"),
lino, dnextents, anextents);
- dino->di_anextents = cpu_to_be16(anextents);
+ dino->di_nextents16 = cpu_to_be16(anextents);
*dirty = 1;
} else {
do_warn(
--
2.30.2
next prev parent reply other threads:[~2021-09-16 10:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-16 10:08 [PATCH V3 00/16] xfsprogs: Extend per-inode extent counters Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 01/16] xfsprogs: xfs_repair: allow administrators to add older v5 features Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 02/16] xfsprogs: Move extent count limits to xfs_format.h Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 03/16] xfsprogs: Introduce xfs_iext_max_nextents() helper Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 04/16] xfsprogs: Rename MAXEXTNUM, MAXAEXTNUM to XFS_IFORK_EXTCNT_MAXS32, XFS_IFORK_EXTCNT_MAXS16 Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 05/16] xfsprogs: Use xfs_extnum_t instead of basic data types Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 06/16] xfsprogs: Introduce xfs_dfork_nextents() helper Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 07/16] xfsprogs: xfs_dfork_nextents: Return extent count via an out argument Chandan Babu R
2021-09-16 10:08 ` Chandan Babu R [this message]
2021-09-16 10:08 ` [PATCH V3 09/16] xfsprogs: Promote xfs_extnum_t and xfs_aextnum_t to 64 and 32-bits respectively Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 10/16] xfsprogs: Enable bulkstat ioctl to support 64-bit extent counters Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 11/16] xfsprogs: Extend per-inode extent counter widths Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 12/16] xfsprogs: xfs_info: Report NREXT64 feature status Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 13/16] xfsprogs: Add XFS_SB_FEAT_INCOMPAT_NREXT64 to XFS_SB_FEAT_INCOMPAT_ALL Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 14/16] xfsprogs: Add nrext64 mkfs option Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 15/16] xfsprogs: Add support for upgrading to NREXT64 feature Chandan Babu R
2021-09-16 10:08 ` [PATCH V3 16/16] xfsprogs: Define max extent length based on on-disk format definition Chandan Babu R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210916100822.176306-9-chandan.babu@oracle.com \
--to=chandan.babu@oracle.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).