Re: [PATCH v4 1/2] block: add folio awareness instead of looping through pages

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

 



On Wed, Jun 05, 2024 at 02:54:54PM +0530, Kundan Kumar wrote:
> +			/*
> +			 * Check if pages are contiguous and belong to the
> +			 * same folio.
> +			 */

Oh, a useful comment here would be *why* we do this, not *what* we do.

			/*
			 * We might COW a single page in the middle of
			 * a large folio, so we have to check that all
			 * pages belong to the same folio.
			 */

for example.

> +			for (j = i + 1; j < i + num_pages; j++) {
> +				size_t next = min_t(size_t, PAGE_SIZE, bytes);
> +
> +				if (page_folio(pages[j]) != folio ||
> +				    pages[j] != pages[j - 1] + 1) {
> +					break;
> +				}
> +				contig_sz += next;
> +				bytes -= next;
> +			}
> +			num_pages = j - i;
> +			len = contig_sz;
> +		}




[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