From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K68YF-0006uZ-DL for mharc-grub-devel@gnu.org; Tue, 10 Jun 2008 14:26:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K68YE-0006u6-4d for grub-devel@gnu.org; Tue, 10 Jun 2008 14:26:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K68YC-0006sN-Iu for grub-devel@gnu.org; Tue, 10 Jun 2008 14:26:33 -0400 Received: from [199.232.76.173] (port=54835 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K68YC-0006sI-Fi for grub-devel@gnu.org; Tue, 10 Jun 2008 14:26:32 -0400 Received: from c60.cesmail.net ([216.154.195.49]:58817) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1K68YC-000466-2g for grub-devel@gnu.org; Tue, 10 Jun 2008 14:26:32 -0400 Received: from unknown (HELO relay.cesmail.net) ([192.168.1.81]) by c60.cesmail.net with ESMTP; 10 Jun 2008 14:26:31 -0400 Received: from [192.168.0.21] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by relay.cesmail.net (Postfix) with ESMTP id 1ED77619058 for ; Tue, 10 Jun 2008 14:26:31 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: References: <20080604233536.GA21711@thorin> <1212907952.31548.2.camel@rd> <1212910148.14564.4.camel@rd> <1212950530.8619.7.camel@dv> <1212975838.3863.35.camel@dv> Content-Type: text/plain Date: Tue, 10 Jun 2008 14:26:29 -0400 Message-Id: <1213122389.2348.21.camel@dv> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 (2.22.2-2.fc9) Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] biosdisk / open_device() messing up offsets X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jun 2008 18:26:34 -0000 On Tue, 2008-06-10 at 15:16 +0800, Bean wrote: > Hi, > > Ok, I fix some bugs, please see if the new patch works. It doesn't work. i sent the logs privately. I also checked the logs and it looks like that GRUB is reading the log properly. Then I guess we are not using the log correctly. I changed fs/ext2.c to see how the results would differ if grub_fshelp_map_block() is bypassed: diff --git a/fs/ext2.c b/fs/ext2.c index ffe9e33..7b4bfd6 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -257,12 +257,24 @@ inline static grub_err_t grub_ext2_blockgroup (struct grub_ext2_data *data, int group, struct grub_ext2_block_group *blkgrp) { - return grub_disk_read (data->disk, - (grub_fshelp_map_block (data->journal, - grub_le_to_cpu32 (data->sblock.first_data_block) + 1) - << LOG2_EXT2_BLOCK_SIZE (data)), + grub_err_t ret; + int block; + + block = grub_le_to_cpu32 (data->sblock.first_data_block) + 1; + ret = grub_disk_read (data->disk, + block << LOG2_EXT2_BLOCK_SIZE (data), + group * sizeof (struct grub_ext2_block_group), + sizeof (struct grub_ext2_block_group), (char *) blkgrp); + grub_printf("direct: ret = %d, block = %d, inode_table_id = %d\n", ret, block, + blkgrp->inode_table_id); + block = grub_fshelp_map_block(data->journal, block); + ret = grub_disk_read (data->disk, + block << LOG2_EXT2_BLOCK_SIZE (data), group * sizeof (struct grub_ext2_block_group), sizeof (struct grub_ext2_block_group), (char *) blkgrp); + grub_printf("journal: ret = %d, block = %d, inode_table_id = %d\n", ret, block, + blkgrp->inode_table_id); + return ret; } That's the output: direct: ret = 0, block = 1, inode_table_id = 1027 journal: ret = 0, block = 1, inode_table_id = 1027 direct: ret = 0, block = 1, inode_table_id = 1027 journal: ret = 0, block = 17707, inode_table_id = 1027 direct: ret = 0, block = 1, inode_table_id = 1027 journal: ret = 0, block = 1, inode_table_id = 1027 direct: ret = 0, block = 1, inode_table_id = 1027 journal: ret = 0, block = 17707, inode_table_id = 1027 direct: ret = 0, block = 1, inode_table_id = 15237122 journal: ret = 0, block = 17707, inode_table_id = 6895416 So, originally we didn't have the journal opened, so the mapping was trivial, then 1 became mapped to 17707. But at some point the data in that block became different from what it used to be and different in the journaled and non-journaled blocks. -- Regards, Pavel Roskin