Skip to content

Commit eb43b0b

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: simplify xfs_buf_delwri_pushbuf
xfs_buf_delwri_pushbuf synchronously writes a buffer that is on a delwri list already. Instead of doing a complicated dance with the delwri and wait list, just leave them alone and open code the actual buffer write. 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 05b5968 commit eb43b0b

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

fs/xfs/xfs_buf.c

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,14 +2384,9 @@ xfs_buf_delwri_submit(
23842384
* Push a single buffer on a delwri queue.
23852385
*
23862386
* The purpose of this function is to submit a single buffer of a delwri queue
2387-
* and return with the buffer still on the original queue. The waiting delwri
2388-
* buffer submission infrastructure guarantees transfer of the delwri queue
2389-
* buffer reference to a temporary wait list. We reuse this infrastructure to
2390-
* transfer the buffer back to the original queue.
2387+
* and return with the buffer still on the original queue.
23912388
*
2392-
* Note the buffer transitions from the queued state, to the submitted and wait
2393-
* listed state and back to the queued state during this call. The buffer
2394-
* locking and queue management logic between _delwri_pushbuf() and
2389+
* The buffer locking and queue management logic between _delwri_pushbuf() and
23952390
* _delwri_queue() guarantee that the buffer cannot be queued to another list
23962391
* before returning.
23972392
*/
@@ -2400,33 +2395,21 @@ xfs_buf_delwri_pushbuf(
24002395
struct xfs_buf *bp,
24012396
struct list_head *buffer_list)
24022397
{
2403-
LIST_HEAD (submit_list);
24042398
int error;
24052399

24062400
ASSERT(bp->b_flags & _XBF_DELWRI_Q);
24072401

24082402
trace_xfs_buf_delwri_pushbuf(bp, _RET_IP_);
24092403

2410-
/*
2411-
* Isolate the buffer to a new local list so we can submit it for I/O
2412-
* independently from the rest of the original list.
2413-
*/
24142404
xfs_buf_lock(bp);
2415-
list_move(&bp->b_list, &submit_list);
2416-
xfs_buf_unlock(bp);
2417-
2418-
/*
2419-
* Delwri submission clears the DELWRI_Q buffer flag and returns with
2420-
* the buffer on the wait list with the original reference. Rather than
2421-
* bounce the buffer from a local wait list back to the original list
2422-
* after I/O completion, reuse the original list as the wait list.
2423-
*/
2424-
xfs_buf_delwri_submit_buffers(&submit_list, buffer_list);
2405+
bp->b_flags &= ~(_XBF_DELWRI_Q | XBF_ASYNC);
2406+
bp->b_flags |= XBF_WRITE;
2407+
xfs_buf_submit(bp);
24252408

24262409
/*
2427-
* The buffer is now locked, under I/O and wait listed on the original
2428-
* delwri queue. Wait for I/O completion, restore the DELWRI_Q flag and
2429-
* return with the buffer unlocked and on the original queue.
2410+
* The buffer is now locked, under I/O but still on the original delwri
2411+
* queue. Wait for I/O completion, restore the DELWRI_Q flag and
2412+
* return with the buffer unlocked and still on the original queue.
24302413
*/
24312414
error = xfs_buf_iowait(bp);
24322415
bp->b_flags |= _XBF_DELWRI_Q;

0 commit comments

Comments
 (0)