summaryrefslogtreecommitdiff
path: root/libbcachefs/fs-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/fs-io.c')
-rw-r--r--libbcachefs/fs-io.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libbcachefs/fs-io.c b/libbcachefs/fs-io.c
index 0aa3afad..7de61f7f 100644
--- a/libbcachefs/fs-io.c
+++ b/libbcachefs/fs-io.c
@@ -1239,7 +1239,8 @@ do_io:
if (w->io &&
(w->io->op.res.nr_replicas != nr_replicas_this_write ||
bio_full(&w->io->op.wbio.bio, PAGE_SIZE) ||
- w->io->op.wbio.bio.bi_iter.bi_size >= (256U << 20) ||
+ w->io->op.wbio.bio.bi_iter.bi_size + (sectors << 9) >=
+ (BIO_MAX_PAGES * PAGE_SIZE) ||
bio_end_sector(&w->io->op.wbio.bio) != sector))
bch2_writepage_do_io(w);
@@ -1814,12 +1815,22 @@ static long bch2_dio_write_loop(struct dio_write *dio)
goto loop;
while (1) {
+ size_t extra = dio->iter.count -
+ min(BIO_MAX_PAGES * PAGE_SIZE, dio->iter.count);
+
if (kthread)
use_mm(dio->mm);
BUG_ON(current->faults_disabled_mapping);
current->faults_disabled_mapping = mapping;
+ /*
+ * Don't issue more than 2MB at once, the bcachefs io path in
+ * io.c can't bounce more than that:
+ */
+
+ dio->iter.count -= extra;
ret = bio_iov_iter_get_pages(bio, &dio->iter);
+ dio->iter.count += extra;
current->faults_disabled_mapping = NULL;
if (kthread)