Skip to content

Commit 7951410

Browse files
allisonhendersondjwong
authored andcommitted
xfs: Factor out xfs_attr_rmtval_invalidate
Because new delayed attribute routines cannot roll transactions, we carve off the parts of xfs_attr_rmtval_remove that we can use. This will help to reduce repetitive code later when we introduce delayed attributes. Signed-off-by: Allison Collins <[email protected]> Reviewed-by: Brian Foster <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Reviewed-by: Chandan Rajendra <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]> Acked-by: Dave Chinner <[email protected]>
1 parent 0949d31 commit 7951410

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

fs/xfs/libxfs/xfs_attr_remote.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -634,15 +634,12 @@ xfs_attr_rmtval_set(
634634
* out-of-line buffer that it is stored on.
635635
*/
636636
int
637-
xfs_attr_rmtval_remove(
637+
xfs_attr_rmtval_invalidate(
638638
struct xfs_da_args *args)
639639
{
640640
xfs_dablk_t lblkno;
641641
int blkcnt;
642642
int error;
643-
int done;
644-
645-
trace_xfs_attr_rmtval_remove(args);
646643

647644
/*
648645
* Roll through the "value", invalidating the attribute value's blocks.
@@ -670,13 +667,32 @@ xfs_attr_rmtval_remove(
670667
lblkno += map.br_blockcount;
671668
blkcnt -= map.br_blockcount;
672669
}
670+
return 0;
671+
}
673672

673+
/*
674+
* Remove the value associated with an attribute by deleting the
675+
* out-of-line buffer that it is stored on.
676+
*/
677+
int
678+
xfs_attr_rmtval_remove(
679+
struct xfs_da_args *args)
680+
{
681+
xfs_dablk_t lblkno;
682+
int blkcnt;
683+
int error = 0;
684+
int done = 0;
685+
686+
trace_xfs_attr_rmtval_remove(args);
687+
688+
error = xfs_attr_rmtval_invalidate(args);
689+
if (error)
690+
return error;
674691
/*
675692
* Keep de-allocating extents until the remote-value region is gone.
676693
*/
677694
lblkno = args->rmtblkno;
678695
blkcnt = args->rmtblkcnt;
679-
done = 0;
680696
while (!done) {
681697
error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
682698
XFS_BMAPI_ATTRFORK, 1, &done);

fs/xfs/libxfs/xfs_attr_remote.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ int xfs_attr_rmtval_set(struct xfs_da_args *args);
1313
int xfs_attr_rmtval_remove(struct xfs_da_args *args);
1414
int xfs_attr_rmtval_stale(struct xfs_inode *ip, struct xfs_bmbt_irec *map,
1515
xfs_buf_flags_t incore_flags);
16-
16+
int xfs_attr_rmtval_invalidate(struct xfs_da_args *args);
1717
#endif /* __XFS_ATTR_REMOTE_H__ */

0 commit comments

Comments
 (0)