From: Christoph Hellwig Date: Thu, 22 Feb 2024 20:42:45 +0000 (-0800) Subject: xfs: move setting bt_logical_sectorsize out of xfs_setsize_buftarg X-Git-Tag: v6.9-rc1~17^2~16^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=1c51ac0998ed9baaca3ac75c0083b4c3b4d993ef;p=linux-2.6-block.git xfs: move setting bt_logical_sectorsize out of xfs_setsize_buftarg bt_logical_sectorsize and the associated mask is set based on the constant logical block size in the block_device structure and thus doesn't need to be updated in xfs_setsize_buftarg. Move it into xfs_alloc_buftarg so that it is only done once per buftarg. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index e83cadea239f..ff243e3176a5 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1994,10 +1994,6 @@ xfs_setsize_buftarg( return -EINVAL; } - /* Set up device logical sector size mask */ - btp->bt_logical_sectorsize = bdev_logical_block_size(btp->bt_bdev); - btp->bt_logical_sectormask = bdev_logical_block_size(btp->bt_bdev) - 1; - return 0; } @@ -2028,6 +2024,10 @@ xfs_alloc_buftarg( if (xfs_setsize_buftarg(btp, bdev_logical_block_size(btp->bt_bdev))) goto error_free; + /* Set up device logical sector size mask */ + btp->bt_logical_sectorsize = bdev_logical_block_size(btp->bt_bdev); + btp->bt_logical_sectormask = bdev_logical_block_size(btp->bt_bdev) - 1; + /* * Buffer IO error rate limiting. Limit it to no more than 10 messages * per 30 seconds so as to not spam logs too much on repeated errors.