diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2004-08-23 21:41:24 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-23 21:41:24 -0700 |
commit | d60e29c32ed87d131b7a62ffe309e49afc7e59ad (patch) | |
tree | b68f24ddb38e185c621817160dd426639c01e693 /init | |
parent | df7d32af22c3ab593727d521021096f677e767e2 (diff) | |
download | history-d60e29c32ed87d131b7a62ffe309e49afc7e59ad.tar.gz |
[PATCH] fix 4K ext2fs support in 2.6 initrd's
The ramdisk_blocksize option has been broken for quite a while in 2.6.
Making an initrd with a 4K ext2 filesystem impossible to use.
After digging into this, the problem turned out to that rd.c was not
setting the hard sector size. There were a few secondary problems like
i_blkbits was not being set, and the number KiB in uncompressed ext2 images
was not taking into account the block size.
I have also corrected the surrounding comments as they were not just
incorrect but misleading.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'init')
-rw-r--r-- | init/do_mounts_rd.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index 6f8900ee19b388..4abfc1c0109eb6 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c @@ -122,7 +122,8 @@ identify_ramdisk_image(int fd, int start_block) printk(KERN_NOTICE "RAMDISK: ext2 filesystem found at block %d\n", start_block); - nblocks = le32_to_cpu(ext2sb->s_blocks_count); + nblocks = le32_to_cpu(ext2sb->s_blocks_count) << + le32_to_cpu(ext2sb->s_log_block_size); goto done; } @@ -173,10 +174,15 @@ int __init rd_load_image(char *from) } /* - * NOTE NOTE: nblocks suppose that the blocksize is BLOCK_SIZE, so - * rd_load_image will work only with filesystem BLOCK_SIZE wide! - * So make sure to use 1k blocksize while generating ext2fs - * ramdisk-images. + * NOTE NOTE: nblocks is not actually blocks but + * the number of kibibytes of data to load into a ramdisk. + * So any ramdisk block size that is a multiple of 1KiB should + * work when the appropriate ramdisk_blocksize is specified + * on the command line. + * + * The default ramdisk_blocksize is 1KiB and it is generally + * silly to use anything else, so make sure to use 1KiB + * blocksize while generating ext2fs ramdisk-images. */ if (sys_ioctl(out_fd, BLKGETSIZE, (unsigned long)&rd_blocks) < 0) rd_blocks = 0; @@ -184,7 +190,7 @@ int __init rd_load_image(char *from) rd_blocks >>= 1; if (nblocks > rd_blocks) { - printk("RAMDISK: image too big! (%d/%ld blocks)\n", + printk("RAMDISK: image too big! (%dKiB/%ldKiB)\n", nblocks, rd_blocks); goto done; } @@ -211,7 +217,7 @@ int __init rd_load_image(char *from) goto done; } - printk(KERN_NOTICE "RAMDISK: Loading %d blocks [%ld disk%s] into ram disk... ", + printk(KERN_NOTICE "RAMDISK: Loading %dKiB [%ld disk%s] into ram disk... ", nblocks, ((nblocks-1)/devblocks)+1, nblocks>devblocks ? "s" : ""); for (i = 0, disk = 1; i < nblocks; i++) { if (i && (i % devblocks == 0)) { |