Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756609Ab2CAAWk (ORCPT ); Wed, 29 Feb 2012 19:22:40 -0500 Received: from rcsinet15.oracle.com ([148.87.113.117]:34190 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755581Ab2CAAWj (ORCPT ); Wed, 29 Feb 2012 19:22:39 -0500 To: Andrew Morton Cc: Muthu Kumar , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, Jens Axboe , martin.petersen@oracle.com Subject: Re: [PATCH] Fix setting bio flags in drivers (sd_dif/floppy). From: "Martin K. Petersen" Organization: Oracle References: <20120229161215.81505738.akpm@linux-foundation.org> Date: Wed, 29 Feb 2012 19:22:28 -0500 In-Reply-To: <20120229161215.81505738.akpm@linux-foundation.org> (Andrew Morton's message of "Wed, 29 Feb 2012 16:12:15 -0800") Message-ID: User-Agent: Gnus/5.110017 (No Gnus v0.17) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-CT-RefId: str=0001.0A090202.4F4EC148.0107,ss=1,re=0.000,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1234 Lines: 42 >>>>> "Andrew" == Andrew Morton 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/