From 1df3e19996a3b29ed82315bf03cb02ac4e4e70ab Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sat, 29 Oct 2022 15:54:17 -0400 Subject: bcachefs: BCH_WRITE_SYNC This adds a new flag for the write path, BCH_WRITE_SYNC, and switches the O_DIRECT write path to use it when we're not running asynchronously. It runs the btree update after the write in the original thread's context instead of a kworker, cutting context switches in half. Signed-off-by: Kent Overstreet --- fs/bcachefs/io.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/bcachefs/io.h') diff --git a/fs/bcachefs/io.h b/fs/bcachefs/io.h index 730c7a5bcce8..9322484135f9 100644 --- a/fs/bcachefs/io.h +++ b/fs/bcachefs/io.h @@ -39,6 +39,7 @@ enum bch_write_flags { __BCH_WRITE_WROTE_DATA_INLINE, __BCH_WRITE_FROM_INTERNAL, __BCH_WRITE_CHECK_ENOSPC, + __BCH_WRITE_SYNC, __BCH_WRITE_MOVE, __BCH_WRITE_IN_WORKER, __BCH_WRITE_DONE, @@ -55,6 +56,7 @@ enum bch_write_flags { #define BCH_WRITE_WROTE_DATA_INLINE (1U << __BCH_WRITE_WROTE_DATA_INLINE) #define BCH_WRITE_FROM_INTERNAL (1U << __BCH_WRITE_FROM_INTERNAL) #define BCH_WRITE_CHECK_ENOSPC (1U << __BCH_WRITE_CHECK_ENOSPC) +#define BCH_WRITE_SYNC (1U << __BCH_WRITE_SYNC) #define BCH_WRITE_MOVE (1U << __BCH_WRITE_MOVE) /* Internal: */ -- cgit v1.2.3