From: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] partitions and unusual block sizes
Date: Sun, 18 Jul 2004 01:02:04 +0200 [thread overview]
Message-ID: <20040717230204.GW27770@os.inf.tu-dresden.de> (raw)
Hi,
I've been working on a block driver with a block size != 512 bytes, by
using blk_queue_hardsect_size(q, 1024). The msdos partitioning code
modifies the sectors according to the block size of the underlying
device. As all blocks are 512 bytes internally, modifying the
partitioning data looks wrong. The following patch fixes this for me.
Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
diff -urN linux-2.6.8-rc1/fs/partitions/msdos.c linux-2.6.8-rc1.m/fs/partitions/msdos.c
--- linux-2.6.8-rc1/fs/partitions/msdos.c 2004-07-18 00:24:17.000000000 +0200
+++ linux-2.6.8-rc1.m/fs/partitions/msdos.c 2004-07-18 00:29:37.000000000 +0200
@@ -78,7 +78,6 @@
Sector sect;
unsigned char *data;
u32 this_sector, this_size;
- int sector_size = bdev_hardsect_size(bdev) / 512;
int loopct = 0; /* number of links followed
without finding a data partition */
int i;
@@ -119,8 +118,8 @@
/* Check the 3rd and 4th entries -
these sometimes contain random garbage */
- offs = START_SECT(p)*sector_size;
- size = NR_SECTS(p)*sector_size;
+ offs = START_SECT(p);
+ size = NR_SECTS(p);
next = this_sector + offs;
if (i >= 2) {
if (offs + size > this_size)
@@ -152,8 +151,8 @@
if (i == 4)
goto done; /* nothing left to do */
- this_sector = first_sector + START_SECT(p) * sector_size;
- this_size = NR_SECTS(p) * sector_size;
+ this_sector = first_sector + START_SECT(p);
+ this_size = NR_SECTS(p);
put_dev_sector(sect);
}
done:
@@ -376,7 +375,6 @@
int msdos_partition(struct parsed_partitions *state, struct block_device *bdev)
{
- int sector_size = bdev_hardsect_size(bdev) / 512;
Sector sect;
unsigned char *data;
struct partition *p;
@@ -424,8 +422,8 @@
state->next = 5;
for (slot = 1 ; slot <= 4 ; slot++, p++) {
- u32 start = START_SECT(p)*sector_size;
- u32 size = NR_SECTS(p)*sector_size;
+ u32 start = START_SECT(p);
+ u32 size = NR_SECTS(p);
if (!size)
continue;
if (is_extended_partition(p)) {
@@ -462,8 +460,8 @@
if (!subtypes[n].parse)
continue;
- subtypes[n].parse(state, bdev, START_SECT(p)*sector_size,
- NR_SECTS(p)*sector_size, slot);
+ subtypes[n].parse(state, bdev,
+ START_SECT(p), NR_SECTS(p), slot);
}
put_dev_sector(sect);
return 1;
Adam
--
Adam adam@os.inf.tu-dresden.de
Lackorzynski http://os.inf.tu-dresden.de/~adam/
reply other threads:[~2004-07-17 23:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20040717230204.GW27770@os.inf.tu-dresden.de \
--to=adam@os.inf.tu-dresden.de \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome