aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-05-17 23:36:55 -0400
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-08-02 12:34:03 -0400
commit8b5d143c95533aa18ac3b39b82568391a7225a61 (patch)
tree2dd911a2e81da889e3ed26f94f1f31037029cd09 /block
parentcramfs: read_mapping_page() is synchronous (diff)
downloadlinux-dev-8b5d143c95533aa18ac3b39b82568391a7225a61.tar.xz
linux-dev-8b5d143c95533aa18ac3b39b82568391a7225a61.zip
block: Simplify read_part_sector()
That rather complicated expression is just trying to find the offset of this sector within a page, and there are easier ways to express that. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'block')
-rw-r--r--block/partitions/core.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index a9a51bac42df..52871fa224ee 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -718,8 +718,7 @@ void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p)
goto out;
p->v = page;
- return (unsigned char *)page_address(page) +
- ((n & ((1 << (PAGE_SHIFT - 9)) - 1)) << SECTOR_SHIFT);
+ return page_address(page) + offset_in_page(n * SECTOR_SIZE);
out:
p->v = NULL;
return NULL;