Fix setting bio flags in drivers (sd_dif/floppy).
Signed-off-by: Muthukumar R <[email protected]>
---------------------------
drivers/block/floppy.c | 2 +-
drivers/scsi/sd_dif.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
------------------------
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 9baf11e..744f078 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 = (1 << BIO_QUIET);
init_completion(&complete);
bio.bi_private = &complete;
bio.bi_end_io = floppy_rb0_complete;
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index 0cb39ff..f8fb2d6 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 |= (1 << BIO_MAPPED_INTEGRITY);
}
return 0;
On Wed, Feb 29, 2012 at 3:22 PM, Muthu Kumar <[email protected]> wrote:
> Fix setting bio flags in drivers (sd_dif/floppy).
A quick grep seems to agree that these are the only obvious ones.
Jens? Will you send this to me, or should I take it directly?
And when did Andrew change his name? Nobody tells me these things.
Linus
On Wed, 29 Feb 2012 18:22:14 -0500
Muthu Kumar <[email protected]> wrote:
> Fix setting bio flags in drivers (sd_dif/floppy).
>
> ...
>
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index 9baf11e..744f078 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 = (1 << BIO_QUIET);
> init_completion(&complete);
> bio.bi_private = &complete;
> bio.bi_end_io = floppy_rb0_complete;
> diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
> index 0cb39ff..f8fb2d6 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 |= (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.
On Wed, 29 Feb 2012 16:08:15 -0800
Linus Torvalds <[email protected]> wrote:
> On Wed, Feb 29, 2012 at 3:22 PM, Muthu Kumar <[email protected]> wrote:
> > Fix setting bio flags in drivers (sd_dif/floppy).
>
> A quick grep seems to agree that these are the only obvious ones.
>
> Jens? Will you send this to me, or should I take it directly?
I'll send at you tomorrowish. Or you can take it directly, after fixing
the wordwrapping ;)
I don't know if a -stable backport is warranted...
> And when did Andrew change his name? Nobody tells me these things.
oh gawd no. Somehow google managed to replace my name with my son's in
various people's address books. Now it's gone and done it with
[email protected] as well as [email protected]. I'm in a losing
fight trying to prevent those two identities from getting intermingled,
absorbed and generally borgified. And how did google know that we're
related? I can only think that it snarfed that connection from
facebook.
>>>>> "Andrew" == Andrew Morton <[email protected]> writes:
>> + bio->bi_flags |= (1 << BIO_MAPPED_INTEGRITY);
>> }
>>
>> return 0;
Andrew> urgh. This isn't the first time.
Andrew> It's too easy for people to make this mistake. I'm not sure
Andrew> what a good fix would be - I don't think sparse can save us with
Andrew> __bitwise or similar.
Yeah. I actually got bitten by this recently.
This is what I'm doing in my current working tree (this particular flag
has moved for other reasons). But we could provide a similar wrapper for
bio->bi_flags...
[...]
+static inline unsigned int bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
+{
+ if (bio && bio->bi_integrity)
+ return bio->bi_integrity->bip_flags & (1 << flag);
+
+ return 0;
+}
+
+static inline void bio_integrity_flag(struct bio *bio, enum bip_flags flag)
+{
+ if (bio && bio->bi_integrity)
+ bio->bi_integrity->bip_flags |= (1 << flag);
+}
[...]
--
Martin K. Petersen Oracle Linux Engineering