dm integrity: introduce rw_journal_sectors()
Introduce a function rw_journal_sectors() that takes sector and length as its arguments instead of a section and the number of sections. This functions will be used in further patches. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
88ad5d1eb1
commit
981e8a980d
|
@ -761,12 +761,12 @@ static void complete_journal_io(unsigned long error, void *context)
|
|||
complete_journal_op(comp);
|
||||
}
|
||||
|
||||
static void rw_journal(struct dm_integrity_c *ic, int op, int op_flags, unsigned section,
|
||||
unsigned n_sections, struct journal_completion *comp)
|
||||
static void rw_journal_sectors(struct dm_integrity_c *ic, int op, int op_flags,
|
||||
unsigned sector, unsigned n_sectors, struct journal_completion *comp)
|
||||
{
|
||||
struct dm_io_request io_req;
|
||||
struct dm_io_region io_loc;
|
||||
unsigned sector, n_sectors, pl_index, pl_offset;
|
||||
unsigned pl_index, pl_offset;
|
||||
int r;
|
||||
|
||||
if (unlikely(dm_integrity_failed(ic))) {
|
||||
|
@ -775,9 +775,6 @@ static void rw_journal(struct dm_integrity_c *ic, int op, int op_flags, unsigned
|
|||
return;
|
||||
}
|
||||
|
||||
sector = section * ic->journal_section_sectors;
|
||||
n_sectors = n_sections * ic->journal_section_sectors;
|
||||
|
||||
pl_index = sector >> (PAGE_SHIFT - SECTOR_SHIFT);
|
||||
pl_offset = (sector << SECTOR_SHIFT) & (PAGE_SIZE - 1);
|
||||
|
||||
|
@ -810,6 +807,17 @@ static void rw_journal(struct dm_integrity_c *ic, int op, int op_flags, unsigned
|
|||
}
|
||||
}
|
||||
|
||||
static void rw_journal(struct dm_integrity_c *ic, int op, int op_flags, unsigned section,
|
||||
unsigned n_sections, struct journal_completion *comp)
|
||||
{
|
||||
unsigned sector, n_sectors;
|
||||
|
||||
sector = section * ic->journal_section_sectors;
|
||||
n_sectors = n_sections * ic->journal_section_sectors;
|
||||
|
||||
rw_journal_sectors(ic, op, op_flags, sector, n_sectors, comp);
|
||||
}
|
||||
|
||||
static void write_journal(struct dm_integrity_c *ic, unsigned commit_start, unsigned commit_sections)
|
||||
{
|
||||
struct journal_completion io_comp;
|
||||
|
|
Loading…
Reference in New Issue