lkml.org 
[lkml]   [2012]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH] Fix setting bio flags in drivers (sd_dif/floppy).
From
On Thu, Mar 1, 2012 at 5:03 PM, Jens Axboe <axboe@kernel.dk> wrote:
> On 03/01/2012 10:20 PM, Muthu Kumar wrote:
>> On Thu, Mar 1, 2012 at 12:25 PM, Jens Axboe <axboe@kernel.dk> wrote:
>>> On 2012-03-01 21:23, Muthu Kumar wrote:
>>>>>>                       kunmap_atomic(sdt, KM_USER0);
>>>>>>               }
>>>>>>
>>>>>> -             bio->bi_flags |= BIO_MAPPED_INTEGRITY;
>>>>>> +             bio->bi_flags |= (1 << BIO_MAPPED_INTEGRITY);
>>>>>>       }
>>>>>>
>>>>>>       return 0;
>>>>>
>>>>> urgh.  This isn't the first time.
>>>>>
>>>>> It's too easy for people to make this mistake.  I'm not sure what a
>>>>> good fix would be - I don't think sparse can save us with __bitwise or
>>>>> similar.
>>>>>
>>>>> The approach we took in buffer_head.h with BH_Foo and BUFFER_FNS
>>>>> accessors worked pretty well.
>>>>>
>>>>
>>>> Does this look good? BTW, I used the non-atomic variants __set/__clear
>>>> to match the behavior of current usage.
>>>> If this looks good, I can send the proper patch as attachment (so no
>>>> line wraps :)
>>>
>>> Lets not wrap this in macros, it just makes the code harder to read.
>>> Making the BIO_ flags a bit shift value was a mistake in hindsight, too
>>> easy to get wrong.
>>>
>>> If we're going to be changing everything anyway, it'd be better to have
>>> __ variants if we really need the bit shifts, and the non __ variants be
>>> the value. Similar to what is done for request flags.
>>>
>>> --
>>> Jens Axboe
>>>
>>
>>
>> You mean, like this? (sparing the gmail line wrap)
>>
>> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
>> index 4053cbd..035e1ef 100644
>> --- a/include/linux/blk_types.h
>> +++ b/include/linux/blk_types.h
>> @@ -83,19 +83,35 @@ struct bio {
>>  /*
>>   * bio flags
>>   */
>> -#define BIO_UPTODATE   0       /* ok after I/O completion */
>> -#define BIO_RW_BLOCK   1       /* RW_AHEAD set, and read/write would block */
>> -#define BIO_EOF                2       /* out-out-bounds error */
>> -#define BIO_SEG_VALID  3       /* bi_phys_segments valid */
>> -#define BIO_CLONED     4       /* doesn't own data */
>> -#define BIO_BOUNCED    5       /* bio is a bounce bio */
>> -#define BIO_USER_MAPPED 6      /* contains user pages */
>> -#define BIO_EOPNOTSUPP 7       /* not supported */
>> -#define BIO_NULL_MAPPED 8      /* contains invalid user pages */
>> -#define BIO_FS_INTEGRITY 9     /* fs owns integrity data, not block layer */
>> -#define BIO_QUIET      10      /* Make BIO Quiet */
>> -#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */
>> -#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
>> +enum bio_flag_bits {
>> +    __BIO_UPTODATE,             /* ok after I/O completion */
>> +    __BIO_RW_BLOCK,             /* RW_AHEAD set, and read/write would block */
>> +    __BIO_EOF,                  /* out-out-bounds error */
>> +    __BIO_SEG_VALID,            /* bi_phys_segments valid */
>> +    __BIO_CLONED,               /* doesn't own data */
>> +    __BIO_BOUNCED,              /* bio is a bounce bio */
>> +    __BIO_USER_MAPPED,          /* contains user pages */
>> +    __BIO_EOPNOTSUPP,           /* not supported */
>> +    __BIO_NULL_MAPPED,          /* contains invalid user pages */
>> +    __BIO_FS_INTEGRITY,         /* fs owns integrity data, not block layer */
>> +    __BIO_QUIET,                /* Make BIO Quiet */
>> +    __BIO_MAPPED_INTEGRITY,     /* integrity metadata has been remapped */
>> +};
>> +
>> +#define BIO_UPTODATE            (1 << __BIO_UPTODATE)
>> +#define BIO_RW_BLOCK            (1 << __BIO_RW_BLOCK)
>> +#define BIO_EOF                 (1 << __BIO_EOF)
>> +#define BIO_SEG_VALID           (1 << __BIO_SEG_VALID)
>> +#define BIO_CLONED              (1 << __BIO_CLONED)
>> +#define BIO_BOUNCED             (1 << __BIO_BOUNCED)
>> +#define BIO_USER_MAPPED         (1 << __BIO_USER_MAPPED)
>> +#define BIO_EOPNOTSUPP          (1 << __BIO_EOPNOTSUPP)
>> +#define BIO_NULL_MAPPED         (1 << __BIO_NULL_MAPPED)
>> +#define BIO_FS_INTEGRITY        (1 << __BIO_FS_INTEGRITY)
>> +#define BIO_QUIET               (1 << __BIO_QUIET)
>> +#define BIO_MAPPED_INTEGRITY    (1 << __BIO_MAPPED_INTEGRITY)
>> +
>> +#define bio_flagged(bio, flag) ((bio)->bi_flags & (flag))
>>
>>  /*
>>   * top 4 bits of bio flags indicate the pool this bio came from
>
> Yes, exactly. Only problem is that it would be a big patch, and old code
> would still compile. We'd probably need to make all those a bit
> different, ala
>
> +#define BIO_F_UPTODATE         (1 << __BIO_UPTODATE)
>
> to be completely safe and catch any use case.

Yes, its a big patch - attached. grepped and verified all cases are
taken care of and compiles in my setup.

Regards,
Muthu
Change bio flags definition to avoid improper setting.

Signed-off-by: Muthukumar R <muthur@gmail.com>

--------------------------------------------------------

block/blk-core.c | 8 +++---
block/blk-flush.c | 4 +-
block/blk-map.c | 10 ++++----
block/blk-merge.c | 10 ++++----
drivers/block/floppy.c | 2 +-
drivers/block/pktcdvd.c | 4 +-
drivers/block/umem.c | 2 +-
drivers/md/dm.c | 4 +-
drivers/md/md.c | 10 ++++----
drivers/md/multipath.c | 2 +-
drivers/md/raid1.c | 32 +++++++++++++-------------
drivers/md/raid10.c | 34 ++++++++++++++--------------
drivers/md/raid5.c | 22 +++++++++---------
drivers/s390/block/xpram.c | 2 +-
drivers/scsi/sd_dif.c | 2 +-
drivers/staging/zram/zram_drv.c | 2 +-
drivers/target/target_core_iblock.c | 2 +-
fs/bio.c | 14 +++++-----
fs/btrfs/disk-io.c | 8 +++---
fs/btrfs/extent_io.c | 8 +++---
fs/btrfs/inode.c | 6 ++--
fs/btrfs/scrub.c | 4 +-
fs/btrfs/volumes.c | 2 +-
fs/buffer.c | 8 +++---
fs/direct-io.c | 2 +-
fs/ext4/page-io.c | 4 +-
fs/hfsplus/wrapper.c | 2 +-
fs/jfs/jfs_logmgr.c | 2 +-
fs/jfs/jfs_metapage.c | 4 +-
fs/logfs/dev_bdev.c | 6 ++--
fs/mpage.c | 2 +-
fs/nfs/blocklayout/blocklayout.c | 6 ++--
fs/nilfs2/segbuf.c | 6 ++--
fs/xfs/xfs_aops.c | 2 +-
include/linux/blk_types.h | 42 ++++++++++++++++++++++++----------
mm/bounce.c | 8 +++---
mm/page_io.c | 4 +-
37 files changed, 154 insertions(+), 138 deletions(-)

--------------------------------------------------------------------

diff --git a/block/blk-core.c b/block/blk-core.c
index 3a78b00..4f3f84b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -152,8 +152,8 @@ static void req_bio_endio(struct request *rq, struct bio *bio,
unsigned int nbytes, int error)
{
if (error)
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
- else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
+ else if (!test_bit(BIO_F_UPTODATE, &bio->bi_flags))
error = -EIO;

if (unlikely(nbytes > bio->bi_size)) {
@@ -163,7 +163,7 @@ static void req_bio_endio(struct request *rq, struct bio *bio,
}

if (unlikely(rq->cmd_flags & REQ_QUIET))
- set_bit(BIO_QUIET, &bio->bi_flags);
+ set_bit(BIO_F_QUIET, &bio->bi_flags);

bio->bi_size -= nbytes;
bio->bi_sector += (nbytes >> 9);
@@ -1454,7 +1454,7 @@ static void handle_bad_sector(struct bio *bio)
(unsigned long long)bio->bi_sector + bio_sectors(bio),
(long long)(i_size_read(bio->bi_bdev->bd_inode) >> 9));

- set_bit(BIO_EOF, &bio->bi_flags);
+ set_bit(BIO_F_EOF, &bio->bi_flags);
}

#ifdef CONFIG_FAIL_MAKE_REQUEST
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 720ad60..4b19fc6 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -387,7 +387,7 @@ void blk_abort_flushes(struct request_queue *q)
static void bio_end_flush(struct bio *bio, int err)
{
if (err)
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
if (bio->bi_private)
complete(bio->bi_private);
bio_put(bio);
@@ -446,7 +446,7 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
if (error_sector)
*error_sector = bio->bi_sector;

- if (!bio_flagged(bio, BIO_UPTODATE))
+ if (!bio_flagged(bio, BIO_F_UPTODATE))
ret = -EIO;

bio_put(bio);
diff --git a/block/blk-map.c b/block/blk-map.c
index 623e1cd..8100619 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -30,7 +30,7 @@ static int __blk_rq_unmap_user(struct bio *bio)
int ret = 0;

if (bio) {
- if (bio_flagged(bio, BIO_USER_MAPPED))
+ if (bio_flagged(bio, BIO_F_USER_MAPPED))
bio_unmap_user(bio);
else
ret = bio_uncopy_user(bio);
@@ -63,7 +63,7 @@ static int __blk_rq_map_user(struct request_queue *q, struct request *rq,
return PTR_ERR(bio);

if (map_data && map_data->null_mapped)
- bio->bi_flags |= (1 << BIO_NULL_MAPPED);
+ bio->bi_flags |= BIO_F_NULL_MAPPED;

orig_bio = bio;
blk_queue_bounce(q, &bio);
@@ -152,7 +152,7 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq,
map_data->offset += ret;
}

- if (!bio_flagged(bio, BIO_USER_MAPPED))
+ if (!bio_flagged(bio, BIO_F_USER_MAPPED))
rq->cmd_flags |= REQ_COPY_USER;

rq->buffer = NULL;
@@ -232,7 +232,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
return -EINVAL;
}

- if (!bio_flagged(bio, BIO_USER_MAPPED))
+ if (!bio_flagged(bio, BIO_F_USER_MAPPED))
rq->cmd_flags |= REQ_COPY_USER;

blk_queue_bounce(q, &bio);
@@ -259,7 +259,7 @@ int blk_rq_unmap_user(struct bio *bio)

while (bio) {
mapped_bio = bio;
- if (unlikely(bio_flagged(bio, BIO_BOUNCED)))
+ if (unlikely(bio_flagged(bio, BIO_F_BOUNCED)))
mapped_bio = bio->bi_private;

ret2 = __blk_rq_unmap_user(mapped_bio);
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 160035f..1d02e03 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -80,7 +80,7 @@ void blk_recount_segments(struct request_queue *q, struct bio *bio)
bio->bi_next = NULL;
bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio);
bio->bi_next = nxt;
- bio->bi_flags |= (1 << BIO_SEG_VALID);
+ bio->bi_flags |= BIO_F_SEG_VALID;
}
EXPORT_SYMBOL(blk_recount_segments);

@@ -241,9 +241,9 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req,
q->last_merge = NULL;
return 0;
}
- if (!bio_flagged(req->biotail, BIO_SEG_VALID))
+ if (!bio_flagged(req->biotail, BIO_F_SEG_VALID))
blk_recount_segments(q, req->biotail);
- if (!bio_flagged(bio, BIO_SEG_VALID))
+ if (!bio_flagged(bio, BIO_F_SEG_VALID))
blk_recount_segments(q, bio);

return ll_new_hw_segment(q, req, bio);
@@ -266,9 +266,9 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req,
q->last_merge = NULL;
return 0;
}
- if (!bio_flagged(bio, BIO_SEG_VALID))
+ if (!bio_flagged(bio, BIO_F_SEG_VALID))
blk_recount_segments(q, bio);
- if (!bio_flagged(req->bio, BIO_SEG_VALID))
+ if (!bio_flagged(req->bio, BIO_F_SEG_VALID))
blk_recount_segments(q, req->bio);

return ll_new_hw_segment(q, req, bio);
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 9baf11e..6970baa 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3832,7 +3832,7 @@ static int __floppy_read_block_0(struct block_device *bdev)
bio.bi_size = size;
bio.bi_bdev = bdev;
bio.bi_sector = 0;
- bio.bi_flags = BIO_QUIET;
+ bio.bi_flags = BIO_F_QUIET;
init_completion(&complete);
bio.bi_private = &complete;
bio.bi_end_io = floppy_rb0_complete;
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index d59edea..1621a34 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -1480,7 +1480,7 @@ static void pkt_run_state_machine(struct pktcdvd_device *pd, struct packet_data
if (atomic_read(&pkt->io_wait) > 0)
return;

- if (test_bit(BIO_UPTODATE, &pkt->w_bio->bi_flags)) {
+ if (test_bit(BIO_F_UPTODATE, &pkt->w_bio->bi_flags)) {
pkt_set_state(pkt, PACKET_FINISHED_STATE);
} else {
pkt_set_state(pkt, PACKET_RECOVERY_STATE);
@@ -1497,7 +1497,7 @@ static void pkt_run_state_machine(struct pktcdvd_device *pd, struct packet_data
break;

case PACKET_FINISHED_STATE:
- uptodate = test_bit(BIO_UPTODATE, &pkt->w_bio->bi_flags);
+ uptodate = test_bit(BIO_F_UPTODATE, &pkt->w_bio->bi_flags);
pkt_finish_packet(pkt, uptodate);
return;

diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index aa27120..43b44ec 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -460,7 +460,7 @@ static void process_page(unsigned long data)
PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
if (control & DMASCR_HARD_ERROR) {
/* error */
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
dev_printk(KERN_WARNING, &card->dev->dev,
"I/O error on sector %d/%d\n",
le32_to_cpu(desc->local_addr)>>9,
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index b89c548..088efeb 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1063,7 +1063,7 @@ static struct bio *split_bvec(struct bio *bio, sector_t sector,
clone->bi_size = to_bytes(len);
clone->bi_io_vec->bv_offset = offset;
clone->bi_io_vec->bv_len = clone->bi_size;
- clone->bi_flags |= 1 << BIO_CLONED;
+ clone->bi_flags |= BIO_F_CLONED;

if (bio_integrity(bio)) {
bio_integrity_clone(clone, bio, GFP_NOIO, bs);
@@ -1090,7 +1090,7 @@ static struct bio *clone_bio(struct bio *bio, sector_t sector,
clone->bi_idx = idx;
clone->bi_vcnt = idx + bv_count;
clone->bi_size = to_bytes(len);
- clone->bi_flags &= ~(1 << BIO_SEG_VALID);
+ clone->bi_flags &= ~(BIO_F_SEG_VALID);

if (bio_integrity(bio)) {
bio_integrity_clone(clone, bio, GFP_NOIO, bs);
diff --git a/drivers/md/md.c b/drivers/md/md.c
index ce88755..a991a15 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -234,7 +234,7 @@ void md_trim_bio(struct bio *bio, int offset, int size)
bio->bi_sector += offset;
bio->bi_size = size;
offset <<= 9;
- clear_bit(BIO_SEG_VALID, &bio->bi_flags);
+ clear_bit(BIO_F_SEG_VALID, &bio->bi_flags);

while (bio->bi_idx < bio->bi_vcnt &&
bio->bi_io_vec[bio->bi_idx].bv_len <= offset) {
@@ -821,10 +821,10 @@ static void super_written(struct bio *bio, int error)
struct md_rdev *rdev = bio->bi_private;
struct mddev *mddev = rdev->mddev;

- if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags)) {
+ if (error || !test_bit(BIO_F_UPTODATE, &bio->bi_flags)) {
printk("md: super_written gets error=%d, uptodate=%d\n",
- error, test_bit(BIO_UPTODATE, &bio->bi_flags));
- WARN_ON(test_bit(BIO_UPTODATE, &bio->bi_flags));
+ error, test_bit(BIO_F_UPTODATE, &bio->bi_flags));
+ WARN_ON(test_bit(BIO_F_UPTODATE, &bio->bi_flags));
md_error(mddev, rdev);
}

@@ -894,7 +894,7 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
submit_bio(rw, bio);
wait_for_completion(&event);

- ret = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ ret = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
bio_put(bio);
return ret;
}
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index a222f51..4d1f096 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -85,7 +85,7 @@ static void multipath_end_bh_io (struct multipath_bh *mp_bh, int err)

static void multipath_end_request(struct bio *bio, int error)
{
- int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct multipath_bh *mp_bh = bio->bi_private;
struct mpconf *conf = mp_bh->mddev->private;
struct md_rdev *rdev = conf->multipaths[mp_bh->path].rdev;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index a368db2..75ae1e7 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -232,7 +232,7 @@ static void call_bio_endio(struct r1bio *r1_bio)
done = 1;

if (!test_bit(R1BIO_Uptodate, &r1_bio->state))
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
if (done) {
bio_endio(bio, 0);
/*
@@ -292,7 +292,7 @@ static int find_bio_disk(struct r1bio *r1_bio, struct bio *bio)

static void raid1_end_read_request(struct bio *bio, int error)
{
- int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct r1bio *r1_bio = bio->bi_private;
int mirror;
struct r1conf *conf = r1_bio->mddev->private;
@@ -377,7 +377,7 @@ static void r1_bio_write_done(struct r1bio *r1_bio)

static void raid1_end_write_request(struct bio *bio, int error)
{
- int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct r1bio *r1_bio = bio->bi_private;
int mirror, behind = test_bit(R1BIO_BehindIO, &r1_bio->state);
struct r1conf *conf = r1_bio->mddev->private;
@@ -894,7 +894,7 @@ static void make_request(struct mddev *mddev, struct bio * bio)
* non-zero, then it is the number of not-completed requests.
*/
bio->bi_phys_segments = 0;
- clear_bit(BIO_SEG_VALID, &bio->bi_flags);
+ clear_bit(BIO_F_SEG_VALID, &bio->bi_flags);

if (rw == READ) {
/*
@@ -1443,7 +1443,7 @@ static void end_sync_read(struct bio *bio, int error)
* or re-read if the read failed.
* We don't do much here, just schedule handling by raid1d
*/
- if (test_bit(BIO_UPTODATE, &bio->bi_flags))
+ if (test_bit(BIO_F_UPTODATE, &bio->bi_flags))
set_bit(R1BIO_Uptodate, &r1_bio->state);

if (atomic_dec_and_test(&r1_bio->remaining))
@@ -1452,7 +1452,7 @@ static void end_sync_read(struct bio *bio, int error)

static void end_sync_write(struct bio *bio, int error)
{
- int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct r1bio *r1_bio = bio->bi_private;
struct mddev *mddev = r1_bio->mddev;
struct r1conf *conf = mddev->private;
@@ -1639,7 +1639,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
idx ++;
}
set_bit(R1BIO_Uptodate, &r1_bio->state);
- set_bit(BIO_UPTODATE, &bio->bi_flags);
+ set_bit(BIO_F_UPTODATE, &bio->bi_flags);
return 1;
}

@@ -1659,7 +1659,7 @@ static int process_checks(struct r1bio *r1_bio)

for (primary = 0; primary < conf->raid_disks * 2; primary++)
if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
- test_bit(BIO_UPTODATE, &r1_bio->bios[primary]->bi_flags)) {
+ test_bit(BIO_F_UPTODATE, &r1_bio->bios[primary]->bi_flags)) {
r1_bio->bios[primary]->bi_end_io = NULL;
rdev_dec_pending(conf->mirrors[primary].rdev, mddev);
break;
@@ -1675,7 +1675,7 @@ static int process_checks(struct r1bio *r1_bio)
if (r1_bio->bios[i]->bi_end_io != end_sync_read)
continue;

- if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) {
+ if (test_bit(BIO_F_UPTODATE, &sbio->bi_flags)) {
for (j = vcnt; j-- ; ) {
struct page *p, *s;
p = pbio->bi_io_vec[j].bv_page;
@@ -1690,7 +1690,7 @@ static int process_checks(struct r1bio *r1_bio)
if (j >= 0)
mddev->resync_mismatches += r1_bio->sectors;
if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)
- && test_bit(BIO_UPTODATE, &sbio->bi_flags))) {
+ && test_bit(BIO_F_UPTODATE, &sbio->bi_flags))) {
/* No need to write to this device. */
sbio->bi_end_io = NULL;
rdev_dec_pending(conf->mirrors[i].rdev, mddev);
@@ -1702,7 +1702,7 @@ static int process_checks(struct r1bio *r1_bio)
sbio->bi_idx = 0;
sbio->bi_phys_segments = 0;
sbio->bi_flags &= ~(BIO_POOL_MASK - 1);
- sbio->bi_flags |= 1 << BIO_UPTODATE;
+ sbio->bi_flags |= BIO_F_UPTODATE;
sbio->bi_next = NULL;
sbio->bi_sector = r1_bio->sector +
conf->mirrors[i].rdev->data_offset;
@@ -1877,7 +1877,7 @@ static int submit_bio_wait(int rw, struct bio *bio)
submit_bio(rw, bio);
wait_for_completion(&event);

- return test_bit(BIO_UPTODATE, &bio->bi_flags);
+ return test_bit(BIO_F_UPTODATE, &bio->bi_flags);
}

static int narrow_write_error(struct r1bio *r1_bio, int i)
@@ -1965,11 +1965,11 @@ static void handle_sync_write_finished(struct r1conf *conf, struct r1bio *r1_bio
struct bio *bio = r1_bio->bios[m];
if (bio->bi_end_io == NULL)
continue;
- if (test_bit(BIO_UPTODATE, &bio->bi_flags) &&
+ if (test_bit(BIO_F_UPTODATE, &bio->bi_flags) &&
test_bit(R1BIO_MadeGood, &r1_bio->state)) {
rdev_clear_badblocks(rdev, r1_bio->sector, s);
}
- if (!test_bit(BIO_UPTODATE, &bio->bi_flags) &&
+ if (!test_bit(BIO_F_UPTODATE, &bio->bi_flags) &&
test_bit(R1BIO_WriteError, &r1_bio->state)) {
if (!rdev_set_badblocks(rdev, r1_bio->sector, s, 0))
md_error(conf->mddev, rdev);
@@ -2264,7 +2264,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
/* take from bio_init */
bio->bi_next = NULL;
bio->bi_flags &= ~(BIO_POOL_MASK-1);
- bio->bi_flags |= 1 << BIO_UPTODATE;
+ bio->bi_flags |= BIO_F_UPTODATE;
bio->bi_rw = READ;
bio->bi_vcnt = 0;
bio->bi_idx = 0;
@@ -2412,7 +2412,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
/* remove last page from this bio */
bio->bi_vcnt--;
bio->bi_size -= len;
- bio->bi_flags &= ~(1<< BIO_SEG_VALID);
+ bio->bi_flags &= ~(BIO_F_SEG_VALID);
}
goto bio_full;
}
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 6e8aa21..fc4a076 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -268,7 +268,7 @@ static void raid_end_bio_io(struct r10bio *r10_bio)
} else
done = 1;
if (!test_bit(R10BIO_Uptodate, &r10_bio->state))
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
if (done) {
bio_endio(bio, 0);
/*
@@ -321,7 +321,7 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,

static void raid10_end_read_request(struct bio *bio, int error)
{
- int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct r10bio *r10_bio = bio->bi_private;
int slot, dev;
struct md_rdev *rdev;
@@ -391,7 +391,7 @@ static void one_write_done(struct r10bio *r10_bio)

static void raid10_end_write_request(struct bio *bio, int error)
{
- int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct r10bio *r10_bio = bio->bi_private;
int dev;
int dec_rdev = 1;
@@ -997,7 +997,7 @@ static void make_request(struct mddev *mddev, struct bio * bio)
* non-zero, then it is the number of not-completed requests.
*/
bio->bi_phys_segments = 0;
- clear_bit(BIO_SEG_VALID, &bio->bi_flags);
+ clear_bit(BIO_F_SEG_VALID, &bio->bi_flags);

if (rw == READ) {
/*
@@ -1603,7 +1603,7 @@ static void end_sync_read(struct bio *bio, int error)

d = find_bio_disk(conf, r10_bio, bio, NULL, NULL);

- if (test_bit(BIO_UPTODATE, &bio->bi_flags))
+ if (test_bit(BIO_F_UPTODATE, &bio->bi_flags))
set_bit(R10BIO_Uptodate, &r10_bio->state);
else
/* The write handler will notice the lack of
@@ -1654,7 +1654,7 @@ static void end_sync_request(struct r10bio *r10_bio)

static void end_sync_write(struct bio *bio, int error)
{
- int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct r10bio *r10_bio = bio->bi_private;
struct mddev *mddev = r10_bio->mddev;
struct r10conf *conf = mddev->private;
@@ -1720,7 +1720,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio)

/* find the first device with a block */
for (i=0; i<conf->copies; i++)
- if (test_bit(BIO_UPTODATE, &r10_bio->devs[i].bio->bi_flags))
+ if (test_bit(BIO_F_UPTODATE, &r10_bio->devs[i].bio->bi_flags))
break;

if (i == conf->copies)
@@ -1740,7 +1740,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio)
continue;
if (i == first)
continue;
- if (test_bit(BIO_UPTODATE, &r10_bio->devs[i].bio->bi_flags)) {
+ if (test_bit(BIO_F_UPTODATE, &r10_bio->devs[i].bio->bi_flags)) {
/* We know that the bi_io_vec layout is the same for
* both 'first' and 'i', so we just compare them.
* All vec entries are PAGE_SIZE;
@@ -1767,7 +1767,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio)
tbio->bi_idx = 0;
tbio->bi_phys_segments = 0;
tbio->bi_flags &= ~(BIO_POOL_MASK - 1);
- tbio->bi_flags |= 1 << BIO_UPTODATE;
+ tbio->bi_flags |= BIO_F_UPTODATE;
tbio->bi_next = NULL;
tbio->bi_rw = WRITE;
tbio->bi_private = r10_bio;
@@ -2221,7 +2221,7 @@ static int submit_bio_wait(int rw, struct bio *bio)
submit_bio(rw, bio);
wait_for_completion(&event);

- return test_bit(BIO_UPTODATE, &bio->bi_flags);
+ return test_bit(BIO_F_UPTODATE, &bio->bi_flags);
}

static int narrow_write_error(struct r10bio *r10_bio, int i)
@@ -2397,7 +2397,7 @@ static void handle_write_completed(struct r10conf *conf, struct r10bio *r10_bio)
rdev = conf->mirrors[dev].rdev;
if (r10_bio->devs[m].bio == NULL)
continue;
- if (test_bit(BIO_UPTODATE,
+ if (test_bit(BIO_F_UPTODATE,
&r10_bio->devs[m].bio->bi_flags)) {
rdev_clear_badblocks(
rdev,
@@ -2413,7 +2413,7 @@ static void handle_write_completed(struct r10conf *conf, struct r10bio *r10_bio)
rdev = conf->mirrors[dev].replacement;
if (r10_bio->devs[m].repl_bio == NULL)
continue;
- if (test_bit(BIO_UPTODATE,
+ if (test_bit(BIO_F_UPTODATE,
&r10_bio->devs[m].repl_bio->bi_flags)) {
rdev_clear_badblocks(
rdev,
@@ -2440,7 +2440,7 @@ static void handle_write_completed(struct r10conf *conf, struct r10bio *r10_bio)
r10_bio->sectors);
rdev_dec_pending(rdev, conf->mddev);
} else if (bio != NULL &&
- !test_bit(BIO_UPTODATE, &bio->bi_flags)) {
+ !test_bit(BIO_F_UPTODATE, &bio->bi_flags)) {
if (!narrow_write_error(r10_bio, m)) {
md_error(conf->mddev, rdev);
set_bit(R10BIO_Degraded,
@@ -2918,7 +2918,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,

bio = r10_bio->devs[i].bio;
bio->bi_end_io = NULL;
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
if (conf->mirrors[d].rdev == NULL ||
test_bit(Faulty, &conf->mirrors[d].rdev->flags))
continue;
@@ -2954,7 +2954,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,

/* Need to set up for writing to the replacement */
bio = r10_bio->devs[i].repl_bio;
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);

sector = r10_bio->devs[i].addr;
atomic_inc(&conf->mirrors[d].rdev->nr_pending);
@@ -2991,7 +2991,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,

bio->bi_flags &= ~(BIO_POOL_MASK - 1);
if (bio->bi_end_io)
- bio->bi_flags |= 1 << BIO_UPTODATE;
+ bio->bi_flags |= BIO_F_UPTODATE;
bio->bi_vcnt = 0;
bio->bi_idx = 0;
bio->bi_phys_segments = 0;
@@ -3022,7 +3022,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
/* remove last page from this bio */
bio2->bi_vcnt--;
bio2->bi_size -= len;
- bio2->bi_flags &= ~(1<< BIO_SEG_VALID);
+ bio2->bi_flags &= ~(BIO_F_SEG_VALID);
}
goto bio_full;
}
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 360f2b9..64b0172 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -605,7 +605,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
bi->bi_rw, i);
atomic_inc(&sh->count);
bi->bi_sector = sh->sector + rdev->data_offset;
- bi->bi_flags = 1 << BIO_UPTODATE;
+ bi->bi_flags = BIO_F_UPTODATE;
bi->bi_idx = 0;
bi->bi_io_vec[0].bv_len = STRIPE_SIZE;
bi->bi_io_vec[0].bv_offset = 0;
@@ -629,7 +629,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
rbi->bi_rw, i);
atomic_inc(&sh->count);
rbi->bi_sector = sh->sector + rrdev->data_offset;
- rbi->bi_flags = 1 << BIO_UPTODATE;
+ rbi->bi_flags = BIO_F_UPTODATE;
rbi->bi_idx = 0;
rbi->bi_io_vec[0].bv_len = STRIPE_SIZE;
rbi->bi_io_vec[0].bv_offset = 0;
@@ -1646,7 +1646,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
struct stripe_head *sh = bi->bi_private;
struct r5conf *conf = sh->raid_conf;
int disks = sh->disks, i;
- int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bi->bi_flags);
char b[BDEVNAME_SIZE];
struct md_rdev *rdev = NULL;

@@ -1754,7 +1754,7 @@ static void raid5_end_write_request(struct bio *bi, int error)
struct r5conf *conf = sh->raid_conf;
int disks = sh->disks, i;
struct md_rdev *uninitialized_var(rdev);
- int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bi->bi_flags);
sector_t first_bad;
int bad_sectors;
int replacement = 0;
@@ -2403,7 +2403,7 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
while (bi && bi->bi_sector <
sh->dev[i].sector + STRIPE_SECTORS) {
struct bio *nextbi = r5_next_bio(bi, sh->dev[i].sector);
- clear_bit(BIO_UPTODATE, &bi->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bi->bi_flags);
if (!raid5_dec_bi_phys_segments(bi)) {
md_write_end(conf->mddev);
bi->bi_next = *return_bi;
@@ -2418,7 +2418,7 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
while (bi && bi->bi_sector <
sh->dev[i].sector + STRIPE_SECTORS) {
struct bio *bi2 = r5_next_bio(bi, sh->dev[i].sector);
- clear_bit(BIO_UPTODATE, &bi->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bi->bi_flags);
if (!raid5_dec_bi_phys_segments(bi)) {
md_write_end(conf->mddev);
bi->bi_next = *return_bi;
@@ -2442,7 +2442,7 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
sh->dev[i].sector + STRIPE_SECTORS) {
struct bio *nextbi =
r5_next_bio(bi, sh->dev[i].sector);
- clear_bit(BIO_UPTODATE, &bi->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bi->bi_flags);
if (!raid5_dec_bi_phys_segments(bi)) {
bi->bi_next = *return_bi;
*return_bi = bi;
@@ -3741,7 +3741,7 @@ static void raid5_align_endio(struct bio *bi, int error)
struct bio* raid_bi = bi->bi_private;
struct mddev *mddev;
struct r5conf *conf;
- int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bi->bi_flags);
struct md_rdev *rdev;

bio_put(bi);
@@ -3837,7 +3837,7 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio)
rcu_read_unlock();
raid_bio->bi_next = (void*)rdev;
align_bi->bi_bdev = rdev->bdev;
- align_bi->bi_flags &= ~(1 << BIO_SEG_VALID);
+ align_bi->bi_flags &= ~(BIO_F_SEG_VALID);
align_bi->bi_sector += rdev->data_offset;

if (!bio_fits_rdev(align_bi) ||
@@ -4055,11 +4055,11 @@ static void make_request(struct mddev *mddev, struct bio * bi)
release_stripe(sh);
} else {
/* cannot get stripe for read-ahead, just give-up */
- clear_bit(BIO_UPTODATE, &bi->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bi->bi_flags);
finish_wait(&conf->wait_for_overlap, &w);
break;
}
-
+
}
if (!plugged)
md_wakeup_thread(mddev->thread);
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index 690c333..c2ae6d0 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -219,7 +219,7 @@ static void xpram_make_request(struct request_queue *q, struct bio *bio)
index++;
}
}
- set_bit(BIO_UPTODATE, &bio->bi_flags);
+ set_bit(BIO_F_UPTODATE, &bio->bi_flags);
bio_endio(bio, 0);
return;
fail:
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index 0cb39ff..1a81a22 100644
--- a/drivers/scsi/sd_dif.c
+++ b/drivers/scsi/sd_dif.c
@@ -408,7 +408,7 @@ int sd_dif_prepare(struct request *rq, sector_t hw_sector, unsigned int sector_s
kunmap_atomic(sdt, KM_USER0);
}

- bio->bi_flags |= BIO_MAPPED_INTEGRITY;
+ bio->bi_flags |= BIO_F_MAPPED_INTEGRITY;
}

