* [PATCH 0/3] bcachefs block layer prereqs
@ 2023-08-13 18:26 Kent Overstreet
2023-08-13 18:26 ` [PATCH 1/3] block: Add some exports for bcachefs Kent Overstreet
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Kent Overstreet @ 2023-08-13 18:26 UTC (permalink / raw)
To: linux-block, linux-fsdevel, axboe; +Cc: Kent Overstreet
Hi Jens, here's the (hopefully final) bcachefs block layer prereqs,
aiming for v6.6.
The "block: Don't block on s_umount from __invalidate_super()" patch has
been dropped for now - but we may want this later as there's a real bug
it addresses, and with the blockdev holder changes now landing I suspect
other filesystems will be hitting the same issue as bcachefs.
But that can be a topic for another thread.
Can I get either acks or have you take them via your tree, your
preference?
Kent Overstreet (3):
block: Add some exports for bcachefs
block: Allow bio_iov_iter_get_pages() with bio->bi_bdev unset
block: Bring back zero_fill_bio_iter
block/bio.c | 18 +++++++++++-------
block/blk-core.c | 1 +
block/blk.h | 1 -
include/linux/bio.h | 7 ++++++-
include/linux/blkdev.h | 1 +
5 files changed, 19 insertions(+), 9 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] block: Add some exports for bcachefs
2023-08-13 18:26 [PATCH 0/3] bcachefs block layer prereqs Kent Overstreet
@ 2023-08-13 18:26 ` Kent Overstreet
2023-08-13 18:26 ` [PATCH 2/3] block: Allow bio_iov_iter_get_pages() with bio->bi_bdev unset Kent Overstreet
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kent Overstreet @ 2023-08-13 18:26 UTC (permalink / raw)
To: linux-block, linux-fsdevel, axboe; +Cc: Kent Overstreet, Kent Overstreet
From: Kent Overstreet <kent.overstreet@gmail.com>
- bio_set_pages_dirty(), bio_check_pages_dirty() - dio path
- blk_status_to_str() - error messages
- bio_add_folio() - this should definitely be exported for everyone,
it's the modern version of bio_add_page()
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Cc: linux-block@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
block/bio.c | 2 ++
block/blk-core.c | 1 +
block/blk.h | 1 -
include/linux/blkdev.h | 1 +
4 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/block/bio.c b/block/bio.c
index 043944fd46..1e75840d17 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1481,6 +1481,7 @@ void bio_set_pages_dirty(struct bio *bio)
set_page_dirty_lock(bvec->bv_page);
}
}
+EXPORT_SYMBOL_GPL(bio_set_pages_dirty);
/*
* bio_check_pages_dirty() will check that all the BIO's pages are still dirty.
@@ -1540,6 +1541,7 @@ void bio_check_pages_dirty(struct bio *bio)
spin_unlock_irqrestore(&bio_dirty_lock, flags);
schedule_work(&bio_dirty_work);
}
+EXPORT_SYMBOL_GPL(bio_check_pages_dirty);
static inline bool bio_remaining_done(struct bio *bio)
{
diff --git a/block/blk-core.c b/block/blk-core.c
index 1da77e7d62..b7b0237c36 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -205,6 +205,7 @@ const char *blk_status_to_str(blk_status_t status)
return "<null>";
return blk_errors[idx].name;
}
+EXPORT_SYMBOL_GPL(blk_status_to_str);
/**
* blk_sync_queue - cancel any pending callbacks on a queue
diff --git a/block/blk.h b/block/blk.h
index 45547bcf11..f20f9ca03e 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -251,7 +251,6 @@ static inline void bio_integrity_free(struct bio *bio)
unsigned long blk_rq_timeout(unsigned long timeout);
void blk_add_timer(struct request *req);
-const char *blk_status_to_str(blk_status_t status);
bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
unsigned int nr_segs);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c0ffe203a6..7a32dc98e1 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -854,6 +854,7 @@ extern const char *blk_op_str(enum req_op op);
int blk_status_to_errno(blk_status_t status);
blk_status_t errno_to_blk_status(int errno);
+const char *blk_status_to_str(blk_status_t status);
/* only poll the hardware once, don't continue until a completion was found */
#define BLK_POLL_ONESHOT (1 << 0)
--
2.40.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] block: Allow bio_iov_iter_get_pages() with bio->bi_bdev unset
2023-08-13 18:26 [PATCH 0/3] bcachefs block layer prereqs Kent Overstreet
2023-08-13 18:26 ` [PATCH 1/3] block: Add some exports for bcachefs Kent Overstreet
@ 2023-08-13 18:26 ` Kent Overstreet
2023-08-13 18:26 ` [PATCH 3/3] block: Bring back zero_fill_bio_iter Kent Overstreet
2023-08-14 21:42 ` [PATCH 0/3] bcachefs block layer prereqs Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Kent Overstreet @ 2023-08-13 18:26 UTC (permalink / raw)
To: linux-block, linux-fsdevel, axboe; +Cc: Kent Overstreet
bio_iov_iter_get_pages() trims the IO based on the block size of the
block device the IO will be issued to.
However, bcachefs is a multi device filesystem; when we're creating the
bio we don't yet know which block device the bio will be submitted to -
we have to handle the alignment checks elsewhere.
Thus this is needed to avoid a null ptr deref.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
---
block/bio.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 1e75840d17..e74a04ea14 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1245,7 +1245,7 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
struct page **pages = (struct page **)bv;
ssize_t size, left;
unsigned len, i = 0;
- size_t offset, trim;
+ size_t offset;
int ret = 0;
/*
@@ -1274,10 +1274,12 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
- trim = size & (bdev_logical_block_size(bio->bi_bdev) - 1);
- iov_iter_revert(iter, trim);
+ if (bio->bi_bdev) {
+ size_t trim = size & (bdev_logical_block_size(bio->bi_bdev) - 1);
+ iov_iter_revert(iter, trim);
+ size -= trim;
+ }
- size -= trim;
if (unlikely(!size)) {
ret = -EFAULT;
goto out;
--
2.40.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] block: Bring back zero_fill_bio_iter
2023-08-13 18:26 [PATCH 0/3] bcachefs block layer prereqs Kent Overstreet
2023-08-13 18:26 ` [PATCH 1/3] block: Add some exports for bcachefs Kent Overstreet
2023-08-13 18:26 ` [PATCH 2/3] block: Allow bio_iov_iter_get_pages() with bio->bi_bdev unset Kent Overstreet
@ 2023-08-13 18:26 ` Kent Overstreet
2023-08-14 21:42 ` [PATCH 0/3] bcachefs block layer prereqs Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Kent Overstreet @ 2023-08-13 18:26 UTC (permalink / raw)
To: linux-block, linux-fsdevel, axboe; +Cc: Kent Overstreet, Kent Overstreet
From: Kent Overstreet <kent.overstreet@gmail.com>
This reverts 6f822e1b5d9dda3d20e87365de138046e3baa03a - this helper is
used by bcachefs.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
---
block/bio.c | 6 +++---
include/linux/bio.h | 7 ++++++-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index e74a04ea14..70b5c987bc 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -606,15 +606,15 @@ struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask)
}
EXPORT_SYMBOL(bio_kmalloc);
-void zero_fill_bio(struct bio *bio)
+void zero_fill_bio_iter(struct bio *bio, struct bvec_iter start)
{
struct bio_vec bv;
struct bvec_iter iter;
- bio_for_each_segment(bv, bio, iter)
+ __bio_for_each_segment(bv, bio, iter, start)
memzero_bvec(&bv);
}
-EXPORT_SYMBOL(zero_fill_bio);
+EXPORT_SYMBOL(zero_fill_bio_iter);
/**
* bio_truncate - truncate the bio to small size of @new_size
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b3e7529ff5..f2620f8d18 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -484,7 +484,12 @@ extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter,
extern void bio_copy_data(struct bio *dst, struct bio *src);
extern void bio_free_pages(struct bio *bio);
void guard_bio_eod(struct bio *bio);
-void zero_fill_bio(struct bio *bio);
+void zero_fill_bio_iter(struct bio *bio, struct bvec_iter iter);
+
+static inline void zero_fill_bio(struct bio *bio)
+{
+ zero_fill_bio_iter(bio, bio->bi_iter);
+}
static inline void bio_release_pages(struct bio *bio, bool mark_dirty)
{
--
2.40.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] bcachefs block layer prereqs
2023-08-13 18:26 [PATCH 0/3] bcachefs block layer prereqs Kent Overstreet
` (2 preceding siblings ...)
2023-08-13 18:26 ` [PATCH 3/3] block: Bring back zero_fill_bio_iter Kent Overstreet
@ 2023-08-14 21:42 ` Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2023-08-14 21:42 UTC (permalink / raw)
To: linux-block, linux-fsdevel, Kent Overstreet
On Sun, 13 Aug 2023 14:26:33 -0400, Kent Overstreet wrote:
> aiming for v6.6.
>
> The "block: Don't block on s_umount from __invalidate_super()" patch has
> been dropped for now - but we may want this later as there's a real bug
> it addresses, and with the blockdev holder changes now landing I suspect
> other filesystems will be hitting the same issue as bcachefs.
>
> [...]
Applied, thanks!
[1/3] block: Add some exports for bcachefs
commit: 7ba3792718709d410be5d971732b9251cbda67b6
[2/3] block: Allow bio_iov_iter_get_pages() with bio->bi_bdev unset
commit: 168145f617d57bf4e474901b7ffa869337a802e6
[3/3] block: Bring back zero_fill_bio_iter
commit: 649f070e69739d22c57c22dbce0788b72cd93fac
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-14 21:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-13 18:26 [PATCH 0/3] bcachefs block layer prereqs Kent Overstreet
2023-08-13 18:26 ` [PATCH 1/3] block: Add some exports for bcachefs Kent Overstreet
2023-08-13 18:26 ` [PATCH 2/3] block: Allow bio_iov_iter_get_pages() with bio->bi_bdev unset Kent Overstreet
2023-08-13 18:26 ` [PATCH 3/3] block: Bring back zero_fill_bio_iter Kent Overstreet
2023-08-14 21:42 ` [PATCH 0/3] bcachefs block layer prereqs Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).