[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yq11updqiez.fsf@sermon.lab.mkp.net>
Date: Wed, 29 Feb 2012 19:22:28 -0500
From: "Martin K. Petersen" <martin.petersen@...cle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Muthu Kumar <muthu.lkml@...il.com>, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org, Jens Axboe <axboe@...nel.dk>,
martin.petersen@...cle.com
Subject: Re: [PATCH] Fix setting bio flags in drivers (sd_dif/floppy).
>>>>> "Andrew" == Andrew Morton <akpm@...ux-foundation.org> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists