* [PATCH] fix for initrd breakage in 2.5.13+
@ 2002-05-15 16:53 James Bottomley
2002-05-15 18:54 ` Russell King
0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2002-05-15 16:53 UTC (permalink / raw)
To: viro; +Cc: linux-kernel, James.Bottomley
[-- Attachment #1: Type: text/plain, Size: 809 bytes --]
Hi Al,
initrd was completely broken by your change set 1.447.69.4 ([PATCH] (4/6)
blksize_size[] removal). As part of this change, you completely divorced the
ramdisk from the setup parameter rd_blocksize, so it now has the default 512
byte block size and thus initrd fails to mount.
The fix corrects the ramdisk problem (by setting the queue hardsect size to
rd_blocksize), but there also has to be a fix in do_open because of the way
it's now working. The attached change is clearly incorrect, since it will
reset the ramdisk blocksize for every open, but it does allow initrd to work
again. I can't see how to fix it correctly---for no reason I can fathom,
bd_openers seems to be set for a ramdisk even on the first call into do_open.
Can you find a correct fix to do_open?
James Bottomley
[-- Attachment #2: viro_rd.diff --]
[-- Type: text/plain , Size: 1989 bytes --]
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.513 -> 1.515
# fs/block_dev.c 1.55 -> 1.56
# drivers/block/rd.c 1.35 -> 1.36
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/05/15 jejb@mulgrave.(none) 1.514
# [RD FIX]
#
# tie hardsect_size of the queue to rd_blocksize
# --------------------------------------------
# 02/05/15 jejb@mulgrave.(none) 1.515
# [RD FIX]
#
# Make do_open respect the rd_hardsect limit (this fix is incorrect
# since it will reset the size on every call into do_open). Need to
# find out why bd_openers is always set for rd.
# --------------------------------------------
#
diff -Nru a/drivers/block/rd.c b/drivers/block/rd.c
--- a/drivers/block/rd.c Wed May 15 12:40:29 2002
+++ b/drivers/block/rd.c Wed May 15 12:40:29 2002
@@ -424,6 +424,7 @@
}
blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR), &rd_make_request);
+ blk_queue_hardsect_size(BLK_DEFAULT_QUEUE(MAJOR_NR), rd_blocksize);
for (i = 0; i < NUM_RAMDISKS; i++) {
/* rd_size is given in kB */
diff -Nru a/fs/block_dev.c b/fs/block_dev.c
--- a/fs/block_dev.c Wed May 15 12:40:29 2002
+++ b/fs/block_dev.c Wed May 15 12:40:29 2002
@@ -606,7 +606,15 @@
goto out2;
}
bdev->bd_inode->i_size = blkdev_size(dev);
- if (!bdev->bd_openers) {
+ if (major(dev) == RAMDISK_MAJOR) {
+ /* always set the bd_block_size to the hardsect size */
+ unsigned bsize = bdev_hardsect_size(bdev);
+
+ bdev->bd_block_size = bsize;
+ bdev->bd_inode->i_blkbits = blksize_bits(bsize);
+ printk("SETTING %d:%d to hardsect %d\n",
+ major(dev), minor(dev), bsize);
+ } else if (!bdev->bd_openers) {
unsigned bsize = bdev_hardsect_size(bdev);
while (bsize < PAGE_CACHE_SIZE) {
if (bdev->bd_inode->i_size & bsize)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] fix for initrd breakage in 2.5.13+
2002-05-15 16:53 [PATCH] fix for initrd breakage in 2.5.13+ James Bottomley
@ 2002-05-15 18:54 ` Russell King
2002-05-15 19:35 ` James Bottomley
0 siblings, 1 reply; 3+ messages in thread
From: Russell King @ 2002-05-15 18:54 UTC (permalink / raw)
To: James Bottomley; +Cc: viro, linux-kernel
On Wed, May 15, 2002 at 12:53:31PM -0400, James Bottomley wrote:
> initrd was completely broken by your change set 1.447.69.4 ([PATCH] (4/6)
> blksize_size[] removal). As part of this change, you completely divorced the
> ramdisk from the setup parameter rd_blocksize, so it now has the default 512
> byte block size and thus initrd fails to mount.
Al has a far nicer patch for this, which works for me. Al?
Date: Mon, 6 May 2002 03:03:04 -0400 (EDT)
From: Alexander Viro <viro@math.psu.edu>
To: Linus Torvalds <torvalds@transmeta.com>
cc: linux-kernel@vger.kernel.org
Subject: [PATCH] rd.c blocksize fix
(fallout from blksize_size[] removal)
rd.c depends on exact value of blocksize being set from the very
beginning.
--- drivers/block/rd.c Fri May 3 03:26:05 2002
+++ /tmp/rd.c Mon May 6 03:00:00 2002
@@ -376,6 +376,7 @@
rd_bdev[unit] = bdget(kdev_t_to_nr(inode->i_rdev));
rd_bdev[unit]->bd_openers++;
rd_bdev[unit]->bd_inode->i_mapping->a_ops = &ramdisk_aops;
+ rd_bdev[unit]->bd_block_size = rd_blocksize;
}
return 0;
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] fix for initrd breakage in 2.5.13+
2002-05-15 18:54 ` Russell King
@ 2002-05-15 19:35 ` James Bottomley
0 siblings, 0 replies; 3+ messages in thread
From: James Bottomley @ 2002-05-15 19:35 UTC (permalink / raw)
To: Russell King; +Cc: James Bottomley, viro, linux-kernel, torvalds
[-- Attachment #1: Type: text/plain, Size: 653 bytes --]
rmk@arm.linux.org.uk said:
> --- drivers/block/rd.c Fri May 3 03:26:05 2002 +++ /tmp/rd.c Mon May
> 6 03:00:00 2002 @@ -376,6 +376,7 @@
> rd_bdev[unit] = bdget(kdev_t_to_nr(inode->i_rdev));
> rd_bdev[unit]->bd_openers++;
> rd_bdev[unit]->bd_inode->i_mapping->a_ops = &ramdisk_aops;
> + rd_bdev[unit]->bd_block_size = rd_blocksize;
> }
> return 0;
Ah Thanks!. Yes, that's the bit I was looking for. It also explains why
bd_openers was already incremented.
I think you still need to set the block queue hardsect size correctly as well,
so the final fix for the initrd problems should be the attached (which works
for me).
James
[-- Attachment #2: tmp.diff --]
[-- Type: text/plain , Size: 1137 bytes --]
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.513 -> 1.514
# drivers/block/rd.c 1.35 -> 1.36
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/05/15 jejb@mulgrave.(none) 1.514
# rd.c blocksize fix
# --------------------------------------------
#
diff -Nru a/drivers/block/rd.c b/drivers/block/rd.c
--- a/drivers/block/rd.c Wed May 15 15:21:55 2002
+++ b/drivers/block/rd.c Wed May 15 15:21:55 2002
@@ -376,6 +376,7 @@
rd_bdev[unit] = bdget(kdev_t_to_nr(inode->i_rdev));
rd_bdev[unit]->bd_openers++;
rd_bdev[unit]->bd_inode->i_mapping->a_ops = &ramdisk_aops;
+ rd_bdev[unit]->bd_block_size = rd_blocksize;
}
return 0;
@@ -424,6 +425,7 @@
}
blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR), &rd_make_request);
+ blk_queue_hardsect_size(BLK_DEFAULT_QUEUE(MAJOR_NR), rd_blocksize);
for (i = 0; i < NUM_RAMDISKS; i++) {
/* rd_size is given in kB */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-05-15 19:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-15 16:53 [PATCH] fix for initrd breakage in 2.5.13+ James Bottomley
2002-05-15 18:54 ` Russell King
2002-05-15 19:35 ` James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox