lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250108005627.GD1306365@frogsfrogsfrogs>
Date: Tue, 7 Jan 2025 16:56:27 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: John Garry <john.g.garry@...cle.com>
Cc: brauner@...nel.org, cem@...nel.org, dchinner@...hat.com, hch@....de,
	ritesh.list@...il.com, linux-xfs@...r.kernel.org,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	martin.petersen@...cle.com
Subject: Re: [PATCH v3 7/7] xfs: Update xfs_get_atomic_write_attr() for large
 atomic writes

On Thu, Jan 02, 2025 at 02:04:11PM +0000, John Garry wrote:
> Update xfs_get_atomic_write_attr() to take into account that rtvol can
> support atomic writes spanning multiple FS blocks.
> 
> For non-rtvol, we are still limited in min and max by the blocksize.
> 
> Signed-off-by: John Garry <john.g.garry@...cle.com>

Pretty straightforward to me.
Reviewed-by: "Darrick J. Wong" <djwong@...nel.org>

--D

> ---
>  fs/xfs/xfs_iops.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 883ec45ae708..02b3f697936b 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -572,18 +572,35 @@ xfs_stat_blksize(
>  	return max_t(uint32_t, PAGE_SIZE, mp->m_sb.sb_blocksize);
>  }
>  
> +/* Returns max atomic write unit for a file, in bytes. */
> +static unsigned int
> +xfs_inode_atomicwrite_max(
> +	struct xfs_inode	*ip)
> +{
> +	struct xfs_mount	*mp = ip->i_mount;
> +
> +	if (XFS_IS_REALTIME_INODE(ip))
> +		return XFS_FSB_TO_B(mp, mp->m_rt_awu_max);
> +
> +	return mp->m_sb.sb_blocksize;
> +}
> +
>  void
>  xfs_get_atomic_write_attr(
>  	struct xfs_inode	*ip,
>  	unsigned int		*unit_min,
>  	unsigned int		*unit_max)
>  {
> +	struct xfs_buftarg	*target = xfs_inode_buftarg(ip);
> +	unsigned int		awu_max = xfs_inode_atomicwrite_max(ip);
> +
>  	if (!xfs_inode_can_atomicwrite(ip)) {
>  		*unit_min = *unit_max = 0;
>  		return;
>  	}
>  
> -	*unit_min = *unit_max = ip->i_mount->m_sb.sb_blocksize;
> +	*unit_min = ip->i_mount->m_sb.sb_blocksize;
> +	*unit_max =  min(target->bt_bdev_awu_max, awu_max);
>  }
>  
>  STATIC int
> -- 
> 2.31.1
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