Skip to content

Commit 4f1aefd

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: move b_li_list based retry handling to common code
The dquot and inode version are very similar, which is expected given the overall b_li_list logic. The differences are that the inode version also clears the XFS_LI_FLUSHING which is defined in common but only ever set by the inode item, and that the dquot version takes the ail_lock over the list iteration. While this seems sensible given that additions and removals from b_li_list are protected by the ail_lock, log items are only added before buffer submission, and are only removed when completing the buffer, so nothing can change the list when retrying a buffer. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Acked-by: Dave Chinner <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent 46eba93 commit 4f1aefd

File tree

4 files changed

+6
-35
lines changed

4 files changed

+6
-35
lines changed

fs/xfs/xfs_buf.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,7 @@ xfs_buf_ioend_handle_error(
12861286
{
12871287
struct xfs_mount *mp = bp->b_mount;
12881288
struct xfs_error_cfg *cfg;
1289+
struct xfs_log_item *lip;
12891290

12901291
/*
12911292
* If we've already shutdown the journal because of I/O errors, there's
@@ -1333,12 +1334,11 @@ xfs_buf_ioend_handle_error(
13331334
}
13341335

13351336
/* Still considered a transient error. Caller will schedule retries. */
1336-
if (bp->b_flags & _XBF_INODES)
1337-
xfs_buf_inode_io_fail(bp);
1338-
else if (bp->b_flags & _XBF_DQUOTS)
1339-
xfs_buf_dquot_io_fail(bp);
1340-
else
1341-
ASSERT(list_empty(&bp->b_li_list));
1337+
list_for_each_entry(lip, &bp->b_li_list, li_bio_list) {
1338+
set_bit(XFS_LI_FAILED, &lip->li_flags);
1339+
clear_bit(XFS_LI_FLUSHING, &lip->li_flags);
1340+
}
1341+
13421342
xfs_buf_ioerror(bp, 0);
13431343
xfs_buf_relse(bp);
13441344
return true;

fs/xfs/xfs_buf_item.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,12 @@ bool xfs_buf_item_put(struct xfs_buf_log_item *);
5454
void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
5555
bool xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
5656
void xfs_buf_inode_iodone(struct xfs_buf *);
57-
void xfs_buf_inode_io_fail(struct xfs_buf *bp);
5857
#ifdef CONFIG_XFS_QUOTA
5958
void xfs_buf_dquot_iodone(struct xfs_buf *);
60-
void xfs_buf_dquot_io_fail(struct xfs_buf *bp);
6159
#else
6260
static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
6361
{
6462
}
65-
static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp)
66-
{
67-
}
6863
#endif /* CONFIG_XFS_QUOTA */
6964
void xfs_buf_iodone(struct xfs_buf *);
7065
bool xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);

fs/xfs/xfs_dquot.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,18 +1230,6 @@ xfs_buf_dquot_iodone(
12301230
}
12311231
}
12321232

1233-
void
1234-
xfs_buf_dquot_io_fail(
1235-
struct xfs_buf *bp)
1236-
{
1237-
struct xfs_log_item *lip;
1238-
1239-
spin_lock(&bp->b_mount->m_ail->ail_lock);
1240-
list_for_each_entry(lip, &bp->b_li_list, li_bio_list)
1241-
set_bit(XFS_LI_FAILED, &lip->li_flags);
1242-
spin_unlock(&bp->b_mount->m_ail->ail_lock);
1243-
}
1244-
12451233
/* Check incore dquot for errors before we flush. */
12461234
static xfs_failaddr_t
12471235
xfs_qm_dqflush_check(

fs/xfs/xfs_inode_item.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,18 +1039,6 @@ xfs_buf_inode_iodone(
10391039
list_splice_tail(&flushed_inodes, &bp->b_li_list);
10401040
}
10411041

1042-
void
1043-
xfs_buf_inode_io_fail(
1044-
struct xfs_buf *bp)
1045-
{
1046-
struct xfs_log_item *lip;
1047-
1048-
list_for_each_entry(lip, &bp->b_li_list, li_bio_list) {
1049-
set_bit(XFS_LI_FAILED, &lip->li_flags);
1050-
clear_bit(XFS_LI_FLUSHING, &lip->li_flags);
1051-
}
1052-
}
1053-
10541042
/*
10551043
* Clear the inode logging fields so no more flushes are attempted. If we are
10561044
* on a buffer list, it is now safe to remove it because the buffer is

0 commit comments

Comments
 (0)