From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Mon, 14 Jan 2019 11:40:02 -0500 (EST) Subject: [Cluster-devel] [PATCH 11/11] gfs2: Skip gfs2_metatype_check for cached buffers In-Reply-To: <20190111160548.9423-12-agruenba@redhat.com> References: <20190111160548.9423-1-agruenba@redhat.com> <20190111160548.9423-12-agruenba@redhat.com> Message-ID: <805431969.64220065.1547484002591.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 ----- > When reading in buffers from disk, set a new BH_Verify buffer head flag. In > gfs2_metatype_check, skip the check if BH_Verify is cleared and clear the > flag > when checking. That way, we'll only check the metatype once when reading > buffers from disk, and not when the buffers were already in the page cache. > > While touching this code, convert two 'be32_to_cpu(magic) == GFS2_MAGIC' > checks > into 'magic == cpu_to_be32(GFS2_MAGIC)'. > > Signed-off-by: Andreas Gruenbacher > --- (snip) > static inline int gfs2_metatype_check(struct gfs2_sbd *sdp, > - struct buffer_head *bh, > - u16 type) > + struct buffer_head *bh, u16 type) > { > - struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data; > - u32 magic = be32_to_cpu(mh->mh_magic); > - u16 t = be32_to_cpu(mh->mh_type); > - if (unlikely(magic != GFS2_MAGIC)) > - return gfs2_meta_check_ii(sdp, bh, "magic number", (void *)_RET_IP_); > - if (unlikely(t != type)) > - return gfs2_metatype_check_ii(sdp, bh, type, t, > - (void *)_RET_IP_); > - return 0; > + if (!buffer_verify(bh)) > + return 0; > + return gfs2_metatype_check_ii(sdp, bh, type, (void *)_RET_IP_); May I suggest simplifying with: if (!test_clear_buffer_verify(bh)) return 0; Regards, Bob Peterson