Skip to contentSkip to conversation

grub2 ChangeLog config.h.in fs/ext2.c

DISCUSSION Hollis Blanchard 2 participants 2 messages Mar 18, 2007 – Mar 19, 2007 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 13 lines · Yoshinori K. Okuji

Log message:
2007-03-18 Yoshinori K. Okuji <[email protected]>

* fs/ext2.c (grub_ext2_read_inode): Use the inode size in a superblock instead of the structure size to compute an offset. This fixes the problem that GRUB could not read a filesystem when inode size is different from 128-byte.

diff -u -r1.13 -r1.14

fs/ext2.c line 299

Quoted 7 lines
fs/ext2.c +1 -1
@@ -294,7 +294,7 @@
   if (grub_disk_read (data->disk, 
 		      ((grub_le_to_cpu32 (blkgrp.inode_table_id) + blkno)
 		       << LOG2_EXT2_BLOCK_SIZE (data)),
-		      sizeof (struct grub_ext2_inode) * blkoff,
+		      grub_le_to_cpu16 (sblock->inode_size) * blkoff,
 		      sizeof (struct grub_ext2_inode), (char *) inode))
     return grub_errno;

If the inode size is not 128 bytes, why do we still read `sizeof (struct grub_ext2_inode)' bytes from disk? What is the layout of a non-128-byte inode?

-Hollis

#2 lore raw
Quoted 2 lines · Hollis Blanchard

If the inode size is not 128 bytes, why do we still read `sizeof (struct grub_ext2_inode)' bytes from disk?

Because we don't need more than that.

Quoted 2 lines

What is the layout of a non-128-byte
inode?

There is extra space right after the traditional inode structure. Currently, it can be used only for xattr. If you are interested in the details, look at fs/ext3/inode.c in Linux.

Okuji