Re: [PATCH v4 2/2] block: unpin user pages belonging to a folio

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

 



On Wed, Jun 05, 2024 at 02:54:55PM +0530, Kundan Kumar wrote:
> -		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_page(bio, &fi.folio->page);
>  	}

Why can't we have ...

		bio_release_folio(bio, fi.folio, nr_pages);

which is implemented as:

static inline void bio_release_page(struct bio *bio, struct folio *folio, unsigned long nr_pages)
{
	if (bio_flagged(bio, BIO_PAGE_PINNED))
		gup_put_folio(folio, nr_pages, FOLL_PIN);
}

Sure, we'd need to make gup_put_folio() unstatic, but this seems far
more sensible.





[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