mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2026-01-27 12:47:24 +01:00
xfs: stop passing an inode to the zone space reservation helpers
None of them actually needs the inode, the mount is enough. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
329b996d92
commit
86e6ddf1d0
|
|
@ -497,7 +497,7 @@ restart:
|
|||
|
||||
static ssize_t
|
||||
xfs_zoned_write_space_reserve(
|
||||
struct xfs_inode *ip,
|
||||
struct xfs_mount *mp,
|
||||
struct kiocb *iocb,
|
||||
struct iov_iter *from,
|
||||
unsigned int flags,
|
||||
|
|
@ -533,8 +533,8 @@ xfs_zoned_write_space_reserve(
|
|||
*
|
||||
* Any remaining block will be returned after the write.
|
||||
*/
|
||||
return xfs_zoned_space_reserve(ip,
|
||||
XFS_B_TO_FSB(ip->i_mount, count) + 1 + 2, flags, ac);
|
||||
return xfs_zoned_space_reserve(mp, XFS_B_TO_FSB(mp, count) + 1 + 2,
|
||||
flags, ac);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -718,13 +718,13 @@ xfs_file_dio_write_zoned(
|
|||
struct xfs_zone_alloc_ctx ac = { };
|
||||
ssize_t ret;
|
||||
|
||||
ret = xfs_zoned_write_space_reserve(ip, iocb, from, 0, &ac);
|
||||
ret = xfs_zoned_write_space_reserve(ip->i_mount, iocb, from, 0, &ac);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = xfs_file_dio_write_aligned(ip, iocb, from,
|
||||
&xfs_zoned_direct_write_iomap_ops,
|
||||
&xfs_dio_zoned_write_ops, &ac);
|
||||
xfs_zoned_space_unreserve(ip, &ac);
|
||||
xfs_zoned_space_unreserve(ip->i_mount, &ac);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1032,7 +1032,7 @@ xfs_file_buffered_write_zoned(
|
|||
struct xfs_zone_alloc_ctx ac = { };
|
||||
ssize_t ret;
|
||||
|
||||
ret = xfs_zoned_write_space_reserve(ip, iocb, from, XFS_ZR_GREEDY, &ac);
|
||||
ret = xfs_zoned_write_space_reserve(mp, iocb, from, XFS_ZR_GREEDY, &ac);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -1073,7 +1073,7 @@ retry:
|
|||
out_unlock:
|
||||
xfs_iunlock(ip, iolock);
|
||||
out_unreserve:
|
||||
xfs_zoned_space_unreserve(ip, &ac);
|
||||
xfs_zoned_space_unreserve(ip->i_mount, &ac);
|
||||
if (ret > 0) {
|
||||
XFS_STATS_ADD(mp, xs_write_bytes, ret);
|
||||
ret = generic_write_sync(iocb, ret);
|
||||
|
|
@ -1414,11 +1414,11 @@ xfs_file_zoned_fallocate(
|
|||
struct xfs_inode *ip = XFS_I(file_inode(file));
|
||||
int error;
|
||||
|
||||
error = xfs_zoned_space_reserve(ip, 2, XFS_ZR_RESERVED, &ac);
|
||||
error = xfs_zoned_space_reserve(ip->i_mount, 2, XFS_ZR_RESERVED, &ac);
|
||||
if (error)
|
||||
return error;
|
||||
error = __xfs_file_fallocate(file, mode, offset, len, &ac);
|
||||
xfs_zoned_space_unreserve(ip, &ac);
|
||||
xfs_zoned_space_unreserve(ip->i_mount, &ac);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
@ -1828,12 +1828,12 @@ xfs_write_fault_zoned(
|
|||
* But as the overallocation is limited to less than a folio and will be
|
||||
* release instantly that's just fine.
|
||||
*/
|
||||
error = xfs_zoned_space_reserve(ip, XFS_B_TO_FSB(ip->i_mount, len), 0,
|
||||
&ac);
|
||||
error = xfs_zoned_space_reserve(ip->i_mount,
|
||||
XFS_B_TO_FSB(ip->i_mount, len), 0, &ac);
|
||||
if (error < 0)
|
||||
return vmf_fs_error(error);
|
||||
ret = __xfs_write_fault(vmf, order, &ac);
|
||||
xfs_zoned_space_unreserve(ip, &ac);
|
||||
xfs_zoned_space_unreserve(ip->i_mount, &ac);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -970,7 +970,7 @@ xfs_setattr_size(
|
|||
* change.
|
||||
*/
|
||||
if (xfs_is_zoned_inode(ip)) {
|
||||
error = xfs_zoned_space_reserve(ip, 1,
|
||||
error = xfs_zoned_space_reserve(mp, 1,
|
||||
XFS_ZR_NOWAIT | XFS_ZR_RESERVED, &ac);
|
||||
if (error) {
|
||||
if (error == -EAGAIN)
|
||||
|
|
@ -998,7 +998,7 @@ xfs_setattr_size(
|
|||
}
|
||||
|
||||
if (xfs_is_zoned_inode(ip))
|
||||
xfs_zoned_space_unreserve(ip, &ac);
|
||||
xfs_zoned_space_unreserve(mp, &ac);
|
||||
|
||||
if (error)
|
||||
return error;
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ struct xfs_zone_alloc_ctx {
|
|||
*/
|
||||
#define XFS_ZR_RESERVED (1U << 2)
|
||||
|
||||
int xfs_zoned_space_reserve(struct xfs_inode *ip, xfs_filblks_t count_fsb,
|
||||
int xfs_zoned_space_reserve(struct xfs_mount *mp, xfs_filblks_t count_fsb,
|
||||
unsigned int flags, struct xfs_zone_alloc_ctx *ac);
|
||||
void xfs_zoned_space_unreserve(struct xfs_inode *ip,
|
||||
void xfs_zoned_space_unreserve(struct xfs_mount *mp,
|
||||
struct xfs_zone_alloc_ctx *ac);
|
||||
void xfs_zoned_add_available(struct xfs_mount *mp, xfs_filblks_t count_fsb);
|
||||
|
||||
|
|
|
|||
|
|
@ -117,11 +117,10 @@ xfs_zoned_space_wait_error(
|
|||
|
||||
static int
|
||||
xfs_zoned_reserve_available(
|
||||
struct xfs_inode *ip,
|
||||
struct xfs_mount *mp,
|
||||
xfs_filblks_t count_fsb,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
struct xfs_zone_info *zi = mp->m_zone_info;
|
||||
struct xfs_zone_reservation reservation = {
|
||||
.task = current,
|
||||
|
|
@ -198,11 +197,10 @@ xfs_zoned_reserve_available(
|
|||
*/
|
||||
static int
|
||||
xfs_zoned_reserve_extents_greedy(
|
||||
struct xfs_inode *ip,
|
||||
struct xfs_mount *mp,
|
||||
xfs_filblks_t *count_fsb,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
struct xfs_zone_info *zi = mp->m_zone_info;
|
||||
s64 len = *count_fsb;
|
||||
int error = -ENOSPC;
|
||||
|
|
@ -220,12 +218,11 @@ xfs_zoned_reserve_extents_greedy(
|
|||
|
||||
int
|
||||
xfs_zoned_space_reserve(
|
||||
struct xfs_inode *ip,
|
||||
struct xfs_mount *mp,
|
||||
xfs_filblks_t count_fsb,
|
||||
unsigned int flags,
|
||||
struct xfs_zone_alloc_ctx *ac)
|
||||
{
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
int error;
|
||||
|
||||
ASSERT(ac->reserved_blocks == 0);
|
||||
|
|
@ -234,11 +231,11 @@ xfs_zoned_space_reserve(
|
|||
error = xfs_dec_freecounter(mp, XC_FREE_RTEXTENTS, count_fsb,
|
||||
flags & XFS_ZR_RESERVED);
|
||||
if (error == -ENOSPC && (flags & XFS_ZR_GREEDY) && count_fsb > 1)
|
||||
error = xfs_zoned_reserve_extents_greedy(ip, &count_fsb, flags);
|
||||
error = xfs_zoned_reserve_extents_greedy(mp, &count_fsb, flags);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
error = xfs_zoned_reserve_available(ip, count_fsb, flags);
|
||||
error = xfs_zoned_reserve_available(mp, count_fsb, flags);
|
||||
if (error) {
|
||||
xfs_add_freecounter(mp, XC_FREE_RTEXTENTS, count_fsb);
|
||||
return error;
|
||||
|
|
@ -249,12 +246,10 @@ xfs_zoned_space_reserve(
|
|||
|
||||
void
|
||||
xfs_zoned_space_unreserve(
|
||||
struct xfs_inode *ip,
|
||||
struct xfs_mount *mp,
|
||||
struct xfs_zone_alloc_ctx *ac)
|
||||
{
|
||||
if (ac->reserved_blocks > 0) {
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
|
||||
xfs_zoned_add_available(mp, ac->reserved_blocks);
|
||||
xfs_add_freecounter(mp, XC_FREE_RTEXTENTS, ac->reserved_blocks);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user