diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-05-17 23:36:55 -0400 |
---|---|---|
committer | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-06-26 09:47:16 -0400 |
commit | 8c83f56da6d665640b6f6ab77cd099f7a749b986 (patch) | |
tree | 98448743be7f1c289ce48c8dc444e438e84cd971 /block | |
parent | 4bb746416245103148de17011d28ff27f897f1dc (diff) | |
download | linux-next-8c83f56da6d665640b6f6ab77cd099f7a749b986.tar.gz |
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.c | 3 |
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; |