All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 11/11] gfs2: Skip gfs2_metatype_check for	cached buffers
Date: Mon, 14 Jan 2019 11:40:02 -0500 (EST)	[thread overview]
Message-ID: <805431969.64220065.1547484002591.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20190111160548.9423-12-agruenba@redhat.com>

----- 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 <agruenba@redhat.com>
> ---
(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



      reply	other threads:[~2019-01-14 16:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 16:05 [Cluster-devel] [PATCH 00/11] Read bitmap buffers on demand Andreas Gruenbacher
2019-01-11 16:05 ` [Cluster-devel] [PATCH 01/11] gfs2: Fix setting GBF_FULL in gfs2_rbm_find Andreas Gruenbacher
2019-01-11 16:05 ` [Cluster-devel] [PATCH 02/11] gfs2: Rename minext => minlen Andreas Gruenbacher
2019-01-11 16:05 ` [Cluster-devel] [PATCH 03/11] gfs2: Don't use struct gfs2_rbm in struct gfs2_extent Andreas Gruenbacher
2019-01-11 16:05 ` [Cluster-devel] [PATCH 04/11] gfs2: Minor gfs2_free_extlen cleanup Andreas Gruenbacher
2019-01-11 16:05 ` [Cluster-devel] [PATCH 05/11] gfs2: Only use struct gfs2_rbm for bitmap manipulations Andreas Gruenbacher
2019-01-11 16:05 ` [Cluster-devel] [PATCH 06/11] gfs2: Minor gfs2_adjust_reservation and gfs2_alloc_extent cleanups Andreas Gruenbacher
2019-01-11 16:05 ` [Cluster-devel] [PATCH 07/11] gfs2: Minor gfs2_rgrp_send_discards cleanup Andreas Gruenbacher
2019-01-11 16:05 ` [Cluster-devel] [PATCH 08/11] gfs2: Add buffer head to struct gfs2_rgrpd Andreas Gruenbacher
2019-01-11 16:05 ` [Cluster-devel] [PATCH 09/11] gfs2: Read bitmap buffers on demand Andreas Gruenbacher
2019-01-14 17:12   ` Bob Peterson
2019-01-14 18:41     ` Andreas Gruenbacher
2019-01-14 22:08       ` Andreas Gruenbacher
2019-01-11 16:05 ` [Cluster-devel] [PATCH 10/11] gfs2: Clean up assertion, consistency check, and error reporting functions Andreas Gruenbacher
2019-01-14 16:27   ` Bob Peterson
2019-01-11 16:05 ` [Cluster-devel] [PATCH 11/11] gfs2: Skip gfs2_metatype_check for cached buffers Andreas Gruenbacher
2019-01-14 16:40   ` Bob Peterson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=805431969.64220065.1547484002591.JavaMail.zimbra@redhat.com \
    --to=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.