return 0;
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 2a2a92d..ecd36c5 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -528,7 +528,7 @@ static void __zram_make_request(struct zram *zram, struct bio *bio, int rw)
update_position(&index, &offset, bvec);
}

- set_bit(BIO_UPTODATE, &bio->bi_flags);
+ set_bit(BIO_F_UPTODATE, &bio->bi_flags);
bio_endio(bio, 0);
return;

diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 8572eae..21c67e9 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -633,7 +633,7 @@ static void iblock_bio_done(struct bio *bio, int err)
/*
* Set -EIO if !BIO_UPTODATE and the passed is still err=0
*/
- if (!test_bit(BIO_UPTODATE, &bio->bi_flags) && !err)
+ if (!test_bit(BIO_F_UPTODATE, &bio->bi_flags) && !err)
err = -EIO;

if (err != 0) {
diff --git a/fs/bio.c b/fs/bio.c
index b980ecd..ef6d6df 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -254,7 +254,7 @@ EXPORT_SYMBOL(bio_free);
void bio_init(struct bio *bio)
{
memset(bio, 0, sizeof(*bio));
- bio->bi_flags = 1 << BIO_UPTODATE;
+ bio->bi_flags = BIO_F_UPTODATE;
atomic_set(&bio->bi_cnt, 1);
}
EXPORT_SYMBOL(bio_init);
@@ -426,7 +426,7 @@ EXPORT_SYMBOL(bio_put);

inline int bio_phys_segments(struct request_queue *q, struct bio *bio)
{
- if (unlikely(!bio_flagged(bio, BIO_SEG_VALID)))
+ if (unlikely(!bio_flagged(bio, BIO_F_SEG_VALID)))
blk_recount_segments(q, bio);

return bio->bi_phys_segments;
@@ -453,7 +453,7 @@ void __bio_clone(struct bio *bio, struct bio *bio_src)
*/
bio->bi_sector = bio_src->bi_sector;
bio->bi_bdev = bio_src->bi_bdev;
- bio->bi_flags |= 1 << BIO_CLONED;
+ bio->bi_flags |= BIO_F_CLONED;
bio->bi_rw = bio_src->bi_rw;
bio->bi_vcnt = bio_src->bi_vcnt;
bio->bi_size = bio_src->bi_size;
@@ -615,7 +615,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page

/* If we may be able to merge these biovecs, force a recount */
if (bio->bi_vcnt && (BIOVEC_PHYS_MERGEABLE(bvec-1, bvec)))
- bio->bi_flags &= ~(1 << BIO_SEG_VALID);
+ bio->bi_flags &= ~(BIO_F_SEG_VALID);

bio->bi_vcnt++;
bio->bi_phys_segments++;
@@ -1043,7 +1043,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q,
bio->bi_rw |= REQ_WRITE;

bio->bi_bdev = bdev;
- bio->bi_flags |= (1 << BIO_USER_MAPPED);
+ bio->bi_flags |= (BIO_F_USER_MAPPED);
return bio;

out_unmap:
@@ -1439,8 +1439,8 @@ EXPORT_SYMBOL(bio_flush_dcache_pages);
void bio_endio(struct bio *bio, int error)
{
if (error)
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
- else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
+ else if (!test_bit(BIO_F_UPTODATE, &bio->bi_flags))
error = -EIO;

if (bio->bi_end_io)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 534266f..b148e3a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2694,8 +2694,8 @@ static void btrfs_end_empty_barrier(struct bio *bio, int err)
{
if (err) {
if (err == -EOPNOTSUPP)
- set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
+ set_bit(BIO_F_EOPNOTSUPP, &bio->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
}
if (bio->bi_private)
complete(bio->bi_private);
@@ -2724,12 +2724,12 @@ static int write_dev_flush(struct btrfs_device *device, int wait)

wait_for_completion(&device->flush_wait);

- if (bio_flagged(bio, BIO_EOPNOTSUPP)) {
+ if (bio_flagged(bio, BIO_F_EOPNOTSUPP)) {
printk("btrfs: disabling barriers on dev %s\n",
device->name);
device->nobarriers = 1;
}
- if (!bio_flagged(bio, BIO_UPTODATE)) {
+ if (!bio_flagged(bio, BIO_F_UPTODATE)) {
ret = -EIO;
}

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index a55fbe6..ae273bc 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1898,7 +1898,7 @@ int repair_io_failure(struct btrfs_mapping_tree *map_tree, u64 start,
btrfsic_submit_bio(WRITE_SYNC, bio);
wait_for_completion(&compl);

- if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) {
+ if (!test_bit(BIO_F_UPTODATE, &bio->bi_flags)) {
/* try to remap that extent elsewhere? */
bio_put(bio);
return -EIO;
@@ -2251,7 +2251,7 @@ static void end_bio_extent_writepage(struct bio *bio, int err)
*/
static void end_bio_extent_readpage(struct bio *bio, int err)
{
- int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct bio_vec *bvec_end = bio->bi_io_vec + bio->bi_vcnt - 1;
struct bio_vec *bvec = bio->bi_io_vec;
struct extent_io_tree *tree;
@@ -2322,7 +2322,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
if (ret == 0) {
error_handled:
uptodate =
- test_bit(BIO_UPTODATE, &bio->bi_flags);
+ test_bit(BIO_F_UPTODATE, &bio->bi_flags);
if (err)
uptodate = 0;
uncache_state(&cached);
@@ -2407,7 +2407,7 @@ static int submit_one_bio(int rw, struct bio *bio, int mirror_num,
else
btrfsic_submit_bio(rw, bio);

- if (bio_flagged(bio, BIO_EOPNOTSUPP))
+ if (bio_flagged(bio, BIO_F_EOPNOTSUPP))
ret = -EOPNOTSUPP;
bio_put(bio);
return ret;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 892b347..501ca4a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5751,7 +5751,7 @@ static void btrfs_endio_direct_read(struct bio *bio, int err)

/* If we had a csum failure make sure to clear the uptodate flag */
if (err)
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
dio_end_io(bio, err);
}

@@ -5857,7 +5857,7 @@ out_done:

/* If we had an error make sure to clear the uptodate flag */
if (err)
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
dio_end_io(bio, err);
}

@@ -5897,7 +5897,7 @@ static void btrfs_end_dio_bio(struct bio *bio, int err)
if (dip->errors)
bio_io_error(dip->orig_bio);
else {
- set_bit(BIO_UPTODATE, &dip->orig_bio->bi_flags);
+ set_bit(BIO_F_UPTODATE, &dip->orig_bio->bi_flags);
bio_endio(dip->orig_bio, 0);
}
out:
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index abc0fbf..59fd661 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -739,7 +739,7 @@ static int scrub_fixup_io(int rw, struct block_device *bdev, sector_t sector,
/* this will also unplug the queue */
wait_for_completion(&complete);

- ret = !test_bit(BIO_UPTODATE, &bio->bi_flags);
+ ret = !test_bit(BIO_F_UPTODATE, &bio->bi_flags);
bio_put(bio);
return ret;
}
@@ -778,7 +778,7 @@ static void scrub_checksum(struct btrfs_work *work)
}

sbio->bio->bi_flags &= ~(BIO_POOL_MASK - 1);
- sbio->bio->bi_flags |= 1 << BIO_UPTODATE;
+ sbio->bio->bi_flags |= BIO_F_UPTODATE;
sbio->bio->bi_phys_segments = 0;
sbio->bio->bi_idx = 0;

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ef41f28..406ab98 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3942,7 +3942,7 @@ static void btrfs_end_bio(struct bio *bio, int err)
* this bio is actually up to date, we didn't
* go over the max number of errors
*/
- set_bit(BIO_UPTODATE, &bio->bi_flags);
+ set_bit(BIO_F_UPTODATE, &bio->bi_flags);
err = 0;
}
kfree(bbio);
diff --git a/fs/buffer.c b/fs/buffer.c
index 1a30db7..05cc114 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2849,13 +2849,13 @@ static void end_bio_bh_io_sync(struct bio *bio, int err)
struct buffer_head *bh = bio->bi_private;

if (err == -EOPNOTSUPP) {
- set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
+ set_bit(BIO_F_EOPNOTSUPP, &bio->bi_flags);
}

- if (unlikely (test_bit(BIO_QUIET,&bio->bi_flags)))
+ if (unlikely (test_bit(BIO_F_QUIET,&bio->bi_flags)))
set_bit(BH_Quiet, &bh->b_state);

- bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags));
+ bh->b_end_io(bh, test_bit(BIO_F_UPTODATE, &bio->bi_flags));
bio_put(bio);
}

@@ -2898,7 +2898,7 @@ int submit_bh(int rw, struct buffer_head * bh)
bio_get(bio);
submit_bio(rw, bio);

- if (bio_flagged(bio, BIO_EOPNOTSUPP))
+ if (bio_flagged(bio, BIO_F_EOPNOTSUPP))
ret = -EOPNOTSUPP;

bio_put(bio);
diff --git a/fs/direct-io.c b/fs/direct-io.c
index f4aadd1..181cf34 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -484,7 +484,7 @@ static struct bio *dio_await_one(struct dio *dio)
*/
static int dio_bio_complete(struct dio *dio, struct bio *bio)
{
- const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ const int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct bio_vec *bvec = bio->bi_io_vec;
int page_no;

diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 4758518..1be5c0f 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -197,7 +197,7 @@ static void ext4_end_bio(struct bio *bio, int error)
BUG_ON(!io_end);
bio->bi_private = NULL;
bio->bi_end_io = NULL;
- if (test_bit(BIO_UPTODATE, &bio->bi_flags))
+ if (test_bit(BIO_F_UPTODATE, &bio->bi_flags))
error = 0;
bio_put(bio);

@@ -265,7 +265,7 @@ void ext4_io_submit(struct ext4_io_submit *io)
if (bio) {
bio_get(io->io_bio);
submit_bio(io->io_op, io->io_bio);
- BUG_ON(bio_flagged(io->io_bio, BIO_EOPNOTSUPP));
+ BUG_ON(bio_flagged(io->io_bio, BIO_F_EOPNOTSUPP));
bio_put(io->io_bio);
}
io->io_bio = NULL;
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
index 7daf4b8..34028a7 100644
--- a/fs/hfsplus/wrapper.c
+++ b/fs/hfsplus/wrapper.c
@@ -27,7 +27,7 @@ struct hfsplus_wd {
static void hfsplus_end_io_sync(struct bio *bio, int err)
{
if (err)
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
+ clear_bit(BIO_F_UPTODATE, &bio->bi_flags);
complete(bio->bi_private);
}

diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index 2eb952c..d2882cf 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -2208,7 +2208,7 @@ static void lbmIODone(struct bio *bio, int error)

bp->l_flag |= lbmDONE;

- if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) {
+ if (!test_bit(BIO_F_UPTODATE, &bio->bi_flags)) {
bp->l_flag |= lbmERROR;

jfs_err("lbmIODone: I/O error in JFS log");
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 6740d34..ee503da 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -287,7 +287,7 @@ static void metapage_read_end_io(struct bio *bio, int err)
{
struct page *page = bio->bi_private;

- if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) {
+ if (!test_bit(BIO_F_UPTODATE, &bio->bi_flags)) {
printk(KERN_ERR "metapage_read_end_io: I/O error\n");
SetPageError(page);
}
@@ -344,7 +344,7 @@ static void metapage_write_end_io(struct bio *bio, int err)

BUG_ON(!PagePrivate(page));

- if (! test_bit(BIO_UPTODATE, &bio->bi_flags)) {
+ if (! test_bit(BIO_F_UPTODATE, &bio->bi_flags)) {
printk(KERN_ERR "metapage_write_end_io: I/O error\n");
SetPageError(page);
}
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c
index df0de27..f93b515 100644
--- a/fs/logfs/dev_bdev.c
+++ b/fs/logfs/dev_bdev.c
@@ -41,7 +41,7 @@ static int sync_request(struct page *page, struct block_device *bdev, int rw)

submit_bio(rw, &bio);
wait_for_completion(&complete);
- return test_bit(BIO_UPTODATE, &bio.bi_flags) ? 0 : -EIO;
+ return test_bit(BIO_F_UPTODATE, &bio.bi_flags) ? 0 : -EIO;
}

static int bdev_readpage(void *_sb, struct page *page)
@@ -66,7 +66,7 @@ static DECLARE_WAIT_QUEUE_HEAD(wq);

static void writeseg_end_io(struct bio *bio, int err)
{
- const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ const int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
struct super_block *sb = bio->bi_private;
struct logfs_super *super = logfs_super(sb);
@@ -173,7 +173,7 @@ static void bdev_writeseg(struct super_block *sb, u64 ofs, size_t len)

static void erase_end_io(struct bio *bio, int err)
{
- const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ const int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct super_block *sb = bio->bi_private;
struct logfs_super *super = logfs_super(sb);

diff --git a/fs/mpage.c b/fs/mpage.c
index 643e9f5..7f2ac80 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -43,7 +43,7 @@
*/
static void mpage_end_io(struct bio *bio, int err)
{
- const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ const int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;

do {
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 48cfac3..28d47ab 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -186,7 +186,7 @@ retry:
static void bl_end_io_read(struct bio *bio, int err)
{
struct parallel_io *par = bio->bi_private;
- const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ const int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
struct nfs_read_data *rdata = (struct nfs_read_data *)par->data;

@@ -345,7 +345,7 @@ static void mark_extents_written(struct pnfs_block_layout *bl,
static void bl_end_io_write_zero(struct bio *bio, int err)
{
struct parallel_io *par = bio->bi_private;
- const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ const int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
struct nfs_write_data *wdata = (struct nfs_write_data *)par->data;

@@ -371,7 +371,7 @@ static void bl_end_io_write_zero(struct bio *bio, int err)
static void bl_end_io_write(struct bio *bio, int err)
{
struct parallel_io *par = bio->bi_private;
- const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ const int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct nfs_write_data *wdata = (struct nfs_write_data *)par->data;

if (!uptodate) {
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
index 850a7c0..cb739ec 100644
--- a/fs/nilfs2/segbuf.c
+++ b/fs/nilfs2/segbuf.c
@@ -340,11 +340,11 @@ void nilfs_add_checksums_on_logs(struct list_head *logs, u32 seed)
*/
static void nilfs_end_bio_write(struct bio *bio, int err)
{
- const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ const int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct nilfs_segment_buffer *segbuf = bio->bi_private;

if (err == -EOPNOTSUPP) {
- set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
+ set_bit(BIO_F_EOPNOTSUPP, &bio->bi_flags);
bio_put(bio);
/* to be detected by submit_seg_bio() */
}
@@ -377,7 +377,7 @@ static int nilfs_segbuf_submit_bio(struct nilfs_segment_buffer *segbuf,
bio->bi_private = segbuf;
bio_get(bio);
submit_bio(mode, bio);
- if (bio_flagged(bio, BIO_EOPNOTSUPP)) {
+ if (bio_flagged(bio, BIO_F_EOPNOTSUPP)) {
bio_put(bio);
err = -EOPNOTSUPP;
goto failed;
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 74b9baf..1a66c9b 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -360,7 +360,7 @@ xfs_end_bio(
xfs_ioend_t *ioend = bio->bi_private;

ASSERT(atomic_read(&bio->bi_cnt) >= 1);
- ioend->io_error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : error;
+ ioend->io_error = test_bit(BIO_F_UPTODATE, &bio->bi_flags) ? 0 : error;

/* Toss bio and pass work off to an xfsdatad thread */
bio->bi_private = NULL;
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 4053cbd..177fb9c 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -83,19 +83,35 @@ struct bio {
/*
* bio flags
*/
-#define BIO_UPTODATE 0 /* ok after I/O completion */
-#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
-#define BIO_EOF 2 /* out-out-bounds error */
-#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
-#define BIO_CLONED 4 /* doesn't own data */
-#define BIO_BOUNCED 5 /* bio is a bounce bio */
-#define BIO_USER_MAPPED 6 /* contains user pages */
-#define BIO_EOPNOTSUPP 7 /* not supported */
-#define BIO_NULL_MAPPED 8 /* contains invalid user pages */
-#define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */
-#define BIO_QUIET 10 /* Make BIO Quiet */
-#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */
-#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
+enum bio_flag_bits {
+ __BIO_UPTODATE, /* ok after I/O completion */
+ __BIO_RW_BLOCK, /* RW_AHEAD set, and read/write would block */
+ __BIO_EOF, /* out-out-bounds error */
+ __BIO_SEG_VALID, /* bi_phys_segments valid */
+ __BIO_CLONED, /* doesn't own data */
+ __BIO_BOUNCED, /* bio is a bounce bio */
+ __BIO_USER_MAPPED, /* contains user pages */
+ __BIO_EOPNOTSUPP, /* not supported */
+ __BIO_NULL_MAPPED, /* contains invalid user pages */
+ __BIO_FS_INTEGRITY, /* fs owns integrity data, not block layer */
+ __BIO_QUIET, /* Make BIO Quiet */
+ __BIO_MAPPED_INTEGRITY, /* integrity metadata has been remapped */
+};
+
+#define BIO_F_UPTODATE (1 << __BIO_UPTODATE)
+#define BIO_F_RW_BLOCK (1 << __BIO_RW_BLOCK)
+#define BIO_F_EOF (1 << __BIO_EOF)
+#define BIO_F_SEG_VALID (1 << __BIO_SEG_VALID)
+#define BIO_F_CLONED (1 << __BIO_CLONED)
+#define BIO_F_BOUNCED (1 << __BIO_BOUNCED)
+#define BIO_F_USER_MAPPED (1 << __BIO_USER_MAPPED)
+#define BIO_F_EOPNOTSUPP (1 << __BIO_EOPNOTSUPP)
+#define BIO_F_NULL_MAPPED (1 << __BIO_NULL_MAPPED)
+#define BIO_F_FS_INTEGRITY (1 << __BIO_FS_INTEGRITY)
+#define BIO_F_QUIET (1 << __BIO_QUIET)
+#define BIO_F_MAPPED_INTEGRITY (1 << __BIO_MAPPED_INTEGRITY)
+
+#define bio_flagged(bio, flag) ((bio)->bi_flags & (flag))

/*
* top 4 bits of bio flags indicate the pool this bio came from
diff --git a/mm/bounce.c b/mm/bounce.c
index 4e9ae72..cb839b3 100644
--- a/mm/bounce.c
+++ b/mm/bounce.c
@@ -126,8 +126,8 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool, int err)
struct bio_vec *bvec, *org_vec;
int i;

- if (test_bit(BIO_EOPNOTSUPP, &bio->bi_flags))
- set_bit(BIO_EOPNOTSUPP, &bio_orig->bi_flags);
+ if (test_bit(BIO_F_EOPNOTSUPP, &bio->bi_flags))
+ set_bit(BIO_F_EOPNOTSUPP, &bio_orig->bi_flags);

/*
* free up bounce indirect pages used
@@ -160,7 +160,7 @@ static void __bounce_end_io_read(struct bio *bio, mempool_t *pool, int err)
{
struct bio *bio_orig = bio->bi_private;

- if (test_bit(BIO_UPTODATE, &bio->bi_flags))
+ if (test_bit(BIO_F_UPTODATE, &bio->bi_flags))
copy_to_high_bio_irq(bio_orig, bio);

bounce_end_io(bio, pool, err);
@@ -244,7 +244,7 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig,
}

bio->bi_bdev = (*bio_orig)->bi_bdev;
- bio->bi_flags |= (1 << BIO_BOUNCED);
+ bio->bi_flags |= (BIO_F_BOUNCED);
bio->bi_sector = (*bio_orig)->bi_sector;
bio->bi_rw = (*bio_orig)->bi_rw;

diff --git a/mm/page_io.c b/mm/page_io.c
index dc76b4d..5e72235 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -42,7 +42,7 @@ static struct bio *get_swap_bio(gfp_t gfp_flags,

static void end_swap_bio_write(struct bio *bio, int err)
{
- const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ const int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct page *page = bio->bi_io_vec[0].bv_page;

if (!uptodate) {
@@ -68,7 +68,7 @@ static void end_swap_bio_write(struct bio *bio, int err)

void end_swap_bio_read(struct bio *bio, int err)
{
- const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ const int uptodate = test_bit(BIO_F_UPTODATE, &bio->bi_flags);
struct page *page = bio->bi_io_vec[0].bv_page;

if (!uptodate) {
\
 
 \ /
  Last update: 2012-03-02 00:29    [W:0.116 / U:1.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site