diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2018-07-03 21:13:29 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2018-07-27 22:24:24 +0300 |
commit | 71e9ddbcb99e9bf1f968906b395e172ea8328365 (patch) | |
tree | d7f912802f7ec11d8936b32625ff40158b9d56fa /drivers/md/dm-integrity.c | |
parent | f84fd2c98480fa0e3c0b43996c4e235bdf4a9527 (diff) | |
download | linux-71e9ddbcb99e9bf1f968906b395e172ea8328365.tar.xz |
dm integrity: add ic->start in get_data_sector()
A small refactoring. Add the variable ic->start to the result
returned by get_data_sector() and not in the callers. This is a
prerequisite for the commit that adds the ability to use an external
metadata device.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-integrity.c')
-rw-r--r-- | drivers/md/dm-integrity.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index 09dadb771a62..39d465e92f74 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -394,6 +394,8 @@ static sector_t get_data_sector(struct dm_integrity_c *ic, sector_t area, sector result += (area + 1) * ic->metadata_run; result += (sector_t)ic->initial_sectors + offset; + result += ic->start; + return result; } @@ -865,7 +867,7 @@ static void copy_from_journal(struct dm_integrity_c *ic, unsigned section, unsig io_req.notify.context = data; io_req.client = ic->io; io_loc.bdev = ic->dev->bdev; - io_loc.sector = ic->start + target; + io_loc.sector = target; io_loc.count = n_sectors; r = dm_io(&io_req, 1, &io_loc, NULL); @@ -1753,7 +1755,6 @@ offload_to_thread: bio->bi_end_io = integrity_end_io; bio->bi_iter.bi_size = dio->range.n_sectors << SECTOR_SHIFT; - bio->bi_iter.bi_sector += ic->start; generic_make_request(bio); if (need_sync_io) { @@ -2391,7 +2392,7 @@ static int calculate_device_limits(struct dm_integrity_c *ic) get_area_and_offset(ic, ic->provided_data_sectors - 1, &last_area, &last_offset); last_sector = get_data_sector(ic, last_area, last_offset); - if (ic->start + last_sector < last_sector || ic->start + last_sector >= ic->device_sectors) + if (last_sector < ic->start || last_sector >= ic->device_sectors) return -EINVAL; return 0; |