diff options
author | Christoph Hellwig <hch@lst.de> | 2010-08-07 12:20:39 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-08-07 12:20:39 -0400 |
commit | 7b6d91daee5cac6402186ff224c3af39d79f4a0e (patch) | |
tree | b1518cf0b6c301178e0a320f80610cd5b3aa7625 /fs | |
parent | 33659ebbae262228eef4e0fe990f393d1f0ed941 (diff) |
block: unify flags for struct bio and struct request
Remove the current bio flags and reuse the request flags for the bio, too.
This allows to more easily trace the type of I/O from the filesystem
down to the block driver. There were two flags in the bio that were
missing in the requests: BIO_RW_UNPLUG and BIO_RW_AHEAD. Also I've
renamed two request flags that had a superflous RW in them.
Note that the flags are in bio.h despite having the REQ_ name - as
blkdev.h includes bio.h that is the only way to go for now.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 5 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 8 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 6 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 18 | ||||
-rw-r--r-- | fs/exofs/ios.c | 2 | ||||
-rw-r--r-- | fs/gfs2/log.c | 4 | ||||
-rw-r--r-- | fs/gfs2/meta_io.c | 8 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 2 | ||||
-rw-r--r-- | fs/nilfs2/segbuf.c | 2 |
9 files changed, 28 insertions, 27 deletions
@@ -843,7 +843,8 @@ struct bio *bio_copy_user_iov(struct request_queue *q, | |||
843 | if (!bio) | 843 | if (!bio) |
844 | goto out_bmd; | 844 | goto out_bmd; |
845 | 845 | ||
846 | bio->bi_rw |= (!write_to_vm << BIO_RW); | 846 | if (!write_to_vm) |
847 | bio->bi_rw |= REQ_WRITE; | ||
847 | 848 | ||
848 | ret = 0; | 849 | ret = 0; |
849 | 850 | ||
@@ -1024,7 +1025,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, | |||
1024 | * set data direction, and check if mapped pages need bouncing | 1025 | * set data direction, and check if mapped pages need bouncing |
1025 | */ | 1026 | */ |
1026 | if (!write_to_vm) | 1027 | if (!write_to_vm) |
1027 | bio->bi_rw |= (1 << BIO_RW); | 1028 | bio->bi_rw |= REQ_WRITE; |
1028 | 1029 | ||
1029 | bio->bi_bdev = bdev; | 1030 | bio->bi_bdev = bdev; |
1030 | bio->bi_flags |= (1 << BIO_USER_MAPPED); | 1031 | bio->bi_flags |= (1 << BIO_USER_MAPPED); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 34f7c375567e..64f10082f048 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -480,7 +480,7 @@ static void end_workqueue_bio(struct bio *bio, int err) | |||
480 | end_io_wq->work.func = end_workqueue_fn; | 480 | end_io_wq->work.func = end_workqueue_fn; |
481 | end_io_wq->work.flags = 0; | 481 | end_io_wq->work.flags = 0; |
482 | 482 | ||
483 | if (bio->bi_rw & (1 << BIO_RW)) { | 483 | if (bio->bi_rw & REQ_WRITE) { |
484 | if (end_io_wq->metadata) | 484 | if (end_io_wq->metadata) |
485 | btrfs_queue_worker(&fs_info->endio_meta_write_workers, | 485 | btrfs_queue_worker(&fs_info->endio_meta_write_workers, |
486 | &end_io_wq->work); | 486 | &end_io_wq->work); |
@@ -604,7 +604,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | |||
604 | 604 | ||
605 | atomic_inc(&fs_info->nr_async_submits); | 605 | atomic_inc(&fs_info->nr_async_submits); |
606 | 606 | ||
607 | if (rw & (1 << BIO_RW_SYNCIO)) | 607 | if (rw & REQ_SYNC) |
608 | btrfs_set_work_high_prio(&async->work); | 608 | btrfs_set_work_high_prio(&async->work); |
609 | 609 | ||
610 | btrfs_queue_worker(&fs_info->workers, &async->work); | 610 | btrfs_queue_worker(&fs_info->workers, &async->work); |
@@ -668,7 +668,7 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | |||
668 | bio, 1); | 668 | bio, 1); |
669 | BUG_ON(ret); | 669 | BUG_ON(ret); |
670 | 670 | ||
671 | if (!(rw & (1 << BIO_RW))) { | 671 | if (!(rw & REQ_WRITE)) { |
672 | /* | 672 | /* |
673 | * called for a read, do the setup so that checksum validation | 673 | * called for a read, do the setup so that checksum validation |
674 | * can happen in the async kernel threads | 674 | * can happen in the async kernel threads |
@@ -1427,7 +1427,7 @@ static void end_workqueue_fn(struct btrfs_work *work) | |||
1427 | * ram and up to date before trying to verify things. For | 1427 | * ram and up to date before trying to verify things. For |
1428 | * blocksize <= pagesize, it is basically a noop | 1428 | * blocksize <= pagesize, it is basically a noop |
1429 | */ | 1429 | */ |
1430 | if (!(bio->bi_rw & (1 << BIO_RW)) && end_io_wq->metadata && | 1430 | if (!(bio->bi_rw & REQ_WRITE) && end_io_wq->metadata && |
1431 | !bio_ready_for_csum(bio)) { | 1431 | !bio_ready_for_csum(bio)) { |
1432 | btrfs_queue_worker(&fs_info->endio_meta_workers, | 1432 | btrfs_queue_worker(&fs_info->endio_meta_workers, |
1433 | &end_io_wq->work); | 1433 | &end_io_wq->work); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1bff92ad4744..e975d7180a88 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1429,7 +1429,7 @@ static int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | |||
1429 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); | 1429 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); |
1430 | BUG_ON(ret); | 1430 | BUG_ON(ret); |
1431 | 1431 | ||
1432 | if (!(rw & (1 << BIO_RW))) { | 1432 | if (!(rw & REQ_WRITE)) { |
1433 | if (bio_flags & EXTENT_BIO_COMPRESSED) { | 1433 | if (bio_flags & EXTENT_BIO_COMPRESSED) { |
1434 | return btrfs_submit_compressed_read(inode, bio, | 1434 | return btrfs_submit_compressed_read(inode, bio, |
1435 | mirror_num, bio_flags); | 1435 | mirror_num, bio_flags); |
@@ -1841,7 +1841,7 @@ static int btrfs_io_failed_hook(struct bio *failed_bio, | |||
1841 | bio->bi_size = 0; | 1841 | bio->bi_size = 0; |
1842 | 1842 | ||
1843 | bio_add_page(bio, page, failrec->len, start - page_offset(page)); | 1843 | bio_add_page(bio, page, failrec->len, start - page_offset(page)); |
1844 | if (failed_bio->bi_rw & (1 << BIO_RW)) | 1844 | if (failed_bio->bi_rw & REQ_WRITE) |
1845 | rw = WRITE; | 1845 | rw = WRITE; |
1846 | else | 1846 | else |
1847 | rw = READ; | 1847 | rw = READ; |
@@ -5642,7 +5642,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode, | |||
5642 | struct bio_vec *bvec = bio->bi_io_vec; | 5642 | struct bio_vec *bvec = bio->bi_io_vec; |
5643 | u64 start; | 5643 | u64 start; |
5644 | int skip_sum; | 5644 | int skip_sum; |
5645 | int write = rw & (1 << BIO_RW); | 5645 | int write = rw & REQ_WRITE; |
5646 | int ret = 0; | 5646 | int ret = 0; |
5647 | 5647 | ||
5648 | skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; | 5648 | skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index d6e3af8be95b..dd318ff280b2 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -258,7 +258,7 @@ loop_lock: | |||
258 | 258 | ||
259 | BUG_ON(atomic_read(&cur->bi_cnt) == 0); | 259 | BUG_ON(atomic_read(&cur->bi_cnt) == 0); |
260 | 260 | ||
261 | if (bio_rw_flagged(cur, BIO_RW_SYNCIO)) | 261 | if (cur->bi_rw & REQ_SYNC) |
262 | num_sync_run++; | 262 | num_sync_run++; |
263 | 263 | ||
264 | submit_bio(cur->bi_rw, cur); | 264 | submit_bio(cur->bi_rw, cur); |
@@ -2651,7 +2651,7 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, | |||
2651 | int max_errors = 0; | 2651 | int max_errors = 0; |
2652 | struct btrfs_multi_bio *multi = NULL; | 2652 | struct btrfs_multi_bio *multi = NULL; |
2653 | 2653 | ||
2654 | if (multi_ret && !(rw & (1 << BIO_RW))) | 2654 | if (multi_ret && !(rw & REQ_WRITE)) |
2655 | stripes_allocated = 1; | 2655 | stripes_allocated = 1; |
2656 | again: | 2656 | again: |
2657 | if (multi_ret) { | 2657 | if (multi_ret) { |
@@ -2687,7 +2687,7 @@ again: | |||
2687 | mirror_num = 0; | 2687 | mirror_num = 0; |
2688 | 2688 | ||
2689 | /* if our multi bio struct is too small, back off and try again */ | 2689 | /* if our multi bio struct is too small, back off and try again */ |
2690 | if (rw & (1 << BIO_RW)) { | 2690 | if (rw & REQ_WRITE) { |
2691 | if (map->type & (BTRFS_BLOCK_GROUP_RAID1 | | 2691 | if (map->type & (BTRFS_BLOCK_GROUP_RAID1 | |
2692 | BTRFS_BLOCK_GROUP_DUP)) { | 2692 | BTRFS_BLOCK_GROUP_DUP)) { |
2693 | stripes_required = map->num_stripes; | 2693 | stripes_required = map->num_stripes; |
@@ -2697,7 +2697,7 @@ again: | |||
2697 | max_errors = 1; | 2697 | max_errors = 1; |
2698 | } | 2698 | } |
2699 | } | 2699 | } |
2700 | if (multi_ret && (rw & (1 << BIO_RW)) && | 2700 | if (multi_ret && (rw & REQ_WRITE) && |
2701 | stripes_allocated < stripes_required) { | 2701 | stripes_allocated < stripes_required) { |
2702 | stripes_allocated = map->num_stripes; | 2702 | stripes_allocated = map->num_stripes; |
2703 | free_extent_map(em); | 2703 | free_extent_map(em); |
@@ -2733,7 +2733,7 @@ again: | |||
2733 | num_stripes = 1; | 2733 | num_stripes = 1; |
2734 | stripe_index = 0; | 2734 | stripe_index = 0; |
2735 | if (map->type & BTRFS_BLOCK_GROUP_RAID1) { | 2735 | if (map->type & BTRFS_BLOCK_GROUP_RAID1) { |
2736 | if (unplug_page || (rw & (1 << BIO_RW))) | 2736 | if (unplug_page || (rw & REQ_WRITE)) |
2737 | num_stripes = map->num_stripes; | 2737 | num_stripes = map->num_stripes; |
2738 | else if (mirror_num) | 2738 | else if (mirror_num) |
2739 | stripe_index = mirror_num - 1; | 2739 | stripe_index = mirror_num - 1; |
@@ -2744,7 +2744,7 @@ again: | |||
2744 | } | 2744 | } |
2745 | 2745 | ||
2746 | } else if (map->type & BTRFS_BLOCK_GROUP_DUP) { | 2746 | } else if (map->type & BTRFS_BLOCK_GROUP_DUP) { |
2747 | if (rw & (1 << BIO_RW)) | 2747 | if (rw & REQ_WRITE) |
2748 | num_stripes = map->num_stripes; | 2748 | num_stripes = map->num_stripes; |
2749 | else if (mirror_num) | 2749 | else if (mirror_num) |
2750 | stripe_index = mirror_num - 1; | 2750 | stripe_index = mirror_num - 1; |
@@ -2755,7 +2755,7 @@ again: | |||
2755 | stripe_index = do_div(stripe_nr, factor); | 2755 | stripe_index = do_div(stripe_nr, factor); |
2756 | stripe_index *= map->sub_stripes; | 2756 | stripe_index *= map->sub_stripes; |
2757 | 2757 | ||
2758 | if (unplug_page || (rw & (1 << BIO_RW))) | 2758 | if (unplug_page || (rw & REQ_WRITE)) |
2759 | num_stripes = map->sub_stripes; | 2759 | num_stripes = map->sub_stripes; |
2760 | else if (mirror_num) | 2760 | else if (mirror_num) |
2761 | stripe_index += mirror_num - 1; | 2761 | stripe_index += mirror_num - 1; |
@@ -2945,7 +2945,7 @@ static noinline int schedule_bio(struct btrfs_root *root, | |||
2945 | struct btrfs_pending_bios *pending_bios; | 2945 | struct btrfs_pending_bios *pending_bios; |
2946 | 2946 | ||
2947 | /* don't bother with additional async steps for reads, right now */ | 2947 | /* don't bother with additional async steps for reads, right now */ |
2948 | if (!(rw & (1 << BIO_RW))) { | 2948 | if (!(rw & REQ_WRITE)) { |
2949 | bio_get(bio); | 2949 | bio_get(bio); |
2950 | submit_bio(rw, bio); | 2950 | submit_bio(rw, bio); |
2951 | bio_put(bio); | 2951 | bio_put(bio); |
@@ -2964,7 +2964,7 @@ static noinline int schedule_bio(struct btrfs_root *root, | |||
2964 | bio->bi_rw |= rw; | 2964 | bio->bi_rw |= rw; |
2965 | 2965 | ||
2966 | spin_lock(&device->io_lock); | 2966 | spin_lock(&device->io_lock); |
2967 | if (bio_rw_flagged(bio, BIO_RW_SYNCIO)) | 2967 | if (bio->bi_rw & REQ_SYNC) |
2968 | pending_bios = &device->pending_sync_bios; | 2968 | pending_bios = &device->pending_sync_bios; |
2969 | else | 2969 | else |
2970 | pending_bios = &device->pending_bios; | 2970 | pending_bios = &device->pending_bios; |
diff --git a/fs/exofs/ios.c b/fs/exofs/ios.c index 4337cad7777b..e2732203fa93 100644 --- a/fs/exofs/ios.c +++ b/fs/exofs/ios.c | |||
@@ -599,7 +599,7 @@ static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp) | |||
599 | } else { | 599 | } else { |
600 | bio = master_dev->bio; | 600 | bio = master_dev->bio; |
601 | /* FIXME: bio_set_dir() */ | 601 | /* FIXME: bio_set_dir() */ |
602 | bio->bi_rw |= (1 << BIO_RW); | 602 | bio->bi_rw |= REQ_WRITE; |
603 | } | 603 | } |
604 | 604 | ||
605 | osd_req_write(or, &ios->obj, per_dev->offset, bio, | 605 | osd_req_write(or, &ios->obj, per_dev->offset, bio, |
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index efc3539ac5a1..cde1248a6225 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -595,7 +595,7 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull) | |||
595 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) | 595 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) |
596 | goto skip_barrier; | 596 | goto skip_barrier; |
597 | get_bh(bh); | 597 | get_bh(bh); |
598 | submit_bh(WRITE_BARRIER | (1 << BIO_RW_META), bh); | 598 | submit_bh(WRITE_BARRIER | REQ_META, bh); |
599 | wait_on_buffer(bh); | 599 | wait_on_buffer(bh); |
600 | if (buffer_eopnotsupp(bh)) { | 600 | if (buffer_eopnotsupp(bh)) { |
601 | clear_buffer_eopnotsupp(bh); | 601 | clear_buffer_eopnotsupp(bh); |
@@ -605,7 +605,7 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull) | |||
605 | lock_buffer(bh); | 605 | lock_buffer(bh); |
606 | skip_barrier: | 606 | skip_barrier: |
607 | get_bh(bh); | 607 | get_bh(bh); |
608 | submit_bh(WRITE_SYNC | (1 << BIO_RW_META), bh); | 608 | submit_bh(WRITE_SYNC | REQ_META, bh); |
609 | wait_on_buffer(bh); | 609 | wait_on_buffer(bh); |
610 | } | 610 | } |
611 | if (!buffer_uptodate(bh)) | 611 | if (!buffer_uptodate(bh)) |
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 18176d0b75d7..f3b071f921aa 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
@@ -36,8 +36,8 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb | |||
36 | { | 36 | { |
37 | struct buffer_head *bh, *head; | 37 | struct buffer_head *bh, *head; |
38 | int nr_underway = 0; | 38 | int nr_underway = 0; |
39 | int write_op = (1 << BIO_RW_META) | ((wbc->sync_mode == WB_SYNC_ALL ? | 39 | int write_op = REQ_META | |
40 | WRITE_SYNC_PLUG : WRITE)); | 40 | (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC_PLUG : WRITE); |
41 | 41 | ||
42 | BUG_ON(!PageLocked(page)); | 42 | BUG_ON(!PageLocked(page)); |
43 | BUG_ON(!page_has_buffers(page)); | 43 | BUG_ON(!page_has_buffers(page)); |
@@ -225,7 +225,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, | |||
225 | } | 225 | } |
226 | bh->b_end_io = end_buffer_read_sync; | 226 | bh->b_end_io = end_buffer_read_sync; |
227 | get_bh(bh); | 227 | get_bh(bh); |
228 | submit_bh(READ_SYNC | (1 << BIO_RW_META), bh); | 228 | submit_bh(READ_SYNC | REQ_META, bh); |
229 | if (!(flags & DIO_WAIT)) | 229 | if (!(flags & DIO_WAIT)) |
230 | return 0; | 230 | return 0; |
231 | 231 | ||
@@ -432,7 +432,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) | |||
432 | if (buffer_uptodate(first_bh)) | 432 | if (buffer_uptodate(first_bh)) |
433 | goto out; | 433 | goto out; |
434 | if (!buffer_locked(first_bh)) | 434 | if (!buffer_locked(first_bh)) |
435 | ll_rw_block(READ_SYNC | (1 << BIO_RW_META), 1, &first_bh); | 435 | ll_rw_block(READ_SYNC | REQ_META, 1, &first_bh); |
436 | 436 | ||
437 | dblock++; | 437 | dblock++; |
438 | extlen--; | 438 | extlen--; |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 3593b3a7290e..fd4f8946abf5 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -275,7 +275,7 @@ static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector) | |||
275 | 275 | ||
276 | bio->bi_end_io = end_bio_io_page; | 276 | bio->bi_end_io = end_bio_io_page; |
277 | bio->bi_private = page; | 277 | bio->bi_private = page; |
278 | submit_bio(READ_SYNC | (1 << BIO_RW_META), bio); | 278 | submit_bio(READ_SYNC | REQ_META, bio); |
279 | wait_on_page_locked(page); | 279 | wait_on_page_locked(page); |
280 | bio_put(bio); | 280 | bio_put(bio); |
281 | if (!PageUptodate(page)) { | 281 | if (!PageUptodate(page)) { |
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c index 2e6a2723b8fa..4588fb9e93df 100644 --- a/fs/nilfs2/segbuf.c +++ b/fs/nilfs2/segbuf.c | |||
@@ -508,7 +508,7 @@ static int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf, | |||
508 | * Last BIO is always sent through the following | 508 | * Last BIO is always sent through the following |
509 | * submission. | 509 | * submission. |
510 | */ | 510 | */ |
511 | rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); | 511 | rw |= REQ_SYNC | REQ_UNPLUG; |
512 | res = nilfs_segbuf_submit_bio(segbuf, &wi, rw); | 512 | res = nilfs_segbuf_submit_bio(segbuf, &wi, rw); |
513 | } | 513 | } |
514 | 514 | ||