All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 3/5] xfs: hide inode geometry calculation helpers
Date: Mon, 03 Jun 2019 15:51:18 -0700	[thread overview]
Message-ID: <155960227849.1194435.1190279904778498264.stgit@magnolia> (raw)
In-Reply-To: <155960225918.1194435.11314723160642989835.stgit@magnolia>

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

Hide all the inode geometry calculation helper functions since we now
cache all that in memory.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/libxfs/xfs_ialloc.c |   23 +++++++++++++----------
 fs/xfs/libxfs/xfs_ialloc.h |   11 -----------
 2 files changed, 13 insertions(+), 21 deletions(-)


diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 81d33ba10619..cff202d0ee4a 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -31,16 +31,23 @@
 #include "xfs_log.h"
 #include "xfs_rmap.h"
 
+/* Calculate and return the number of filesystem blocks per inode cluster */
+static inline int
+xfs_icluster_size_fsb(
+	struct xfs_mount	*mp)
+{
+	if (mp->m_sb.sb_blocksize >= M_IGEO(mp)->inode_cluster_size)
+		return 1;
+	return M_IGEO(mp)->inode_cluster_size >> mp->m_sb.sb_blocklog;
+}
 
-/*
- * Allocation group level functions.
- */
-int
+/* Compute the required inode cluster alignment. */
+static inline int
 xfs_ialloc_cluster_alignment(
 	struct xfs_mount	*mp)
 {
 	if (xfs_sb_version_hasalign(&mp->m_sb) &&
-	    mp->m_sb.sb_inoalignmt >= xfs_icluster_size_fsb(mp))
+	    mp->m_sb.sb_inoalignmt >= M_IGEO(mp)->blocks_per_cluster)
 		return mp->m_sb.sb_inoalignmt;
 	return 1;
 }
@@ -2819,11 +2826,7 @@ xfs_ialloc_setup_geometry(
 			igeo->cluster_align);
 
 	/* Set whether we're using inode alignment. */
-	if (xfs_sb_version_hasalign(&mp->m_sb) &&
-		mp->m_sb.sb_inoalignmt >= xfs_icluster_size_fsb(mp))
-		igeo->inoalign_mask = mp->m_sb.sb_inoalignmt - 1;
-	else
-		igeo->inoalign_mask = 0;
+	igeo->inoalign_mask = igeo->cluster_align - 1;
 
 	/*
 	 * If we are using stripe alignment, check whether
diff --git a/fs/xfs/libxfs/xfs_ialloc.h b/fs/xfs/libxfs/xfs_ialloc.h
index 455f65a2f1dd..2d61e0842f89 100644
--- a/fs/xfs/libxfs/xfs_ialloc.h
+++ b/fs/xfs/libxfs/xfs_ialloc.h
@@ -23,16 +23,6 @@ struct xfs_icluster {
 					 * sparse chunks */
 };
 
-/* Calculate and return the number of filesystem blocks per inode cluster */
-static inline int
-xfs_icluster_size_fsb(
-	struct xfs_mount	*mp)
-{
-	if (mp->m_sb.sb_blocksize >= M_IGEO(mp)->inode_cluster_size)
-		return 1;
-	return M_IGEO(mp)->inode_cluster_size >> mp->m_sb.sb_blocklog;
-}
-
 /*
  * Make an inode pointer out of the buffer/offset.
  */
@@ -160,7 +150,6 @@ int xfs_inobt_insert_rec(struct xfs_btree_cur *cur, uint16_t holemask,
 		uint8_t count, int32_t freecount, xfs_inofree_t free,
 		int *stat);
 
-int xfs_ialloc_cluster_alignment(struct xfs_mount *mp);
 void xfs_ialloc_setup_geometry(struct xfs_mount *mp);
 
 #endif	/* __XFS_IALLOC_H__ */

  parent reply	other threads:[~2019-06-03 22:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 22:50 [PATCH v2 0/5] xfs: refactor inode geometry Darrick J. Wong
2019-06-03 22:51 ` [PATCH 1/5] xfs: separate " Darrick J. Wong
2019-06-04  0:08   ` Dave Chinner
2019-06-03 22:51 ` [PATCH 2/5] xfs: refactor inode geometry setup routines Darrick J. Wong
2019-06-04  0:17   ` Dave Chinner
2019-06-04  0:56     ` Darrick J. Wong
2019-06-03 22:51 ` Darrick J. Wong [this message]
2019-06-03 22:51 ` [PATCH 4/5] xfs: fix inode_cluster_size rounding mayhem Darrick J. Wong
2019-06-04  0:25   ` Dave Chinner
2019-06-04  1:08     ` Darrick J. Wong
2019-06-03 22:51 ` [PATCH 5/5] xfs: finish converting to inodes_per_cluster Darrick J. Wong
2019-06-04  0:25   ` Dave Chinner

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=155960227849.1194435.1190279904778498264.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.