request.c (6b16f5d12202a23d875915349cc031c07fe1b3ec) | request.c (ddcf35d397976421a4ec1d0d00fbcc027a8cb034) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Main bcache entry point - handle a read or a write request and decide what to 4 * do with it; the make_request functions are called by the block layer. 5 * 6 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com> 7 * Copyright 2012 Google, Inc. 8 */ --- 653 unchanged lines hidden (view full) --- 662 663 bio_put(bio); 664 closure_put(cl); 665} 666 667static void bio_complete(struct search *s) 668{ 669 if (s->orig_bio) { | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Main bcache entry point - handle a read or a write request and decide what to 4 * do with it; the make_request functions are called by the block layer. 5 * 6 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com> 7 * Copyright 2012 Google, Inc. 8 */ --- 653 unchanged lines hidden (view full) --- 662 663 bio_put(bio); 664 closure_put(cl); 665} 666 667static void bio_complete(struct search *s) 668{ 669 if (s->orig_bio) { |
670 generic_end_io_acct(s->d->disk->queue, 671 bio_data_dir(s->orig_bio), | 670 generic_end_io_acct(s->d->disk->queue, bio_op(s->orig_bio), |
672 &s->d->disk->part0, s->start_time); 673 674 trace_bcache_request_end(s->d, s->orig_bio); 675 s->orig_bio->bi_status = s->iop.status; 676 bio_endio(s->orig_bio); 677 s->orig_bio = NULL; 678 } 679} --- 377 unchanged lines hidden (view full) --- 1057static void detached_dev_end_io(struct bio *bio) 1058{ 1059 struct detached_dev_io_private *ddip; 1060 1061 ddip = bio->bi_private; 1062 bio->bi_end_io = ddip->bi_end_io; 1063 bio->bi_private = ddip->bi_private; 1064 | 671 &s->d->disk->part0, s->start_time); 672 673 trace_bcache_request_end(s->d, s->orig_bio); 674 s->orig_bio->bi_status = s->iop.status; 675 bio_endio(s->orig_bio); 676 s->orig_bio = NULL; 677 } 678} --- 377 unchanged lines hidden (view full) --- 1056static void detached_dev_end_io(struct bio *bio) 1057{ 1058 struct detached_dev_io_private *ddip; 1059 1060 ddip = bio->bi_private; 1061 bio->bi_end_io = ddip->bi_end_io; 1062 bio->bi_private = ddip->bi_private; 1063 |
1065 generic_end_io_acct(ddip->d->disk->queue, 1066 bio_data_dir(bio), | 1064 generic_end_io_acct(ddip->d->disk->queue, bio_op(bio), |
1067 &ddip->d->disk->part0, ddip->start_time); 1068 1069 if (bio->bi_status) { 1070 struct cached_dev *dc = container_of(ddip->d, 1071 struct cached_dev, disk); 1072 /* should count I/O error for backing device here */ 1073 bch_count_backing_io_errors(dc, bio); 1074 } --- 40 unchanged lines hidden (view full) --- 1115 if (unlikely((d->c && test_bit(CACHE_SET_IO_DISABLE, &d->c->flags)) || 1116 dc->io_disable)) { 1117 bio->bi_status = BLK_STS_IOERR; 1118 bio_endio(bio); 1119 return BLK_QC_T_NONE; 1120 } 1121 1122 atomic_set(&dc->backing_idle, 0); | 1065 &ddip->d->disk->part0, ddip->start_time); 1066 1067 if (bio->bi_status) { 1068 struct cached_dev *dc = container_of(ddip->d, 1069 struct cached_dev, disk); 1070 /* should count I/O error for backing device here */ 1071 bch_count_backing_io_errors(dc, bio); 1072 } --- 40 unchanged lines hidden (view full) --- 1113 if (unlikely((d->c && test_bit(CACHE_SET_IO_DISABLE, &d->c->flags)) || 1114 dc->io_disable)) { 1115 bio->bi_status = BLK_STS_IOERR; 1116 bio_endio(bio); 1117 return BLK_QC_T_NONE; 1118 } 1119 1120 atomic_set(&dc->backing_idle, 0); |
1123 generic_start_io_acct(q, rw, bio_sectors(bio), &d->disk->part0); | 1121 generic_start_io_acct(q, bio_op(bio), bio_sectors(bio), &d->disk->part0); |
1124 1125 bio_set_dev(bio, dc->bdev); 1126 bio->bi_iter.bi_sector += dc->sb.data_offset; 1127 1128 if (cached_dev_get(dc)) { 1129 s = search_alloc(bio, d); 1130 trace_bcache_request_start(s->d, bio); 1131 --- 92 unchanged lines hidden (view full) --- 1224} 1225 1226static blk_qc_t flash_dev_make_request(struct request_queue *q, 1227 struct bio *bio) 1228{ 1229 struct search *s; 1230 struct closure *cl; 1231 struct bcache_device *d = bio->bi_disk->private_data; | 1122 1123 bio_set_dev(bio, dc->bdev); 1124 bio->bi_iter.bi_sector += dc->sb.data_offset; 1125 1126 if (cached_dev_get(dc)) { 1127 s = search_alloc(bio, d); 1128 trace_bcache_request_start(s->d, bio); 1129 --- 92 unchanged lines hidden (view full) --- 1222} 1223 1224static blk_qc_t flash_dev_make_request(struct request_queue *q, 1225 struct bio *bio) 1226{ 1227 struct search *s; 1228 struct closure *cl; 1229 struct bcache_device *d = bio->bi_disk->private_data; |
1232 int rw = bio_data_dir(bio); | |
1233 1234 if (unlikely(d->c && test_bit(CACHE_SET_IO_DISABLE, &d->c->flags))) { 1235 bio->bi_status = BLK_STS_IOERR; 1236 bio_endio(bio); 1237 return BLK_QC_T_NONE; 1238 } 1239 | 1230 1231 if (unlikely(d->c && test_bit(CACHE_SET_IO_DISABLE, &d->c->flags))) { 1232 bio->bi_status = BLK_STS_IOERR; 1233 bio_endio(bio); 1234 return BLK_QC_T_NONE; 1235 } 1236 |
1240 generic_start_io_acct(q, rw, bio_sectors(bio), &d->disk->part0); | 1237 generic_start_io_acct(q, bio_op(bio), bio_sectors(bio), &d->disk->part0); |
1241 1242 s = search_alloc(bio, d); 1243 cl = &s->cl; 1244 bio = &s->bio.bio; 1245 1246 trace_bcache_request_start(s->d, bio); 1247 1248 if (!bio->bi_iter.bi_size) { 1249 /* 1250 * can't call bch_journal_meta from under 1251 * generic_make_request 1252 */ 1253 continue_at_nobarrier(&s->cl, 1254 flash_dev_nodata, 1255 bcache_wq); 1256 return BLK_QC_T_NONE; | 1238 1239 s = search_alloc(bio, d); 1240 cl = &s->cl; 1241 bio = &s->bio.bio; 1242 1243 trace_bcache_request_start(s->d, bio); 1244 1245 if (!bio->bi_iter.bi_size) { 1246 /* 1247 * can't call bch_journal_meta from under 1248 * generic_make_request 1249 */ 1250 continue_at_nobarrier(&s->cl, 1251 flash_dev_nodata, 1252 bcache_wq); 1253 return BLK_QC_T_NONE; |
1257 } else if (rw) { | 1254 } else if (bio_data_dir(bio)) { |
1258 bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, 1259 &KEY(d->id, bio->bi_iter.bi_sector, 0), 1260 &KEY(d->id, bio_end_sector(bio), 0)); 1261 1262 s->iop.bypass = (bio_op(bio) == REQ_OP_DISCARD) != 0; 1263 s->iop.writeback = true; 1264 s->iop.bio = bio; 1265 --- 55 unchanged lines hidden --- | 1255 bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, 1256 &KEY(d->id, bio->bi_iter.bi_sector, 0), 1257 &KEY(d->id, bio_end_sector(bio), 0)); 1258 1259 s->iop.bypass = (bio_op(bio) == REQ_OP_DISCARD) != 0; 1260 s->iop.writeback = true; 1261 s->iop.bio = bio; 1262 --- 55 unchanged lines hidden --- |