block/fs/drivers: remove rw argument from submit_bio

This has callers of submit_bio/submit_bio_wait set the bio->bi_rw
instead of passing it in. This makes that use the same as
generic_make_request and how we set the other bio fields.

Signed-off-by: Mike Christie <mchristi@redhat.com>

Fixed up fs/ext4/crypto.c

Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
Mike Christie
2016-06-05 14:31:41 -05:00
committed by Jens Axboe
parent af8c34ce6a
commit 4e49ea4a3d
53 changed files with 221 additions and 148 deletions
+3 -4
View File
@@ -854,21 +854,20 @@ static void submit_bio_wait_endio(struct bio *bio)
/** /**
* submit_bio_wait - submit a bio, and wait until it completes * submit_bio_wait - submit a bio, and wait until it completes
* @rw: whether to %READ or %WRITE, or maybe to %READA (read ahead)
* @bio: The &struct bio which describes the I/O * @bio: The &struct bio which describes the I/O
* *
* Simple wrapper around submit_bio(). Returns 0 on success, or the error from * Simple wrapper around submit_bio(). Returns 0 on success, or the error from
* bio_endio() on failure. * bio_endio() on failure.
*/ */
int submit_bio_wait(int rw, struct bio *bio) int submit_bio_wait(struct bio *bio)
{ {
struct submit_bio_ret ret; struct submit_bio_ret ret;
rw |= REQ_SYNC;
init_completion(&ret.event); init_completion(&ret.event);
bio->bi_private = &ret; bio->bi_private = &ret;
bio->bi_end_io = submit_bio_wait_endio; bio->bi_end_io = submit_bio_wait_endio;
submit_bio(rw, bio); bio->bi_rw |= REQ_SYNC;
submit_bio(bio);
wait_for_completion_io(&ret.event); wait_for_completion_io(&ret.event);
return ret.error; return ret.error;
+4 -7
View File
@@ -2094,7 +2094,6 @@ EXPORT_SYMBOL(generic_make_request);
/** /**
* submit_bio - submit a bio to the block device layer for I/O * submit_bio - submit a bio to the block device layer for I/O
* @rw: whether to %READ or %WRITE, or maybe to %READA (read ahead)
* @bio: The &struct bio which describes the I/O * @bio: The &struct bio which describes the I/O
* *
* submit_bio() is very similar in purpose to generic_make_request(), and * submit_bio() is very similar in purpose to generic_make_request(), and
@@ -2102,10 +2101,8 @@ EXPORT_SYMBOL(generic_make_request);
* interfaces; @bio must be presetup and ready for I/O. * interfaces; @bio must be presetup and ready for I/O.
* *
*/ */
blk_qc_t submit_bio(int rw, struct bio *bio) blk_qc_t submit_bio(struct bio *bio)
{ {
bio->bi_rw |= rw;
/* /*
* If it's a regular read/write or a barrier with data attached, * If it's a regular read/write or a barrier with data attached,
* go through the normal accounting stuff before submission. * go through the normal accounting stuff before submission.
@@ -2113,12 +2110,12 @@ blk_qc_t submit_bio(int rw, struct bio *bio)
if (bio_has_data(bio)) { if (bio_has_data(bio)) {
unsigned int count; unsigned int count;
if (unlikely(rw & REQ_WRITE_SAME)) if (unlikely(bio->bi_rw & REQ_WRITE_SAME))
count = bdev_logical_block_size(bio->bi_bdev) >> 9; count = bdev_logical_block_size(bio->bi_bdev) >> 9;
else else
count = bio_sectors(bio); count = bio_sectors(bio);
if (rw & WRITE) { if (bio->bi_rw & WRITE) {
count_vm_events(PGPGOUT, count); count_vm_events(PGPGOUT, count);
} else { } else {
task_io_account_read(bio->bi_iter.bi_size); task_io_account_read(bio->bi_iter.bi_size);
@@ -2129,7 +2126,7 @@ blk_qc_t submit_bio(int rw, struct bio *bio)
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
printk(KERN_DEBUG "%s(%d): %s block %Lu on %s (%u sectors)\n", printk(KERN_DEBUG "%s(%d): %s block %Lu on %s (%u sectors)\n",
current->comm, task_pid_nr(current), current->comm, task_pid_nr(current),
(rw & WRITE) ? "WRITE" : "READ", (bio->bi_rw & WRITE) ? "WRITE" : "READ",
(unsigned long long)bio->bi_iter.bi_sector, (unsigned long long)bio->bi_iter.bi_sector,
bdevname(bio->bi_bdev, b), bdevname(bio->bi_bdev, b),
count); count);
+2 -1
View File
@@ -485,8 +485,9 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
bio = bio_alloc(gfp_mask, 0); bio = bio_alloc(gfp_mask, 0);
bio->bi_bdev = bdev; bio->bi_bdev = bdev;
bio->bi_rw = WRITE_FLUSH;
ret = submit_bio_wait(WRITE_FLUSH, bio); ret = submit_bio_wait(bio);
/* /*
* The driver must store the error location in ->bi_sector, if * The driver must store the error location in ->bi_sector, if
+11 -9
View File
@@ -9,14 +9,14 @@
#include "blk.h" #include "blk.h"
static struct bio *next_bio(struct bio *bio, int rw, unsigned int nr_pages, static struct bio *next_bio(struct bio *bio, unsigned int nr_pages,
gfp_t gfp) gfp_t gfp)
{ {
struct bio *new = bio_alloc(gfp, nr_pages); struct bio *new = bio_alloc(gfp, nr_pages);
if (bio) { if (bio) {
bio_chain(bio, new); bio_chain(bio, new);
submit_bio(rw, bio); submit_bio(bio);
} }
return new; return new;
@@ -62,9 +62,10 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
req_sects = end_sect - sector; req_sects = end_sect - sector;
} }
bio = next_bio(bio, type, 1, gfp_mask); bio = next_bio(bio, 1, gfp_mask);
bio->bi_iter.bi_sector = sector; bio->bi_iter.bi_sector = sector;
bio->bi_bdev = bdev; bio->bi_bdev = bdev;
bio->bi_rw = type;
bio->bi_iter.bi_size = req_sects << 9; bio->bi_iter.bi_size = req_sects << 9;
nr_sects -= req_sects; nr_sects -= req_sects;
@@ -110,7 +111,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
ret = __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, type, ret = __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, type,
&bio); &bio);
if (!ret && bio) { if (!ret && bio) {
ret = submit_bio_wait(type, bio); ret = submit_bio_wait(bio);
if (ret == -EOPNOTSUPP) if (ret == -EOPNOTSUPP)
ret = 0; ret = 0;
} }
@@ -147,13 +148,14 @@ int blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
max_write_same_sectors = UINT_MAX >> 9; max_write_same_sectors = UINT_MAX >> 9;
while (nr_sects) { while (nr_sects) {
bio = next_bio(bio, REQ_WRITE | REQ_WRITE_SAME, 1, gfp_mask); bio = next_bio(bio, 1, gfp_mask);
bio->bi_iter.bi_sector = sector; bio->bi_iter.bi_sector = sector;
bio->bi_bdev = bdev; bio->bi_bdev = bdev;
bio->bi_vcnt = 1; bio->bi_vcnt = 1;
bio->bi_io_vec->bv_page = page; bio->bi_io_vec->bv_page = page;
bio->bi_io_vec->bv_offset = 0; bio->bi_io_vec->bv_offset = 0;
bio->bi_io_vec->bv_len = bdev_logical_block_size(bdev); bio->bi_io_vec->bv_len = bdev_logical_block_size(bdev);
bio->bi_rw = REQ_WRITE | REQ_WRITE_SAME;
if (nr_sects > max_write_same_sectors) { if (nr_sects > max_write_same_sectors) {
bio->bi_iter.bi_size = max_write_same_sectors << 9; bio->bi_iter.bi_size = max_write_same_sectors << 9;
@@ -166,7 +168,7 @@ int blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
} }
if (bio) if (bio)
ret = submit_bio_wait(REQ_WRITE | REQ_WRITE_SAME, bio); ret = submit_bio_wait(bio);
return ret != -EOPNOTSUPP ? ret : 0; return ret != -EOPNOTSUPP ? ret : 0;
} }
EXPORT_SYMBOL(blkdev_issue_write_same); EXPORT_SYMBOL(blkdev_issue_write_same);
@@ -190,11 +192,11 @@ static int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
unsigned int sz; unsigned int sz;
while (nr_sects != 0) { while (nr_sects != 0) {
bio = next_bio(bio, WRITE, bio = next_bio(bio, min(nr_sects, (sector_t)BIO_MAX_PAGES),
min(nr_sects, (sector_t)BIO_MAX_PAGES),
gfp_mask); gfp_mask);
bio->bi_iter.bi_sector = sector; bio->bi_iter.bi_sector = sector;
bio->bi_bdev = bdev; bio->bi_bdev = bdev;
bio->bi_rw = REQ_WRITE;
while (nr_sects != 0) { while (nr_sects != 0) {
sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects); sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects);
@@ -207,7 +209,7 @@ static int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
} }
if (bio) if (bio)
return submit_bio_wait(WRITE, bio); return submit_bio_wait(bio);
return 0; return 0;
} }
+1 -1
View File
@@ -177,7 +177,7 @@ static int _drbd_md_sync_page_io(struct drbd_device *device,
if (drbd_insert_fault(device, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD)) if (drbd_insert_fault(device, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD))
bio_io_error(bio); bio_io_error(bio);
else else
submit_bio(rw, bio); submit_bio(bio);
wait_until_done_or_force_detached(device, bdev, &device->md_io.done); wait_until_done_or_force_detached(device, bdev, &device->md_io.done);
if (!bio->bi_error) if (!bio->bi_error)
err = device->md_io.error; err = device->md_io.error;
+2 -2
View File
@@ -1011,12 +1011,12 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_ho
bio_add_page(bio, page, len, 0); bio_add_page(bio, page, len, 0);
bio->bi_private = ctx; bio->bi_private = ctx;
bio->bi_end_io = drbd_bm_endio; bio->bi_end_io = drbd_bm_endio;
bio->bi_rw = rw;
if (drbd_insert_fault(device, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD)) { if (drbd_insert_fault(device, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD)) {
bio->bi_rw |= rw;
bio_io_error(bio); bio_io_error(bio);
} else { } else {
submit_bio(rw, bio); submit_bio(bio);
/* this should not count as user activity and cause the /* this should not count as user activity and cause the
* resync to throttle -- see drbd_rs_should_slow_down(). */ * resync to throttle -- see drbd_rs_should_slow_down(). */
atomic_add(len >> 9, &device->rs_sect_ev); atomic_add(len >> 9, &device->rs_sect_ev);
+2 -1
View File
@@ -3822,8 +3822,9 @@ static int __floppy_read_block_0(struct block_device *bdev, int drive)
bio.bi_flags |= (1 << BIO_QUIET); bio.bi_flags |= (1 << BIO_QUIET);
bio.bi_private = &cbdata; bio.bi_private = &cbdata;
bio.bi_end_io = floppy_rb0_cb; bio.bi_end_io = floppy_rb0_cb;
bio.bi_rw = READ;
submit_bio(READ, &bio); submit_bio(&bio);
process_fd_request(); process_fd_request();
init_completion(&cbdata.complete); init_completion(&cbdata.complete);
+3 -1
View File
@@ -1369,6 +1369,7 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
bio->bi_private = pending_req; bio->bi_private = pending_req;
bio->bi_end_io = end_block_io_op; bio->bi_end_io = end_block_io_op;
bio->bi_iter.bi_sector = preq.sector_number; bio->bi_iter.bi_sector = preq.sector_number;
bio->bi_rw = operation;
} }
preq.sector_number += seg[i].nsec; preq.sector_number += seg[i].nsec;
@@ -1386,13 +1387,14 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
bio->bi_bdev = preq.bdev; bio->bi_bdev = preq.bdev;
bio->bi_private = pending_req; bio->bi_private = pending_req;
bio->bi_end_io = end_block_io_op; bio->bi_end_io = end_block_io_op;
bio->bi_rw = operation;
} }
atomic_set(&pending_req->pendcnt, nbio); atomic_set(&pending_req->pendcnt, nbio);
blk_start_plug(&plug); blk_start_plug(&plug);
for (i = 0; i < nbio; i++) for (i = 0; i < nbio; i++)
submit_bio(operation, biolist[i]); submit_bio(biolist[i]);
/* Let the I/Os go.. */ /* Let the I/Os go.. */
blk_finish_plug(&plug); blk_finish_plug(&plug);
+2 -2
View File
@@ -2114,7 +2114,7 @@ static int blkif_recover(struct blkfront_info *info)
bio_trim(cloned_bio, offset, size); bio_trim(cloned_bio, offset, size);
cloned_bio->bi_private = split_bio; cloned_bio->bi_private = split_bio;
cloned_bio->bi_end_io = split_bio_end; cloned_bio->bi_end_io = split_bio_end;
submit_bio(cloned_bio->bi_rw, cloned_bio); submit_bio(cloned_bio);
} }
/* /*
* Now we have to wait for all those smaller bios to * Now we have to wait for all those smaller bios to
@@ -2123,7 +2123,7 @@ static int blkif_recover(struct blkfront_info *info)
continue; continue;
} }
/* We don't need to split this bio */ /* We don't need to split this bio */
submit_bio(bio->bi_rw, bio); submit_bio(bio);
} }
return 0; return 0;
+4 -2
View File
@@ -52,9 +52,10 @@ void bch_btree_verify(struct btree *b)
bio->bi_bdev = PTR_CACHE(b->c, &b->key, 0)->bdev; bio->bi_bdev = PTR_CACHE(b->c, &b->key, 0)->bdev;
bio->bi_iter.bi_sector = PTR_OFFSET(&b->key, 0); bio->bi_iter.bi_sector = PTR_OFFSET(&b->key, 0);
bio->bi_iter.bi_size = KEY_SIZE(&v->key) << 9; bio->bi_iter.bi_size = KEY_SIZE(&v->key) << 9;
bio->bi_rw = REQ_META|READ_SYNC;
bch_bio_map(bio, sorted); bch_bio_map(bio, sorted);
submit_bio_wait(REQ_META|READ_SYNC, bio); submit_bio_wait(bio);
bch_bbio_free(bio, b->c); bch_bbio_free(bio, b->c);
memcpy(ondisk, sorted, KEY_SIZE(&v->key) << 9); memcpy(ondisk, sorted, KEY_SIZE(&v->key) << 9);
@@ -113,11 +114,12 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio)
check = bio_clone(bio, GFP_NOIO); check = bio_clone(bio, GFP_NOIO);
if (!check) if (!check)
return; return;
check->bi_rw |= READ_SYNC;
if (bio_alloc_pages(check, GFP_NOIO)) if (bio_alloc_pages(check, GFP_NOIO))
goto out_put; goto out_put;
submit_bio_wait(READ_SYNC, check); submit_bio_wait(check);
bio_for_each_segment(bv, bio, iter) { bio_for_each_segment(bv, bio, iter) {
void *p1 = kmap_atomic(bv.bv_page); void *p1 = kmap_atomic(bv.bv_page);
+1 -1
View File
@@ -418,7 +418,7 @@ static void journal_discard_work(struct work_struct *work)
struct journal_device *ja = struct journal_device *ja =
container_of(work, struct journal_device, discard_work); container_of(work, struct journal_device, discard_work);
submit_bio(0, &ja->discard_bio); submit_bio(&ja->discard_bio);
} }
static void do_journal_discard(struct cache *ca) static void do_journal_discard(struct cache *ca)
+2 -2
View File
@@ -212,7 +212,7 @@ static void __write_super(struct cache_sb *sb, struct bio *bio)
unsigned i; unsigned i;
bio->bi_iter.bi_sector = SB_SECTOR; bio->bi_iter.bi_sector = SB_SECTOR;
bio->bi_rw = REQ_SYNC|REQ_META; bio->bi_rw = REQ_WRITE|REQ_SYNC|REQ_META;
bio->bi_iter.bi_size = SB_SIZE; bio->bi_iter.bi_size = SB_SIZE;
bch_bio_map(bio, NULL); bch_bio_map(bio, NULL);
@@ -238,7 +238,7 @@ static void __write_super(struct cache_sb *sb, struct bio *bio)
pr_debug("ver %llu, flags %llu, seq %llu", pr_debug("ver %llu, flags %llu, seq %llu",
sb->version, sb->flags, sb->seq); sb->version, sb->flags, sb->seq);
submit_bio(REQ_WRITE, bio); submit_bio(bio);
} }
static void bch_write_bdev_super_unlock(struct closure *cl) static void bch_write_bdev_super_unlock(struct closure *cl)
+2 -1
View File
@@ -634,6 +634,7 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block,
* the dm_buffer's inline bio is local to bufio. * the dm_buffer's inline bio is local to bufio.
*/ */
b->bio.bi_private = end_io; b->bio.bi_private = end_io;
b->bio.bi_rw = rw;
/* /*
* We assume that if len >= PAGE_SIZE ptr is page-aligned. * We assume that if len >= PAGE_SIZE ptr is page-aligned.
@@ -660,7 +661,7 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block,
ptr += PAGE_SIZE; ptr += PAGE_SIZE;
} while (len > 0); } while (len > 0);
submit_bio(rw, &b->bio); submit_bio(&b->bio);
} }
static void submit_io(struct dm_buffer *b, int rw, sector_t block, static void submit_io(struct dm_buffer *b, int rw, sector_t block,
+2 -1
View File
@@ -322,6 +322,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
bio->bi_iter.bi_sector = where->sector + (where->count - remaining); bio->bi_iter.bi_sector = where->sector + (where->count - remaining);
bio->bi_bdev = where->bdev; bio->bi_bdev = where->bdev;
bio->bi_end_io = endio; bio->bi_end_io = endio;
bio->bi_rw = rw;
store_io_and_region_in_bio(bio, io, region); store_io_and_region_in_bio(bio, io, region);
if (rw & REQ_DISCARD) { if (rw & REQ_DISCARD) {
@@ -355,7 +356,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
} }
atomic_inc(&io->count); atomic_inc(&io->count);
submit_bio(rw, bio); submit_bio(bio);
} while (remaining); } while (remaining);
} }
+6 -3
View File
@@ -205,6 +205,7 @@ static int write_metadata(struct log_writes_c *lc, void *entry,
bio->bi_bdev = lc->logdev->bdev; bio->bi_bdev = lc->logdev->bdev;
bio->bi_end_io = log_end_io; bio->bi_end_io = log_end_io;
bio->bi_private = lc; bio->bi_private = lc;
bio->bi_rw = WRITE;
page = alloc_page(GFP_KERNEL); page = alloc_page(GFP_KERNEL);
if (!page) { if (!page) {
@@ -226,7 +227,7 @@ static int write_metadata(struct log_writes_c *lc, void *entry,
DMERR("Couldn't add page to the log block"); DMERR("Couldn't add page to the log block");
goto error_bio; goto error_bio;
} }
submit_bio(WRITE, bio); submit_bio(bio);
return 0; return 0;
error_bio: error_bio:
bio_put(bio); bio_put(bio);
@@ -269,6 +270,7 @@ static int log_one_block(struct log_writes_c *lc,
bio->bi_bdev = lc->logdev->bdev; bio->bi_bdev = lc->logdev->bdev;
bio->bi_end_io = log_end_io; bio->bi_end_io = log_end_io;
bio->bi_private = lc; bio->bi_private = lc;
bio->bi_rw = WRITE;
for (i = 0; i < block->vec_cnt; i++) { for (i = 0; i < block->vec_cnt; i++) {
/* /*
@@ -279,7 +281,7 @@ static int log_one_block(struct log_writes_c *lc,
block->vecs[i].bv_len, 0); block->vecs[i].bv_len, 0);
if (ret != block->vecs[i].bv_len) { if (ret != block->vecs[i].bv_len) {
atomic_inc(&lc->io_blocks); atomic_inc(&lc->io_blocks);
submit_bio(WRITE, bio); submit_bio(bio);
bio = bio_alloc(GFP_KERNEL, block->vec_cnt - i); bio = bio_alloc(GFP_KERNEL, block->vec_cnt - i);
if (!bio) { if (!bio) {
DMERR("Couldn't alloc log bio"); DMERR("Couldn't alloc log bio");
@@ -290,6 +292,7 @@ static int log_one_block(struct log_writes_c *lc,
bio->bi_bdev = lc->logdev->bdev; bio->bi_bdev = lc->logdev->bdev;
bio->bi_end_io = log_end_io; bio->bi_end_io = log_end_io;
bio->bi_private = lc; bio->bi_private = lc;
bio->bi_rw = WRITE;
ret = bio_add_page(bio, block->vecs[i].bv_page, ret = bio_add_page(bio, block->vecs[i].bv_page,
block->vecs[i].bv_len, 0); block->vecs[i].bv_len, 0);
@@ -301,7 +304,7 @@ static int log_one_block(struct log_writes_c *lc,
} }
sector += block->vecs[i].bv_len >> SECTOR_SHIFT; sector += block->vecs[i].bv_len >> SECTOR_SHIFT;
} }
submit_bio(WRITE, bio); submit_bio(bio);
out: out:
kfree(block->data); kfree(block->data);
kfree(block); kfree(block);
+2 -1
View File
@@ -371,7 +371,8 @@ static void end_discard(struct discard_op *op, int r)
* need to wait for the chain to complete. * need to wait for the chain to complete.
*/ */
bio_chain(op->bio, op->parent_bio); bio_chain(op->bio, op->parent_bio);
submit_bio(REQ_WRITE | REQ_DISCARD, op->bio); op->bio->bi_rw = REQ_WRITE | REQ_DISCARD;
submit_bio(op->bio);
} }
blk_finish_plug(&op->plug); blk_finish_plug(&op->plug);
+7 -3
View File
@@ -394,8 +394,9 @@ static void submit_flushes(struct work_struct *ws)
bi->bi_end_io = md_end_flush; bi->bi_end_io = md_end_flush;
bi->bi_private = rdev; bi->bi_private = rdev;
bi->bi_bdev = rdev->bdev; bi->bi_bdev = rdev->bdev;
bi->bi_rw = WRITE_FLUSH;
atomic_inc(&mddev->flush_pending); atomic_inc(&mddev->flush_pending);
submit_bio(WRITE_FLUSH, bi); submit_bio(bi);
rcu_read_lock(); rcu_read_lock();
rdev_dec_pending(rdev, mddev); rdev_dec_pending(rdev, mddev);
} }
@@ -742,9 +743,10 @@ void md_super_write(struct mddev *mddev, struct md_rdev *rdev,
bio_add_page(bio, page, size, 0); bio_add_page(bio, page, size, 0);
bio->bi_private = rdev; bio->bi_private = rdev;
bio->bi_end_io = super_written; bio->bi_end_io = super_written;
bio->bi_rw = WRITE_FLUSH_FUA;
atomic_inc(&mddev->pending_writes); atomic_inc(&mddev->pending_writes);
submit_bio(WRITE_FLUSH_FUA, bio); submit_bio(bio);
} }
void md_super_wait(struct mddev *mddev) void md_super_wait(struct mddev *mddev)
@@ -761,6 +763,7 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
bio->bi_bdev = (metadata_op && rdev->meta_bdev) ? bio->bi_bdev = (metadata_op && rdev->meta_bdev) ?
rdev->meta_bdev : rdev->bdev; rdev->meta_bdev : rdev->bdev;
bio->bi_rw = rw;
if (metadata_op) if (metadata_op)
bio->bi_iter.bi_sector = sector + rdev->sb_start; bio->bi_iter.bi_sector = sector + rdev->sb_start;
else if (rdev->mddev->reshape_position != MaxSector && else if (rdev->mddev->reshape_position != MaxSector &&
@@ -770,7 +773,8 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
else else
bio->bi_iter.bi_sector = sector + rdev->data_offset; bio->bi_iter.bi_sector = sector + rdev->data_offset;
bio_add_page(bio, page, size, 0); bio_add_page(bio, page, size, 0);
submit_bio_wait(rw, bio);
submit_bio_wait(bio);
ret = !bio->bi_error; ret = !bio->bi_error;
bio_put(bio); bio_put(bio);
+2 -1
View File
@@ -2208,7 +2208,8 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
bio_trim(wbio, sector - r1_bio->sector, sectors); bio_trim(wbio, sector - r1_bio->sector, sectors);
wbio->bi_iter.bi_sector += rdev->data_offset; wbio->bi_iter.bi_sector += rdev->data_offset;
wbio->bi_bdev = rdev->bdev; wbio->bi_bdev = rdev->bdev;
if (submit_bio_wait(WRITE, wbio) < 0)
if (submit_bio_wait(wbio) < 0)
/* failure! */ /* failure! */
ok = rdev_set_badblocks(rdev, sector, ok = rdev_set_badblocks(rdev, sector,
sectors, 0) sectors, 0)
+3 -1
View File
@@ -2474,7 +2474,9 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
choose_data_offset(r10_bio, rdev) + choose_data_offset(r10_bio, rdev) +
(sector - r10_bio->sector)); (sector - r10_bio->sector));
wbio->bi_bdev = rdev->bdev; wbio->bi_bdev = rdev->bdev;
if (submit_bio_wait(WRITE, wbio) < 0) wbio->bi_rw = WRITE;
if (submit_bio_wait(wbio) < 0)
/* Failure! */ /* Failure! */
ok = rdev_set_badblocks(rdev, sector, ok = rdev_set_badblocks(rdev, sector,
sectors, 0) sectors, 0)
+4 -3
View File
@@ -254,7 +254,7 @@ static void r5l_submit_current_io(struct r5l_log *log)
__r5l_set_io_unit_state(io, IO_UNIT_IO_START); __r5l_set_io_unit_state(io, IO_UNIT_IO_START);
spin_unlock_irqrestore(&log->io_list_lock, flags); spin_unlock_irqrestore(&log->io_list_lock, flags);
submit_bio(WRITE, io->current_bio); submit_bio(io->current_bio);
} }
static struct bio *r5l_bio_alloc(struct r5l_log *log) static struct bio *r5l_bio_alloc(struct r5l_log *log)
@@ -373,7 +373,7 @@ static void r5l_append_payload_page(struct r5l_log *log, struct page *page)
io->current_bio = r5l_bio_alloc(log); io->current_bio = r5l_bio_alloc(log);
bio_chain(io->current_bio, prev); bio_chain(io->current_bio, prev);
submit_bio(WRITE, prev); submit_bio(prev);
} }
if (!bio_add_page(io->current_bio, page, PAGE_SIZE, 0)) if (!bio_add_page(io->current_bio, page, PAGE_SIZE, 0))
@@ -686,7 +686,8 @@ void r5l_flush_stripe_to_raid(struct r5l_log *log)
bio_reset(&log->flush_bio); bio_reset(&log->flush_bio);
log->flush_bio.bi_bdev = log->rdev->bdev; log->flush_bio.bi_bdev = log->rdev->bdev;
log->flush_bio.bi_end_io = r5l_log_flush_endio; log->flush_bio.bi_end_io = r5l_log_flush_endio;
submit_bio(WRITE_FLUSH, &log->flush_bio); log->flush_bio.bi_rw = WRITE_FLUSH;
submit_bio(&log->flush_bio);
} }
static void r5l_write_super(struct r5l_log *log, sector_t cp); static void r5l_write_super(struct r5l_log *log, sector_t cp);

Some files were not shown because too many files have changed in this diff Show More