summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs-io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-10-29 22:54:17 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:45 +0300
commit1df3e19996a3b29ed82315bf03cb02ac4e4e70ab (patch)
tree745b9032df5c61f7b371071cbfd62622a8e4258c /fs/bcachefs/fs-io.c
parenta10195764901e0a41e64d596de57a957e7f982f0 (diff)
downloadlinux-1df3e19996a3b29ed82315bf03cb02ac4e4e70ab.tar.xz
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 <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fs-io.c')
-rw-r--r--fs/bcachefs/fs-io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 9e9ada8f007a..dbad24f5f2ea 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2156,6 +2156,8 @@ static long bch2_dio_write_loop(struct dio_write *dio)
dio->op.subvol = inode->ei_subvol;
dio->op.pos = POS(inode->v.i_ino, (u64) req->ki_pos >> 9);
+ if (sync)
+ dio->op.flags |= BCH_WRITE_SYNC;
if ((req->ki_flags & IOCB_DSYNC) &&
!c->opts.journal_flush_disabled)
dio->op.flags |= BCH_WRITE_FLUSH;