All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: Use xfs_icluster_size_fsb() to calculate inode alignment mask
@ 2017-02-28  9:56 Chandan Rajendra
  2017-03-02 23:18 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Chandan Rajendra @ 2017-02-28  9:56 UTC (permalink / raw)
  To: linux-xfs; +Cc: Chandan Rajendra, darrick.wong, sandeen

When block size is larger than inode cluster size, the call to
XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size) returns 0. Also, mkfs.xfs
would have set xfs_sb->sb_inoalignmt to 0. Hence in
xfs_set_inoalignment(), xfs_mount->m_inoalign_mask gets initialized to
-1 instead of 0. However, xfs_mount->m_sinoalign would get correctly
intialized to 0 because for every positive value of xfs_mount->m_dalign,
the condition "!(mp->m_dalign & mp->m_inoalign_mask)" would evaluate to
false.

Also, xfs_imap() worked fine even with xfs_mount->m_inoalign_mask having
-1 as the value because blks_per_cluster variable would have the value 1
and hence we would never have a need to use xfs_mount->m_inoalign_mask
to compute the inode chunk's agbno and offset within the chunk.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
 fs/xfs/xfs_mount.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 450bde6..688ebff 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -513,8 +513,7 @@ STATIC void
 xfs_set_inoalignment(xfs_mount_t *mp)
 {
 	if (xfs_sb_version_hasalign(&mp->m_sb) &&
-	    mp->m_sb.sb_inoalignmt >=
-	    XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size))
+		mp->m_sb.sb_inoalignmt >= xfs_icluster_size_fsb(mp))
 		mp->m_inoalign_mask = mp->m_sb.sb_inoalignmt - 1;
 	else
 		mp->m_inoalign_mask = 0;
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: Use xfs_icluster_size_fsb() to calculate inode alignment mask
  2017-02-28  9:56 [PATCH] xfs: Use xfs_icluster_size_fsb() to calculate inode alignment mask Chandan Rajendra
@ 2017-03-02 23:18 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2017-03-02 23:18 UTC (permalink / raw)
  To: Chandan Rajendra; +Cc: linux-xfs, sandeen

On Tue, Feb 28, 2017 at 03:26:56PM +0530, Chandan Rajendra wrote:
> When block size is larger than inode cluster size, the call to
> XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size) returns 0. Also, mkfs.xfs
> would have set xfs_sb->sb_inoalignmt to 0. Hence in
> xfs_set_inoalignment(), xfs_mount->m_inoalign_mask gets initialized to
> -1 instead of 0. However, xfs_mount->m_sinoalign would get correctly
> intialized to 0 because for every positive value of xfs_mount->m_dalign,
> the condition "!(mp->m_dalign & mp->m_inoalign_mask)" would evaluate to
> false.
> 
> Also, xfs_imap() worked fine even with xfs_mount->m_inoalign_mask having
> -1 as the value because blks_per_cluster variable would have the value 1
> and hence we would never have a need to use xfs_mount->m_inoalign_mask
> to compute the inode chunk's agbno and offset within the chunk.
> 
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_mount.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 450bde6..688ebff 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -513,8 +513,7 @@ STATIC void
>  xfs_set_inoalignment(xfs_mount_t *mp)
>  {
>  	if (xfs_sb_version_hasalign(&mp->m_sb) &&
> -	    mp->m_sb.sb_inoalignmt >=
> -	    XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size))
> +		mp->m_sb.sb_inoalignmt >= xfs_icluster_size_fsb(mp))
>  		mp->m_inoalign_mask = mp->m_sb.sb_inoalignmt - 1;
>  	else
>  		mp->m_inoalign_mask = 0;
> -- 
> 2.5.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-02 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28  9:56 [PATCH] xfs: Use xfs_icluster_size_fsb() to calculate inode alignment mask Chandan Rajendra
2017-03-02 23:18 ` Darrick J. Wong

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.