linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, Dave Chinner <dchinner@redhat.com>
Subject: [PATCH 07/10] xfs_db: use precomputed inode geometry values
Date: Tue, 03 Sep 2019 21:37:53 -0700	[thread overview]
Message-ID: <156757187309.1838441.9204486319983263288.stgit@magnolia> (raw)
In-Reply-To: <156757182283.1838441.193482978701233436.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Use the precomputed inode geometry values instead of open-coding them.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
---
 db/inode.c      |    8 +++-----
 repair/dinode.c |    2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)


diff --git a/db/inode.c b/db/inode.c
index 73dd118d..d8d69ffb 100644
--- a/db/inode.c
+++ b/db/inode.c
@@ -657,16 +657,14 @@ set_cur_inode(
 	    igeo->inoalign_mask) {
 		xfs_agblock_t	chunk_agbno;
 		xfs_agblock_t	offset_agbno;
-		int		blks_per_cluster;
 
-		blks_per_cluster = igeo->inode_cluster_size >>
-							mp->m_sb.sb_blocklog;
 		offset_agbno = agbno & igeo->inoalign_mask;
 		chunk_agbno = agbno - offset_agbno;
 		cluster_agbno = chunk_agbno +
-			((offset_agbno / blks_per_cluster) * blks_per_cluster);
+			((offset_agbno / M_IGEO(mp)->blocks_per_cluster) *
+			 M_IGEO(mp)->blocks_per_cluster);
 		offset += ((agbno - cluster_agbno) * mp->m_sb.sb_inopblock);
-		numblks = XFS_FSB_TO_BB(mp, blks_per_cluster);
+		numblks = XFS_FSB_TO_BB(mp, M_IGEO(mp)->blocks_per_cluster);
 	} else
 		cluster_agbno = agbno;
 
diff --git a/repair/dinode.c b/repair/dinode.c
index 56992dd2..f5e88cc3 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -768,7 +768,7 @@ get_agino_buf(
 	 * we must find the buffer for its cluster, add the appropriate
 	 * offset, and return that.
 	 */
-	cluster_size = max(igeo->inode_cluster_size, mp->m_sb.sb_blocksize);
+	cluster_size = igeo->inode_cluster_size;
 	ino_per_cluster = cluster_size / mp->m_sb.sb_inodesize;
 	cluster_agino = agino & ~(ino_per_cluster - 1);
 	cluster_blks = XFS_FSB_TO_DADDR(mp, max(1,


  parent reply	other threads:[~2019-09-04  4:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04  4:37 [PATCH v2 00/10] xfsprogs-5.3: various fixes Darrick J. Wong
2019-09-04  4:37 ` [PATCH 01/10] man: document the new v5 fs geometry ioctl structures Darrick J. Wong
2019-09-09 18:24   ` Eric Sandeen
2019-09-04  4:37 ` [PATCH 02/10] man: document new fs summary counter scrub command Darrick J. Wong
2019-09-09 18:25   ` Eric Sandeen
2019-09-04  4:37 ` [PATCH 03/10] man: document the new allocation group geometry ioctl Darrick J. Wong
2019-09-09 18:51   ` Eric Sandeen
2019-09-04  4:37 ` [PATCH 04/10] man: document the new health reporting fields in various ioctls Darrick J. Wong
2019-09-09 19:19   ` Eric Sandeen
2019-09-16 15:17     ` Darrick J. Wong
2019-09-04  4:37 ` [PATCH 05/10] xfs_db: remove db/convert.h Darrick J. Wong
2019-09-09 19:24   ` Eric Sandeen
2019-09-04  4:37 ` [PATCH 06/10] xfs_db: add a function to compute btree geometry Darrick J. Wong
2019-09-04  4:37 ` Darrick J. Wong [this message]
2019-09-04  4:37 ` [PATCH 08/10] xfs_repair: use precomputed inode geometry values Darrick J. Wong
2019-09-04  4:38 ` [PATCH 09/10] xfs_repair: reduce the amount of "clearing reflink flag" messages Darrick J. Wong
2019-09-04  4:38 ` [PATCH 10/10] xfs_repair: add AG btree rmaps into the filesystem after syncing sb Darrick J. Wong
2019-09-09 19:28   ` Eric Sandeen

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=156757187309.1838441.9204486319983263288.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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).