Skip to contentSkip to conversation

xfs: reduce IOCB_NOWAIT judgment for retry exclusive unaligned DIO

PATCH In review [email protected] 2 participants 2 messages May 18, 2022 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: reduce IOCB_NOWAIT judgment for retry exclusive unaligned DIO

From: Kaixu Xia <[email protected]>

Retry unaligned DIO with exclusive blocking semantics only when the IOCB_NOWAIT flag is not set. If we are doing nonblocking user I/O, propagate the error directly.

---
 fs/xfs/xfs_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_file.c +1 -1
index 5bddb1e9e0b3..250a3f97400d 100644
@@ -576,9 +576,9 @@ xfs_file_dio_write_unaligned(
 	 * don't even bother trying the fast path in this case.
 	 */
 	if (iocb->ki_pos > isize || iocb->ki_pos + count >= isize) {
-retry_exclusive:
 		if (iocb->ki_flags & IOCB_NOWAIT)
 			return -EAGAIN;
+retry_exclusive:
 		iolock = XFS_IOLOCK_EXCL;
 		flags = IOMAP_DIO_FORCE_WAIT;
 	}
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On 5/18/22 09:01, [email protected] wrote:

From: Kaixu Xia <[email protected]>

Retry unaligned DIO with exclusive blocking semantics only when the IOCB_NOWAIT flag is not set. If we are doing nonblocking user I/O, propagate the error directly.

---

Looks good.

-ck

Quoted 18 lines
  fs/xfs/xfs_file.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_file.c +1 -1
index 5bddb1e9e0b3..250a3f97400d 100644
@@ -576,9 +576,9 @@ xfs_file_dio_write_unaligned(
  	 * don't even bother trying the fast path in this case.
  	 */
  	if (iocb->ki_pos > isize || iocb->ki_pos + count >= isize) {
-retry_exclusive:
  		if (iocb->ki_flags & IOCB_NOWAIT)
  			return -EAGAIN;
+retry_exclusive:
  		iolock = XFS_IOLOCK_EXCL;
  		flags = IOMAP_DIO_FORCE_WAIT;
  	}