From: Tejun Heo <tj@kernel.org>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
linux-next@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>,
dm-devel@redhat.com
Subject: [PATCH] block: don't test for partition size in bdget_disk() and blk_lookup_devt()
Date: Fri, 29 Aug 2008 11:35:17 +0200 [thread overview]
Message-ID: <48B7C2D5.2060209@kernel.org> (raw)
In-Reply-To: <20080829070515.GL20055@kernel.dk>
bdget_disk() and blk_lookup_devt() never cared whether the specified
partition (or disk) is zero sized or not. I got confused while
converting those not to depend on consecutive minor numbers in commit
5a6411b1178baf534aa9138052864dfa89d3eada and later when dev0 was added
it broke callers which expected to get valid return for zero sized
disk devices.
So, they never needed nr_sects checks in the first place. Kill them.
This problem was spotted and debugged by Bartlmoiej Zolnierkiewicz.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
Thanks for the good spotting. I got confused between the meaning of
!part and !part->nr_sects and added the wrong check during conversion.
I audited the rest and it seems those two are the only ones.
Thanks.
block/genhd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: work/block/genhd.c
===================================================================
--- work.orig/block/genhd.c
+++ work/block/genhd.c
@@ -586,7 +586,7 @@ extern struct block_device *bdget_disk(s
struct block_device *bdev = NULL;
part = disk_get_part(disk, partno);
- if (part && (part->nr_sects || partno == 0))
+ if (part)
bdev = bdget(part_devt(part));
disk_put_part(part);
@@ -1032,7 +1032,7 @@ dev_t blk_lookup_devt(const char *name,
continue;
part = disk_get_part(disk, partno);
- if (part && (part->nr_sects || partno == 0)) {
+ if (part) {
devt = part_devt(part);
disk_put_part(part);
break;
next prev parent reply other threads:[~2008-08-29 9:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-27 8:34 linux-next: Tree for August 27 Stephen Rothwell
2008-08-27 10:06 ` Bartlomiej Zolnierkiewicz
2008-08-27 14:57 ` Bartlomiej Zolnierkiewicz
2008-08-27 19:45 ` Bartlomiej Zolnierkiewicz
2008-08-29 0:10 ` Bartlomiej Zolnierkiewicz
2008-08-29 7:05 ` Jens Axboe
2008-08-29 8:36 ` Stephen Rothwell
2008-08-29 9:35 ` Tejun Heo [this message]
2008-08-29 9:37 ` Tejun Heo
2008-08-29 9:42 ` Jens Axboe
2008-08-29 19:23 ` Bartlomiej Zolnierkiewicz
2008-08-30 9:10 ` Tejun Heo
2008-08-31 13:38 ` Bartlomiej Zolnierkiewicz
2008-09-01 11:00 ` [PATCH #blk-for-2.8] init: DEBUG_BLOCK_EXT_DEVT requires explicit root= param Tejun Heo
2008-09-01 11:16 ` Jens Axboe
2008-09-01 11:20 ` Tejun Heo
2008-09-01 11:30 ` Jens Axboe
2008-09-01 11:38 ` Tejun Heo
2008-09-01 16:34 ` Bartlomiej Zolnierkiewicz
2008-08-28 1:25 ` linux-next: Tree for August 27 Stephen Rothwell
2008-08-28 9:08 ` Ingo Molnar
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=48B7C2D5.2060209@kernel.org \
--to=tj@kernel.org \
--cc=bzolnier@gmail.com \
--cc=dm-devel@redhat.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sfr@canb.auug.org.au \
/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;
as well as URLs for NNTP newsgroup(s).