Re: [PATCH v8 5/5] block: unpin user pages belonging to a folio at once

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
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







[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux