From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Price Date: Thu, 05 Jun 2014 11:39:25 +0100 Subject: [Cluster-devel] [PATCH 2/3] gfs2_edit: Ensure all leaf blocks in per_node are saved In-Reply-To: <53903AEF.9020605@redhat.com> References: <1401931686-6697-1-git-send-email-anprice@redhat.com> <1401931686-6697-2-git-send-email-anprice@redhat.com> <53903AEF.9020605@redhat.com> Message-ID: <539048DD.9030507@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 05/06/14 10:39, Steven Whitehouse wrote: > Hi, > > On 05/06/14 02:28, Andrew Price wrote: >> block_is_in_per_node() only checks the first leaf block when the >> per_node directory has been split (when the block size is small and/or >> the number of journals is large). This caused savemeta to treat the >> files in per_node as user data and so didn't save their metadata. Add an >> outer loop to iterate over the indirect blocks. > Why does it matter whether the block in the per_node subdir or not? Are > we doing something special compared with other directories? Yes, sorry I didn't make it very clear in the commit log: gfs2_edit savemeta saves less metadata when a block isn't part of a set of "system" structures to avoid saving user data while gathering enough metadata to aid debugging. static int block_is_systemfile(void) { return block_is_jindex() || block_is_inum_file() || block_is_statfs_file() || block_is_quota_file() || block_is_rindex() || block_is_a_journal() || block_is_per_node() || block_is_in_per_node(); } save_inode_data() uses this function to decide the height at which to stop saving metadata. https://git.fedorahosted.org/cgit/gfs2-utils.git/tree/gfs2/edit/savemeta.c#n499 Andy > > Steve. > >> Signed-off-by: Andrew Price >> --- >> gfs2/edit/savemeta.c | 11 +++++++---- >> 1 file changed, 7 insertions(+), 4 deletions(-) >> >> diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c >> index a43045f..360b144 100644 >> --- a/gfs2/edit/savemeta.c >> +++ b/gfs2/edit/savemeta.c >> @@ -75,7 +75,7 @@ static int block_is_a_journal(void) >> static int block_is_in_per_node(void) >> { >> - int d; >> + int i; >> struct gfs2_inode *per_node_di; >> if (sbd.gfs1) >> @@ -90,9 +90,12 @@ static int block_is_in_per_node(void) >> do_dinode_extended(&per_node_di->i_di, per_node_di->i_bh); >> inode_put(&per_node_di); >> - for (d = 0; d < indirect->ii[0].dirents; d++) { >> - if (block == indirect->ii[0].dirent[d].block) >> - return TRUE; >> + for (i = 0; i < indirect_blocks; i++) { >> + int d; >> + for (d = 0; d < indirect->ii[i].dirents; d++) { >> + if (block == indirect->ii[i].dirent[d].block) >> + return TRUE; >> + } >> } >> return FALSE; >> } >