public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andries Brouwer <Andries.Brouwer@cwi.nl>
To: torvalds@osdl.org, akpm@osdl.org
Cc: bon@elektron.ikp.physik.tu-darmstadt.de, linux-kernel@vger.kernel.org
Subject: [PATCH] partitions/msdos.c
Date: Sat, 26 Feb 2005 22:35:00 +0100	[thread overview]
Message-ID: <20050226213459.GA21137@apps.cwi.nl> (raw)

A well-known kernel bug is that it guesses at the partition type
and the partitions on any disk it encounters. This is bad because
needless I/O is done, slowing down the boot, sometimes quite a lot,
especially when I/O errors occur. And it is bad because sometimes
we guess wrong.

In other words, we need the user space command `partition',
where "partition -t dos /dev/sda" reads a DOS-type partition
table. (And "partition /dev/sda" tries all known heuristics
to decide what type of partitioning might be present.)
The two variants are: (i) partition tells the kernel
to do the partition table reading, and (ii) partition uses partx
to read the partition table and tells the kernel one-by-one
about the partitions found this way.

Since this is a fundamental change, a long transition period
is needed, and that period could start with a kernel boot parameter
telling the kernel not to do partition table parsing on a particular
disk, or a particular type of disks, or all disks.

This could have been the intro to a patch doing that, but is not.
(It is just an RFC.)

The tiny patch below prompted the above - it was suggested by Uwe Bonnes
who encountered USB devices without partition table where our present
heuristics did not suffice to stop partition table parsing.
It causes the kernel to ignore partitions of type 0. A band-aid.

I think nobody uses such partitions seriously, but nevertheless this
should probably live in -mm for a while to see if anybody complains.

Andries

diff -uprN -X /linux/dontdiff a/fs/partitions/msdos.c b/fs/partitions/msdos.c
--- a/fs/partitions/msdos.c	2004-12-29 03:39:55.000000000 +0100
+++ b/fs/partitions/msdos.c	2005-02-26 22:21:06.000000000 +0100
@@ -430,6 +430,8 @@ int msdos_partition(struct parsed_partit
 	for (slot = 1 ; slot <= 4 ; slot++, p++) {
 		u32 start = START_SECT(p)*sector_size;
 		u32 size = NR_SECTS(p)*sector_size;
+		if (SYS_IND(p) == 0)
+			continue;
 		if (!size)
 			continue;
 		if (is_extended_partition(p)) {

             reply	other threads:[~2005-02-26 21:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-26 21:35 Andries Brouwer [this message]
2005-02-26 22:04 ` [PATCH] partitions/msdos.c Uwe Bonnes
2005-02-26 22:28   ` Linus Torvalds
2005-02-26 22:35     ` Linus Torvalds
2005-02-26 23:24       ` Uwe Bonnes
2005-02-26 23:46         ` Linus Torvalds
2005-02-26 23:53           ` Andries Brouwer
2005-02-26 22:52     ` Andries Brouwer
2005-02-26 23:12       ` Linus Torvalds
2005-02-26 23:40         ` Andries Brouwer
2005-02-26 23:49           ` Linus Torvalds
2005-02-27  0:47             ` Uwe Bonnes
2005-02-27  1:04               ` Linus Torvalds
2005-02-27 14:33                 ` Uwe Bonnes
2005-02-27  1:07               ` Andries Brouwer
2005-03-01  6:53           ` Rogier Wolff
2005-03-19 21:54 ` Werner Almesberger
2005-03-19 22:28   ` Grzegorz Kulewski

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=20050226213459.GA21137@apps.cwi.nl \
    --to=andries.brouwer@cwi.nl \
    --cc=akpm@osdl.org \
    --cc=bon@elektron.ikp.physik.tu-darmstadt.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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