Skip to content

Commit 6b99013

Browse files
bvanasscheaxboe
authored andcommitted
dm-snap: Combine request operation type and flags
Pass the request operation and its flags as a single argument to improve kernel code uniformity. Cc: Alasdair Kergon <[email protected]> Cc: Mike Snitzer <[email protected]> Cc: Mikulas Patocka <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent c1389b3 commit 6b99013

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/md/dm-snap-persistent.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,16 @@ static void do_metadata(struct work_struct *work)
226226
/*
227227
* Read or write a chunk aligned and sized block of data from a device.
228228
*/
229-
static int chunk_io(struct pstore *ps, void *area, chunk_t chunk, int op,
230-
int op_flags, int metadata)
229+
static int chunk_io(struct pstore *ps, void *area, chunk_t chunk, blk_opf_t opf,
230+
int metadata)
231231
{
232232
struct dm_io_region where = {
233233
.bdev = dm_snap_cow(ps->store->snap)->bdev,
234234
.sector = ps->store->chunk_size * chunk,
235235
.count = ps->store->chunk_size,
236236
};
237237
struct dm_io_request io_req = {
238-
.bi_opf = op | op_flags,
238+
.bi_opf = opf,
239239
.mem.type = DM_IO_VMA,
240240
.mem.ptr.vma = area,
241241
.client = ps->io_client,
@@ -281,11 +281,11 @@ static void skip_metadata(struct pstore *ps)
281281
* Read or write a metadata area. Remembering to skip the first
282282
* chunk which holds the header.
283283
*/
284-
static int area_io(struct pstore *ps, int op, int op_flags)
284+
static int area_io(struct pstore *ps, blk_opf_t opf)
285285
{
286286
chunk_t chunk = area_location(ps, ps->current_area);
287287

288-
return chunk_io(ps, ps->area, chunk, op, op_flags, 0);
288+
return chunk_io(ps, ps->area, chunk, opf, 0);
289289
}
290290

291291
static void zero_memory_area(struct pstore *ps)
@@ -296,7 +296,7 @@ static void zero_memory_area(struct pstore *ps)
296296
static int zero_disk_area(struct pstore *ps, chunk_t area)
297297
{
298298
return chunk_io(ps, ps->zero_area, area_location(ps, area),
299-
REQ_OP_WRITE, 0, 0);
299+
REQ_OP_WRITE, 0);
300300
}
301301

302302
static int read_header(struct pstore *ps, int *new_snapshot)
@@ -328,7 +328,7 @@ static int read_header(struct pstore *ps, int *new_snapshot)
328328
if (r)
329329
return r;
330330

331-
r = chunk_io(ps, ps->header_area, 0, REQ_OP_READ, 0, 1);
331+
r = chunk_io(ps, ps->header_area, 0, REQ_OP_READ, 1);
332332
if (r)
333333
goto bad;
334334

@@ -389,7 +389,7 @@ static int write_header(struct pstore *ps)
389389
dh->version = cpu_to_le32(ps->version);
390390
dh->chunk_size = cpu_to_le32(ps->store->chunk_size);
391391

392-
return chunk_io(ps, ps->header_area, 0, REQ_OP_WRITE, 0, 1);
392+
return chunk_io(ps, ps->header_area, 0, REQ_OP_WRITE, 1);
393393
}
394394

395395
/*
@@ -733,8 +733,8 @@ static void persistent_commit_exception(struct dm_exception_store *store,
733733
/*
734734
* Commit exceptions to disk.
735735
*/
736-
if (ps->valid && area_io(ps, REQ_OP_WRITE,
737-
REQ_PREFLUSH | REQ_FUA | REQ_SYNC))
736+
if (ps->valid && area_io(ps, REQ_OP_WRITE | REQ_PREFLUSH | REQ_FUA |
737+
REQ_SYNC))
738738
ps->valid = 0;
739739

740740
/*
@@ -774,7 +774,7 @@ static int persistent_prepare_merge(struct dm_exception_store *store,
774774
return 0;
775775

776776
ps->current_area--;
777-
r = area_io(ps, REQ_OP_READ, 0);
777+
r = area_io(ps, REQ_OP_READ);
778778
if (r < 0)
779779
return r;
780780
ps->current_committed = ps->exceptions_per_area;
@@ -811,7 +811,7 @@ static int persistent_commit_merge(struct dm_exception_store *store,
811811
for (i = 0; i < nr_merged; i++)
812812
clear_exception(ps, ps->current_committed - 1 - i);
813813

814-
r = area_io(ps, REQ_OP_WRITE, REQ_PREFLUSH | REQ_FUA);
814+
r = area_io(ps, REQ_OP_WRITE | REQ_PREFLUSH | REQ_FUA);
815815
if (r < 0)
816816
return r;
817817

0 commit comments

Comments
 (0)