aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/bio.h16
-rw-r--r--include/linux/blk_types.h19
-rw-r--r--include/trace/events/bcache.h26
-rw-r--r--include/trace/events/block.h26
-rw-r--r--include/trace/events/f2fs.h4
5 files changed, 48 insertions, 43 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 060ff695085c..e2e0bc642ed1 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -62,19 +62,19 @@
62 * on highmem page vectors 62 * on highmem page vectors
63 */ 63 */
64#define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)])) 64#define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)]))
65#define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_idx) 65#define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_iter.bi_idx)
66#define bio_page(bio) bio_iovec((bio))->bv_page 66#define bio_page(bio) bio_iovec((bio))->bv_page
67#define bio_offset(bio) bio_iovec((bio))->bv_offset 67#define bio_offset(bio) bio_iovec((bio))->bv_offset
68#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 68#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_iter.bi_idx)
69#define bio_sectors(bio) ((bio)->bi_size >> 9) 69#define bio_sectors(bio) ((bio)->bi_iter.bi_size >> 9)
70#define bio_end_sector(bio) ((bio)->bi_sector + bio_sectors((bio))) 70#define bio_end_sector(bio) ((bio)->bi_iter.bi_sector + bio_sectors((bio)))
71 71
72static inline unsigned int bio_cur_bytes(struct bio *bio) 72static inline unsigned int bio_cur_bytes(struct bio *bio)
73{ 73{
74 if (bio->bi_vcnt) 74 if (bio->bi_vcnt)
75 return bio_iovec(bio)->bv_len; 75 return bio_iovec(bio)->bv_len;
76 else /* dataless requests such as discard */ 76 else /* dataless requests such as discard */
77 return bio->bi_size; 77 return bio->bi_iter.bi_size;
78} 78}
79 79
80static inline void *bio_data(struct bio *bio) 80static inline void *bio_data(struct bio *bio)
@@ -108,7 +108,7 @@ static inline void *bio_data(struct bio *bio)
108 */ 108 */
109 109
110#define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1) 110#define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1)
111#define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_idx) 111#define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_iter.bi_idx)
112 112
113/* Default implementation of BIOVEC_PHYS_MERGEABLE */ 113/* Default implementation of BIOVEC_PHYS_MERGEABLE */
114#define __BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ 114#define __BIOVEC_PHYS_MERGEABLE(vec1, vec2) \
@@ -150,7 +150,7 @@ static inline void *bio_data(struct bio *bio)
150 i++) 150 i++)
151 151
152#define bio_for_each_segment(bvl, bio, i) \ 152#define bio_for_each_segment(bvl, bio, i) \
153 for (i = (bio)->bi_idx; \ 153 for (i = (bio)->bi_iter.bi_idx; \
154 bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \ 154 bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \
155 i++) 155 i++)
156 156
@@ -365,7 +365,7 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
365#define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags) 365#define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags)
366 366
367#define bio_kmap_irq(bio, flags) \ 367#define bio_kmap_irq(bio, flags) \
368 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 368 __bio_kmap_irq((bio), (bio)->bi_iter.bi_idx, (flags))
369#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 369#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
370 370
371/* 371/*
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 238ef0ed62f8..29b5b84d8a29 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -28,13 +28,19 @@ struct bio_vec {
28 unsigned int bv_offset; 28 unsigned int bv_offset;
29}; 29};
30 30
31struct bvec_iter {
32 sector_t bi_sector; /* device address in 512 byte
33 sectors */
34 unsigned int bi_size; /* residual I/O count */
35
36 unsigned int bi_idx; /* current index into bvl_vec */
37};
38
31/* 39/*
32 * main unit of I/O for the block layer and lower layers (ie drivers and 40 * main unit of I/O for the block layer and lower layers (ie drivers and
33 * stacking drivers) 41 * stacking drivers)
34 */ 42 */
35struct bio { 43struct bio {
36 sector_t bi_sector; /* device address in 512 byte
37 sectors */
38 struct bio *bi_next; /* request queue link */ 44 struct bio *bi_next; /* request queue link */
39 struct block_device *bi_bdev; 45 struct block_device *bi_bdev;
40 unsigned long bi_flags; /* status, command, etc */ 46 unsigned long bi_flags; /* status, command, etc */
@@ -42,16 +48,13 @@ struct bio {
42 * top bits priority 48 * top bits priority
43 */ 49 */
44 50
45 unsigned short bi_vcnt; /* how many bio_vec's */ 51 struct bvec_iter bi_iter;
46 unsigned short bi_idx; /* current index into bvl_vec */
47 52
48 /* Number of segments in this BIO after 53 /* Number of segments in this BIO after
49 * physical address coalescing is performed. 54 * physical address coalescing is performed.
50 */ 55 */
51 unsigned int bi_phys_segments; 56 unsigned int bi_phys_segments;
52 57
53 unsigned int bi_size; /* residual I/O count */
54
55 /* 58 /*
56 * To keep track of the max segment size, we account for the 59 * To keep track of the max segment size, we account for the
57 * sizes of the first and last mergeable segments in this bio. 60 * sizes of the first and last mergeable segments in this bio.
@@ -74,11 +77,13 @@ struct bio {
74 struct bio_integrity_payload *bi_integrity; /* data integrity */ 77 struct bio_integrity_payload *bi_integrity; /* data integrity */
75#endif 78#endif
76 79
80 unsigned short bi_vcnt; /* how many bio_vec's */
81
77 /* 82 /*
78 * Everything starting with bi_max_vecs will be preserved by bio_reset() 83 * Everything starting with bi_max_vecs will be preserved by bio_reset()
79 */ 84 */
80 85
81 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ 86 unsigned short bi_max_vecs; /* max bvl_vecs we can hold */
82 87
83 atomic_t bi_cnt; /* pin count */ 88 atomic_t bi_cnt; /* pin count */
84 89
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index e2b9576d00e2..095c6e4fe1e8 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -24,10 +24,10 @@ DECLARE_EVENT_CLASS(bcache_request,
24 __entry->dev = bio->bi_bdev->bd_dev; 24 __entry->dev = bio->bi_bdev->bd_dev;
25 __entry->orig_major = d->disk->major; 25 __entry->orig_major = d->disk->major;
26 __entry->orig_minor = d->disk->first_minor; 26 __entry->orig_minor = d->disk->first_minor;
27 __entry->sector = bio->bi_sector; 27 __entry->sector = bio->bi_iter.bi_sector;
28 __entry->orig_sector = bio->bi_sector - 16; 28 __entry->orig_sector = bio->bi_iter.bi_sector - 16;
29 __entry->nr_sector = bio->bi_size >> 9; 29 __entry->nr_sector = bio->bi_iter.bi_size >> 9;
30 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 30 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
31 ), 31 ),
32 32
33 TP_printk("%d,%d %s %llu + %u (from %d,%d @ %llu)", 33 TP_printk("%d,%d %s %llu + %u (from %d,%d @ %llu)",
@@ -99,9 +99,9 @@ DECLARE_EVENT_CLASS(bcache_bio,
99 99
100 TP_fast_assign( 100 TP_fast_assign(
101 __entry->dev = bio->bi_bdev->bd_dev; 101 __entry->dev = bio->bi_bdev->bd_dev;
102 __entry->sector = bio->bi_sector; 102 __entry->sector = bio->bi_iter.bi_sector;
103 __entry->nr_sector = bio->bi_size >> 9; 103 __entry->nr_sector = bio->bi_iter.bi_size >> 9;
104 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 104 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
105 ), 105 ),
106 106
107 TP_printk("%d,%d %s %llu + %u", 107 TP_printk("%d,%d %s %llu + %u",
@@ -134,9 +134,9 @@ TRACE_EVENT(bcache_read,
134 134
135 TP_fast_assign( 135 TP_fast_assign(
136 __entry->dev = bio->bi_bdev->bd_dev; 136 __entry->dev = bio->bi_bdev->bd_dev;
137 __entry->sector = bio->bi_sector; 137 __entry->sector = bio->bi_iter.bi_sector;
138 __entry->nr_sector = bio->bi_size >> 9; 138 __entry->nr_sector = bio->bi_iter.bi_size >> 9;
139 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 139 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
140 __entry->cache_hit = hit; 140 __entry->cache_hit = hit;
141 __entry->bypass = bypass; 141 __entry->bypass = bypass;
142 ), 142 ),
@@ -162,9 +162,9 @@ TRACE_EVENT(bcache_write,
162 162
163 TP_fast_assign( 163 TP_fast_assign(
164 __entry->dev = bio->bi_bdev->bd_dev; 164 __entry->dev = bio->bi_bdev->bd_dev;
165 __entry->sector = bio->bi_sector; 165 __entry->sector = bio->bi_iter.bi_sector;
166 __entry->nr_sector = bio->bi_size >> 9; 166 __entry->nr_sector = bio->bi_iter.bi_size >> 9;
167 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 167 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
168 __entry->writeback = writeback; 168 __entry->writeback = writeback;
169 __entry->bypass = bypass; 169 __entry->bypass = bypass;
170 ), 170 ),
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 4c2301d2ef1a..e76ae19a8d6f 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -243,9 +243,9 @@ TRACE_EVENT(block_bio_bounce,
243 TP_fast_assign( 243 TP_fast_assign(
244 __entry->dev = bio->bi_bdev ? 244 __entry->dev = bio->bi_bdev ?
245 bio->bi_bdev->bd_dev : 0; 245 bio->bi_bdev->bd_dev : 0;
246 __entry->sector = bio->bi_sector; 246 __entry->sector = bio->bi_iter.bi_sector;
247 __entry->nr_sector = bio_sectors(bio); 247 __entry->nr_sector = bio_sectors(bio);
248 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 248 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
249 memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 249 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
250 ), 250 ),
251 251
@@ -280,10 +280,10 @@ TRACE_EVENT(block_bio_complete,
280 280
281 TP_fast_assign( 281 TP_fast_assign(
282 __entry->dev = bio->bi_bdev->bd_dev; 282 __entry->dev = bio->bi_bdev->bd_dev;
283 __entry->sector = bio->bi_sector; 283 __entry->sector = bio->bi_iter.bi_sector;
284 __entry->nr_sector = bio_sectors(bio); 284 __entry->nr_sector = bio_sectors(bio);
285 __entry->error = error; 285 __entry->error = error;
286 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 286 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
287 ), 287 ),
288 288
289 TP_printk("%d,%d %s %llu + %u [%d]", 289 TP_printk("%d,%d %s %llu + %u [%d]",
@@ -308,9 +308,9 @@ DECLARE_EVENT_CLASS(block_bio_merge,
308 308
309 TP_fast_assign( 309 TP_fast_assign(
310 __entry->dev = bio->bi_bdev->bd_dev; 310 __entry->dev = bio->bi_bdev->bd_dev;
311 __entry->sector = bio->bi_sector; 311 __entry->sector = bio->bi_iter.bi_sector;
312 __entry->nr_sector = bio_sectors(bio); 312 __entry->nr_sector = bio_sectors(bio);
313 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 313 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
314 memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 314 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
315 ), 315 ),
316 316
@@ -375,9 +375,9 @@ TRACE_EVENT(block_bio_queue,
375 375
376 TP_fast_assign( 376 TP_fast_assign(
377 __entry->dev = bio->bi_bdev->bd_dev; 377 __entry->dev = bio->bi_bdev->bd_dev;
378 __entry->sector = bio->bi_sector; 378 __entry->sector = bio->bi_iter.bi_sector;
379 __entry->nr_sector = bio_sectors(bio); 379 __entry->nr_sector = bio_sectors(bio);
380 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 380 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
381 memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 381 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
382 ), 382 ),
383 383
@@ -403,7 +403,7 @@ DECLARE_EVENT_CLASS(block_get_rq,
403 403
404 TP_fast_assign( 404 TP_fast_assign(
405 __entry->dev = bio ? bio->bi_bdev->bd_dev : 0; 405 __entry->dev = bio ? bio->bi_bdev->bd_dev : 0;
406 __entry->sector = bio ? bio->bi_sector : 0; 406 __entry->sector = bio ? bio->bi_iter.bi_sector : 0;
407 __entry->nr_sector = bio ? bio_sectors(bio) : 0; 407 __entry->nr_sector = bio ? bio_sectors(bio) : 0;
408 blk_fill_rwbs(__entry->rwbs, 408 blk_fill_rwbs(__entry->rwbs,
409 bio ? bio->bi_rw : 0, __entry->nr_sector); 409 bio ? bio->bi_rw : 0, __entry->nr_sector);
@@ -538,9 +538,9 @@ TRACE_EVENT(block_split,
538 538
539 TP_fast_assign( 539 TP_fast_assign(
540 __entry->dev = bio->bi_bdev->bd_dev; 540 __entry->dev = bio->bi_bdev->bd_dev;
541 __entry->sector = bio->bi_sector; 541 __entry->sector = bio->bi_iter.bi_sector;
542 __entry->new_sector = new_sector; 542 __entry->new_sector = new_sector;
543 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 543 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
544 memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 544 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
545 ), 545 ),
546 546
@@ -579,11 +579,11 @@ TRACE_EVENT(block_bio_remap,
579 579
580 TP_fast_assign( 580 TP_fast_assign(
581 __entry->dev = bio->bi_bdev->bd_dev; 581 __entry->dev = bio->bi_bdev->bd_dev;
582 __entry->sector = bio->bi_sector; 582 __entry->sector = bio->bi_iter.bi_sector;
583 __entry->nr_sector = bio_sectors(bio); 583 __entry->nr_sector = bio_sectors(bio);
584 __entry->old_dev = dev; 584 __entry->old_dev = dev;
585 __entry->old_sector = from; 585 __entry->old_sector = from;
586 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 586 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
587 ), 587 ),
588 588
589 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", 589 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index e0dc355fa317..bd3ee4fbe7a7 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -616,8 +616,8 @@ TRACE_EVENT(f2fs_do_submit_bio,
616 __entry->dev = sb->s_dev; 616 __entry->dev = sb->s_dev;
617 __entry->btype = btype; 617 __entry->btype = btype;
618 __entry->sync = sync; 618 __entry->sync = sync;
619 __entry->sector = bio->bi_sector; 619 __entry->sector = bio->bi_iter.bi_sector;
620 __entry->size = bio->bi_size; 620 __entry->size = bio->bi_iter.bi_size;
621 ), 621 ),
622 622
623 TP_printk("dev = (%d,%d), type = %s, io = %s, sector = %lld, size = %u", 623 TP_printk("dev = (%d,%d), type = %s, io = %s, sector = %lld, size = %u",