All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-xfs@vger.kernel.org
Cc: Eric Sandeen <sandeen@redhat.com>
Subject: [PATCH 3/6] xfs: remove XFS_BUF_TO_AGFL
Date: Thu, 30 Jan 2020 14:33:40 +0100	[thread overview]
Message-ID: <20200130133343.225818-4-hch@lst.de> (raw)
In-Reply-To: <20200130133343.225818-1-hch@lst.de>

Just dereference bp->b_addr directly and make the code a little
simpler and more clear.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/libxfs/xfs_ag.c         | 2 +-
 fs/xfs/libxfs/xfs_alloc.c      | 7 ++++---
 fs/xfs/libxfs/xfs_format.h     | 1 -
 fs/xfs/scrub/agheader_repair.c | 3 +--
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c
index 831bdd035900..32ceba66456f 100644
--- a/fs/xfs/libxfs/xfs_ag.c
+++ b/fs/xfs/libxfs/xfs_ag.c
@@ -291,7 +291,7 @@ xfs_agflblock_init(
 	struct xfs_buf		*bp,
 	struct aghdr_init_data	*id)
 {
-	struct xfs_agfl		*agfl = XFS_BUF_TO_AGFL(bp);
+	struct xfs_agfl		*agfl = bp->b_addr;
 	__be32			*agfl_bno;
 	int			bucket;
 
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index b95a688e9f87..2006a49ea95f 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -588,7 +588,7 @@ xfs_agfl_verify(
 	struct xfs_buf	*bp)
 {
 	struct xfs_mount *mp = bp->b_mount;
-	struct xfs_agfl	*agfl = XFS_BUF_TO_AGFL(bp);
+	struct xfs_agfl	*agfl = bp->b_addr;
 	__be32		*agfl_bno = xfs_buf_to_agfl_bno(bp);
 	int		i;
 
@@ -620,7 +620,7 @@ xfs_agfl_verify(
 			return __this_address;
 	}
 
-	if (!xfs_log_check_lsn(mp, be64_to_cpu(XFS_BUF_TO_AGFL(bp)->agfl_lsn)))
+	if (!xfs_log_check_lsn(mp, be64_to_cpu(agfl->agfl_lsn)))
 		return __this_address;
 	return NULL;
 }
@@ -656,6 +656,7 @@ xfs_agfl_write_verify(
 {
 	struct xfs_mount	*mp = bp->b_mount;
 	struct xfs_buf_log_item	*bip = bp->b_log_item;
+	struct xfs_agfl		*agfl = bp->b_addr;
 	xfs_failaddr_t		fa;
 
 	/* no verification of non-crc AGFLs */
@@ -669,7 +670,7 @@ xfs_agfl_write_verify(
 	}
 
 	if (bip)
-		XFS_BUF_TO_AGFL(bp)->agfl_lsn = cpu_to_be64(bip->bli_item.li_lsn);
+		agfl->agfl_lsn = cpu_to_be64(bip->bli_item.li_lsn);
 
 	xfs_buf_update_cksum(bp, XFS_AGFL_CRC_OFF);
 }
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index 11a450e00231..fe685ad91e0f 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -783,7 +783,6 @@ typedef struct xfs_agi {
  */
 #define XFS_AGFL_DADDR(mp)	((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
 #define	XFS_AGFL_BLOCK(mp)	XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
-#define	XFS_BUF_TO_AGFL(bp)	((struct xfs_agfl *)((bp)->b_addr))
 
 struct xfs_agfl {
 	__be32		agfl_magicnum;
diff --git a/fs/xfs/scrub/agheader_repair.c b/fs/xfs/scrub/agheader_repair.c
index 68ee1ce1ae36..6da2e87d19a8 100644
--- a/fs/xfs/scrub/agheader_repair.c
+++ b/fs/xfs/scrub/agheader_repair.c
@@ -580,7 +580,7 @@ xrep_agfl_init_header(
 	__be32			*agfl_bno;
 	struct xfs_bitmap_range	*br;
 	struct xfs_bitmap_range	*n;
-	struct xfs_agfl		*agfl;
+	struct xfs_agfl		*agfl = agfl_bp->b_addr;
 	xfs_agblock_t		agbno;
 	unsigned int		fl_off;
 
@@ -590,7 +590,6 @@ xrep_agfl_init_header(
 	 * Start rewriting the header by setting the bno[] array to
 	 * NULLAGBLOCK, then setting AGFL header fields.
 	 */
-	agfl = XFS_BUF_TO_AGFL(agfl_bp);
 	memset(agfl, 0xFF, BBTOB(agfl_bp->b_length));
 	agfl->agfl_magicnum = cpu_to_be32(XFS_AGFL_MAGIC);
 	agfl->agfl_seqno = cpu_to_be32(sc->sa.agno);
-- 
2.24.1


  parent reply	other threads:[~2020-01-30 13:33 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 13:33 agfl and related cleanups Christoph Hellwig
2020-01-30 13:33 ` [PATCH 1/6] xfs: remove the agfl_bno member from struct xfs_agfl Christoph Hellwig
2020-02-03 17:46   ` Eric Sandeen
2020-02-03 17:47     ` Christoph Hellwig
2020-02-24 22:02   ` Christoph Hellwig
2020-02-24 22:19     ` Darrick J. Wong
2020-02-24 22:21       ` Christoph Hellwig
2020-02-24 22:27         ` Darrick J. Wong
2020-02-24 22:46           ` Christoph Hellwig
2020-02-24 22:27     ` Eric Sandeen
2020-02-24 22:30       ` Christoph Hellwig
2020-02-24 22:35         ` Eric Sandeen
2020-02-24 22:46           ` Christoph Hellwig
2020-02-24 22:50             ` Eric Sandeen
2020-02-25 17:24               ` Christoph Hellwig
2020-01-30 13:33 ` [PATCH 2/6] xfs: remove the xfs_agfl_t typedef Christoph Hellwig
2020-02-03 17:46   ` Eric Sandeen
2020-01-30 13:33 ` Christoph Hellwig [this message]
2020-02-03 18:28   ` [PATCH 3/6] xfs: remove XFS_BUF_TO_AGFL Eric Sandeen
2020-01-30 13:33 ` [PATCH 4/6] xfs: remove XFS_BUF_TO_AGI Christoph Hellwig
2020-02-03 18:30   ` Eric Sandeen
2020-01-30 13:33 ` [PATCH 5/6] xfs: remove XFS_BUF_TO_AGF Christoph Hellwig
2020-02-03 18:35   ` Eric Sandeen
2020-02-03 18:54   ` Eric Sandeen
2020-01-30 13:33 ` [PATCH 6/6] xfs: remove XFS_BUF_TO_SBP Christoph Hellwig
2020-02-03 18:38   ` Eric Sandeen
2020-02-04  6:15     ` Christoph Hellwig
2020-02-03  9:12 ` agfl and related cleanups Chandan Rajendra
2020-03-06 14:52 agfl and related cleanups v2 Christoph Hellwig
2020-03-06 14:52 ` [PATCH 3/6] xfs: remove XFS_BUF_TO_AGFL Christoph Hellwig
2020-03-10 11:23   ` Brian Foster

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=20200130133343.225818-4-hch@lst.de \
    --to=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@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.