From: Bob Peterson Date: Fri, 13 Jan 2017 10:06:06 -0500 (EST) Subject: [Cluster-devel] [PATCH 2/5] gfs2_edit savemeta: Don't read rgrp blocks twice In-Reply-To: <0fa5d294-6a0d-05c5-b5b1-6f6c20db46c1@redhat.com> References: <20170110143446.14419-1-anprice@redhat.com> <20170110143446.14419-3-anprice@redhat.com> <135078219.10029221.1484236155175.JavaMail.zimbra@redhat.com> <0fa5d294-6a0d-05c5-b5b1-6f6c20db46c1@redhat.com> Message-ID: <1634912494.10291404.1484319966608.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ----- Original Message ----- | Hi Bob, | | On 12/01/17 15:49, Bob Peterson wrote: | > ----- Original Message ----- | > | When savemeta iterates over the rgrps and saves the rgrp header blocks | > | it calls save_block which does a bread() for each block despite them | > | already being read in earlier. Instead, call save_bh() on the existing | > | rgrp buffers. This isn't likely to give a significant performance | > | improvement as the duplicate reads would be cache hits but it should | > | have a noticeable effect on very large file systems. | > | | > | Signed-off-by: Andrew Price | > | --- | > | > Hi, | > | > IIRC, the reason I coded it the way I did was with the notion that | > customers often save their metadata (and send it in) because it's corrupt. | > If there's an rgrp block, such as a bitmap, which is corrupt, I wanted | > savemeta to save the rgrp blocks regardless of the corruption so we could | > see the trash with which it was overwritten. Function gfs2_rgrp_read | > checks for corruption and if's not a bitmap, it frees ALL bi_bh buffers; | > even the non-corrupt ones. | > | > So we need to ensure that corrupt / blasted rgrps and bitmaps also get | > saved, provided their rindex is healthy (which it also might not be). | > | > Perhaps my fears are unfounded? You could verify this by doing: | > (1) mkfs.gfs2 | > (2) blast / zero out a random rgrp or rindex | > (3) gfs2_edit savemeta | > (4) gfs2_edit printsavedmeta | > (5) ensure the output contains the blasted block | | You're right to bring it up but it seems that it has been broken since | before this patch set. There's a metadata header check in | gfs2_rgrp_read() that stops the zeroed rgrp headers from being saved and | also save_block() calls get_gfs_struct_info() which checks for the magic | number. | | The patch below fixes those two snags by special casing rgrp header | blocks but it's messy. I think I can do better by avoiding | gfs2_rgrp_read() altogether and just reading the rgrp headers without | the metadata checks, so I'll try again. | | Andy (snip) Hi Andy, ACK This new patch looks good. Thanks for cleaning this up. Regards, Bob Peterson Red Hat File Systems