Message ID | 20240711050750.17792-6-kundan.kumar@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: add larger order folio instead of pages | expand |
On 11/07/24 10:37AM, Kundan Kumar wrote: >Add a new wrapper bio_release_folio() and use it to put refs by npages >count. > >Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com> >--- > block/bio.c | 6 +----- > block/blk.h | 6 ++++++ > 2 files changed, 7 insertions(+), 5 deletions(-) > >diff --git a/block/bio.c b/block/bio.c >index b4df3af3e303..ca249f2c99a7 100644 >--- a/block/bio.c >+++ b/block/bio.c >@@ -1207,7 +1207,6 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty) > struct folio_iter fi; > > bio_for_each_folio_all(fi, bio) { >- struct page *page; > size_t nr_pages; > > if (mark_dirty) { >@@ -1215,12 +1214,9 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty) > folio_mark_dirty(fi.folio); > folio_unlock(fi.folio); > } >- page = folio_page(fi.folio, fi.offset / PAGE_SIZE); > nr_pages = (fi.offset + fi.length - 1) / PAGE_SIZE - > fi.offset / PAGE_SIZE + 1; >- do { >- bio_release_page(bio, page++); >- } while (--nr_pages != 0); >+ bio_release_folio(bio, fi.folio, nr_pages); > } > } > EXPORT_SYMBOL_GPL(__bio_release_pages); >diff --git a/block/blk.h b/block/blk.h >index 777e1486f0de..8e266f0ace2b 100644 >--- a/block/blk.h >+++ b/block/blk.h >@@ -558,6 +558,12 @@ static inline void bio_release_page(struct bio *bio, struct page *page) > unpin_user_page(page); > } > >+static inline void bio_release_folio(struct bio *bio, struct folio *folio, >+ unsigned long npages) >+{ >+ unpin_user_folio(folio, npages); >+} >+ > struct request_queue *blk_alloc_queue(struct queue_limits *lim, int node_id); > > int disk_scan_partitions(struct gendisk *disk, blk_mode_t mode); Hi Christoph, Willy a gentle ping here. Any comments on the v8 patchset? Thanks, Kundan >-- >2.25.1 > >
On Thu, Jul 11, 2024 at 10:50 AM Kundan Kumar <kundan.kumar@samsung.com> wrote: > > @@ -1215,12 +1214,9 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty) > folio_mark_dirty(fi.folio); > folio_unlock(fi.folio); > } > - page = folio_page(fi.folio, fi.offset / PAGE_SIZE); > nr_pages = (fi.offset + fi.length - 1) / PAGE_SIZE - > fi.offset / PAGE_SIZE + 1; > - do { > - bio_release_page(bio, page++); > - } while (--nr_pages != 0); > + bio_release_folio(bio, fi.folio, nr_pages); Wouldn't it be better to use unpin_user_folio (introduced in the previous patch) here, rather than using bio_release_folio. > } > } > EXPORT_SYMBOL_GPL(__bio_release_pages); > diff --git a/block/blk.h b/block/blk.h > index 777e1486f0de..8e266f0ace2b 100644 > --- a/block/blk.h > +++ b/block/blk.h > @@ -558,6 +558,12 @@ static inline void bio_release_page(struct bio *bio, struct page *page) > unpin_user_page(page); > } > > +static inline void bio_release_folio(struct bio *bio, struct folio *folio, > + unsigned long npages) > +{ > + unpin_user_folio(folio, npages); > +} > + This function takes bio as a parameter but doesn't really use it. Also if we use unpin_user_folio at the previous place, we wouldn't really need to introduce this function. . > struct request_queue *blk_alloc_queue(struct queue_limits *lim, int node_id); > > int disk_scan_partitions(struct gendisk *disk, blk_mode_t mode); > -- > 2.25.1 > > Could you give this series a respin against the latest for-next, some patches don't apply cleanly now. -- Anuj Gupta
On Thu, Jul 11, 2024 at 10:37:50AM +0530, Kundan Kumar wrote: > +static inline void bio_release_folio(struct bio *bio, struct folio *folio, > + unsigned long npages) > +{ > + unpin_user_folio(folio, npages); > +} Why doesn't this need to check BIO_PAGE_PINNED like bio_release_page() does? That should be explained, certainly in the commit message or maybe in a comment.
diff --git a/block/bio.c b/block/bio.c index b4df3af3e303..ca249f2c99a7 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1207,7 +1207,6 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty) struct folio_iter fi; bio_for_each_folio_all(fi, bio) { - struct page *page; size_t nr_pages; if (mark_dirty) { @@ -1215,12 +1214,9 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty) folio_mark_dirty(fi.folio); folio_unlock(fi.folio); } - page = folio_page(fi.folio, fi.offset / PAGE_SIZE); nr_pages = (fi.offset + fi.length - 1) / PAGE_SIZE - fi.offset / PAGE_SIZE + 1; - do { - bio_release_page(bio, page++); - } while (--nr_pages != 0); + bio_release_folio(bio, fi.folio, nr_pages); } } EXPORT_SYMBOL_GPL(__bio_release_pages); diff --git a/block/blk.h b/block/blk.h index 777e1486f0de..8e266f0ace2b 100644 --- a/block/blk.h +++ b/block/blk.h @@ -558,6 +558,12 @@ static inline void bio_release_page(struct bio *bio, struct page *page) unpin_user_page(page); } +static inline void bio_release_folio(struct bio *bio, struct folio *folio, + unsigned long npages) +{ + unpin_user_folio(folio, npages); +} + struct request_queue *blk_alloc_queue(struct queue_limits *lim, int node_id); int disk_scan_partitions(struct gendisk *disk, blk_mode_t mode);
Add a new wrapper bio_release_folio() and use it to put refs by npages count. Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com> --- block/bio.c | 6 +----- block/blk.h | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-)