mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Muthu Kumar <muthu.lkml@gmail.com>,
	linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	Jens Axboe <axboe@kernel.dk>,
	martin.petersen@oracle.com
Subject: Re: [PATCH] Fix setting bio flags in drivers (sd_dif/floppy).
Date: Wed, 29 Feb 2012 19:22:28 -0500	[thread overview]
Message-ID: <yq11updqiez.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <20120229161215.81505738.akpm@linux-foundation.org> (Andrew Morton's message of "Wed, 29 Feb 2012 16:12:15 -0800")

>>>>> "Andrew" == Andrew Morton <akpm@linux-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

  reply	other threads:[~2012-03-01  0:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29 23:22 Muthu Kumar
2012-03-01  0:08 ` Linus Torvalds
2012-03-01  0:20   ` Andrew Morton
2012-03-01  8:23   ` Jens Axboe
2012-03-01  0:12 ` Andrew Morton
2012-03-01  0:22   ` Martin K. Petersen [this message]
2012-03-01 20:23   ` Muthu Kumar
2012-03-01 20:25     ` Jens Axboe
2012-03-01 21:20       ` Muthu Kumar
2012-03-01 22:03         ` Jens Axboe
2012-03-01 23:27           ` Muthu Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yq11updqiez.fsf@sermon.lab.mkp.net \
    --to=martin.petersen@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muthu.lkml@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®