Commit e01caa2b authored by Sui Jingfeng's avatar Sui Jingfeng Committed by Andrew Morton
Browse files

lib/scatterlist: use sg_phys() helper

This shorten the length of code in horizential direction, therefore is
easier to read.

Link: https://lkml.kernel.org/r/20241028182920.1025819-1-sui.jingfeng@linux.dev


Signed-off-by: default avatarSui Jingfeng <sui.jingfeng@linux.dev>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 2f07b652
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -474,14 +474,14 @@ int sg_alloc_append_table_from_pages(struct sg_append_table *sgt_append,
		return -EOPNOTSUPP;

	if (sgt_append->prv) {
		unsigned long next_pfn = (page_to_phys(sg_page(sgt_append->prv)) +
			sgt_append->prv->offset + sgt_append->prv->length) / PAGE_SIZE;
		unsigned long next_pfn;

		if (WARN_ON(offset))
			return -EINVAL;

		/* Merge contiguous pages into the last SG */
		prv_len = sgt_append->prv->length;
		next_pfn = (sg_phys(sgt_append->prv) + prv_len) / PAGE_SIZE;
		if (page_to_pfn(pages[0]) == next_pfn) {
			last_pg = pfn_to_page(next_pfn - 1);
			while (n_pages && pages_are_mergeable(pages[0], last_pg)) {