From: Mikulas Patocka <mpatocka@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>,
Mike Snitzer <msnitzer@redhat.com>,
"Alasdair G. Kergon" <agk@redhat.com>,
Milan Broz <mbroz@redhat.com>
Cc: dm-devel@redhat.com
Subject: [patch 4/8] dm-integrity: add ic->start in get_data_sector
Date: Tue, 01 May 2018 15:55:20 +0200 [thread overview]
Message-ID: <20180501135602.961941544@debian.vm> (raw)
In-Reply-To: 20180501135516.961417937@debian.vm
[-- Attachment #1: dm-integrity-move-start-to-get_data_sector.patch --]
[-- Type: text/plain, Size: 1701 bytes --]
A small refactoring. Add the variable ic->start in get_data_sector and not
in the callers. This is a prerequisite for the patch that uses external
metadata device.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
---
drivers/md/dm-integrity.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-integrity.c 2018-02-01 20:38:17.038213000 +0100
+++ linux-2.6/drivers/md/dm-integrity.c 2018-02-06 17:31:35.816018000 +0100
@@ -386,6 +386,8 @@ static sector_t get_data_sector(struct d
result += (area + 1) * ic->metadata_run;
result += (sector_t)ic->initial_sectors + offset;
+ result += ic->start;
+
return result;
}
@@ -857,7 +859,7 @@ static void copy_from_journal(struct dm_
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);
@@ -1701,7 +1703,6 @@ sleep:
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) {
@@ -2339,7 +2340,7 @@ static int calculate_device_limits(struc
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;
next prev parent reply other threads:[~2018-05-01 13:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-01 13:55 [patch 0/8] dm-integrity patches Mikulas Patocka
2018-05-01 13:55 ` [patch 1/8] dm-integrity: use kvfree Mikulas Patocka
2018-05-01 13:55 ` [patch 2/8] dm-integrity: change the variable suspending from bool to int Mikulas Patocka
2018-05-01 13:55 ` [patch 3/8] dm-integrity: report size in the status Mikulas Patocka
2018-05-01 13:55 ` Mikulas Patocka [this message]
2018-05-01 13:55 ` [patch 5/8] dm-integrity: allow external devices Mikulas Patocka
2018-05-01 13:55 ` [patch 6/8] dm-integrity: use version 2 for separate metadata Mikulas Patocka
2018-05-01 13:55 ` [patch 7/8] dm-integrity: flush journal on suspend when using separate device Mikulas Patocka
2018-05-01 13:55 ` [patch 8/8] dm-integrity: recalculate checksums Mikulas Patocka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180501135602.961941544@debian.vm \
--to=mpatocka@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=mbroz@redhat.com \
--cc=msnitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox