diff mbox series

[09/13] xfs: Update xfs_inode_alloc_unitsize_fsb() for forcealign

Message ID 20240621100540.2976618-10-john.g.garry@oracle.com (mailing list archive)
State New
Headers show
Series forcealign for xfs | expand

Commit Message

John Garry June 21, 2024, 10:05 a.m. UTC
For forcealign enabled, the allocation unit size is in ip->i_extsize, and
this must never be zero.

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 fs/xfs/xfs_inode.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Darrick J. Wong June 21, 2024, 6:38 p.m. UTC | #1
On Fri, Jun 21, 2024 at 10:05:36AM +0000, John Garry wrote:
> For forcealign enabled, the allocation unit size is in ip->i_extsize, and
> this must never be zero.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
>  fs/xfs/xfs_inode.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 994fb7e184d9..cd07b15478ac 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -4299,6 +4299,8 @@ xfs_inode_alloc_unitsize(
>  {
>  	unsigned int		blocks = 1;
>  
> +	if (xfs_inode_has_forcealign(ip))
> +		return ip->i_extsize;

i_extsize is in units of fsblocks, whereas this function returns bytes.
I think you need XFS_FSB_TO_B here?

--D

>  	if (XFS_IS_REALTIME_INODE(ip))
>  		blocks = ip->i_mount->m_sb.sb_rextsize;
>  
> -- 
> 2.31.1
> 
>
John Garry June 24, 2024, 7:34 a.m. UTC | #2
On 21/06/2024 19:38, Darrick J. Wong wrote:
> On Fri, Jun 21, 2024 at 10:05:36AM +0000, John Garry wrote:
>> For forcealign enabled, the allocation unit size is in ip->i_extsize, and
>> this must never be zero.
>>
>> Signed-off-by: John Garry<john.g.garry@oracle.com>
>> ---
>>   fs/xfs/xfs_inode.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
>> index 994fb7e184d9..cd07b15478ac 100644
>> --- a/fs/xfs/xfs_inode.c
>> +++ b/fs/xfs/xfs_inode.c
>> @@ -4299,6 +4299,8 @@ xfs_inode_alloc_unitsize(
>>   {
>>   	unsigned int		blocks = 1;
>>   
>> +	if (xfs_inode_has_forcealign(ip))
>> +		return ip->i_extsize;
> i_extsize is in units of fsblocks, whereas this function returns bytes.
> I think you need XFS_FSB_TO_B here?

Right, that was a copy-and-paste error from the previous series.

Thanks,
John
diff mbox series

Patch

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 994fb7e184d9..cd07b15478ac 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -4299,6 +4299,8 @@  xfs_inode_alloc_unitsize(
 {
 	unsigned int		blocks = 1;
 
+	if (xfs_inode_has_forcealign(ip))
+		return ip->i_extsize;
 	if (XFS_IS_REALTIME_INODE(ip))
 		blocks = ip->i_mount->m_sb.sb_rextsize;