Re: [Cluster-devel] [PATCH v3 17/19] md: raid1: check if adding pages to resync bio fails

2023-04-19 Thread Song Liu
On Wed, Apr 19, 2023 at 7:11 AM Johannes Thumshirn wrote: > > From: Johannes Thumshirn > > Check if adding pages to resync bio fails and if bail out. > > As the comment above suggests this cannot happen, WARN if it actually > happens. > > This way we can mark bio_add_pages as __must_check. > >

[Cluster-devel] [PATCH v3 10/19] jfs: logmgr: use __bio_add_page to add single page to bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The JFS IO code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to

[Cluster-devel] [PATCH v3 11/19] gfs: use __bio_add_page for adding single page to bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The GFS superblock reading code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step

[Cluster-devel] [PATCH v3 13/19] zram: use __bio_add_page for adding single page to bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The zram writeback code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer

[Cluster-devel] [PATCH v3 17/19] md: raid1: check if adding pages to resync bio fails

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn Check if adding pages to resync bio fails and if bail out. As the comment above suggests this cannot happen, WARN if it actually happens. This way we can mark bio_add_pages as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal ---

[Cluster-devel] [PATCH v3 01/19] swap: use __bio_add_page to add page to bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The swap code only adds a single page to a newly created bio. So use __bio_add_page() to add the page which is guaranteed to succeed in this case. This brings us closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le

[Cluster-devel] [PATCH v3 04/19] fs: buffer: use __bio_add_page to add single page to bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The buffer_head submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step

Re: [Cluster-devel] [PATCH v3 11/19] gfs: use __bio_add_page for adding single page to bio

2023-04-19 Thread Andreas Gruenbacher
On Wed, Apr 19, 2023 at 4:10 PM Johannes Thumshirn wrote: > > From: Johannes Thumshirn > > The GFS superblock reading code uses bio_add_page() to add a page to a > newly created bio. bio_add_page() can fail, but the return value is never > checked. It's GFS2, not GFS, but otherwise this is

[Cluster-devel] [PATCH v3 00/19] bio: check return values of bio_add_page

2023-04-19 Thread Johannes Thumshirn
We have two functions for adding a page to a bio, __bio_add_page() which is used to add a single page to a freshly created bio and bio_add_page() which is used to add a page to an existing bio. While __bio_add_page() is expected to succeed, bio_add_page() can fail. This series converts the

[Cluster-devel] [PATCH v3 03/19] dm: dm-zoned: use __bio_add_page for adding single metadata page

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn dm-zoned uses bio_add_page() for adding a single page to a freshly created metadata bio. Use __bio_add_page() instead as adding a single page to a new bio is always guaranteed to succeed. This brings us a step closer to marking bio_add_page() __must_check

[Cluster-devel] [PATCH v3 16/19] md: raid1: use __bio_add_page for adding single page to bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The sync request code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to

[Cluster-devel] [PATCH v3 18/19] dm-crypt: check if adding pages to clone bio fails

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn Check if adding pages to clone bio fails and if it does retry with reclaim. This mirrors the behaviour of page allocation in crypt_alloc_buffer(). This way we can mark bio_add_pages as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal ---

[Cluster-devel] [PATCH v3 07/19] md: raid5: use __bio_add_page to add single page to new bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The raid5-ppl submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. For adding consecutive pages, the return is actually checked and a new bio is allocated if adding the page fails. Use

[Cluster-devel] [PATCH v3 08/19] btrfs: repair: use __bio_add_page for adding single page

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The btrfs repair bio submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a

[Cluster-devel] [PATCH v3 09/19] btrfs: raid56: use __bio_add_page to add single page

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The btrfs raid58 sector submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings

[Cluster-devel] [PATCH v3 19/19] block: mark bio_add_page as __must_check

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn Now that all users of bio_add_page check for the return value, mark bio_add_page as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[Cluster-devel] [PATCH v3 05/19] md: use __bio_add_page to add single page

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The md-raid superblock writing code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a

[Cluster-devel] [PATCH v3 02/19] drbd: use __bio_add_page to add page to bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The drbd code only adds a single page to a newly created bio. So use __bio_add_page() to add the page which is guaranteed to succeed in this case. This brings us closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le

[Cluster-devel] [PATCH v3 06/19] md: raid5-log: use __bio_add_page to add single page

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The raid5 log metadata submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us

[Cluster-devel] [PATCH v3 15/19] md: check for failure when adding pages in alloc_behind_master_bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn alloc_behind_master_bio() can possibly add multiple pages to a bio, but it is not checking for the return value of bio_add_page() if adding really succeeded. Check if the page adding succeeded and if not bail out. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien

[Cluster-devel] [PATCH v3 12/19] zonefs: use __bio_add_page for adding single page to bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The zonefs superblock reading code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a

Re: [Cluster-devel] [PATCH v3 19/19] block: mark bio_add_page as __must_check

2023-04-19 Thread Johannes Thumshirn
On 19/04/2023 16:19, Matthew Wilcox wrote: On Wed, Apr 19, 2023 at 04:09:29PM +0200, Johannes Thumshirn wrote: Now that all users of bio_add_page check for the return value, mark bio_add_page as __must_check. Should probably add __must_check to bio_add_folio too? If this is really the way

Re: [Cluster-devel] [PATCH v3 19/19] block: mark bio_add_page as __must_check

2023-04-19 Thread Matthew Wilcox
On Wed, Apr 19, 2023 at 04:09:29PM +0200, Johannes Thumshirn wrote: > Now that all users of bio_add_page check for the return value, mark > bio_add_page as __must_check. Should probably add __must_check to bio_add_folio too? If this is really the way you want to go ... means we also need a

[Cluster-devel] [PATCH v3 14/19] floppy: use __bio_add_page for adding single page to bio

2023-04-19 Thread Johannes Thumshirn
From: Johannes Thumshirn The floppy code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to