All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH 8/3] xfs: factor log item initialisation
Date: Thu, 16 May 2019 15:41:41 -0500	[thread overview]
Message-ID: <31991357-c836-6a50-4203-dae25c051def@redhat.com> (raw)
In-Reply-To: <8fc2eb9e-78c4-df39-3b8f-9109720ab680@redhat.com>

Each log item type does manual initialisation of the log item.
Delayed logging introduces new fields that need initialisation, so
factor all the open coded initialisation into a common function
first.

Source kernel commit: 43f5efc5b59db1b66e39fe9fdfc4ba6a27152afa

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 libxfs/libxfs_priv.h |  1 +
 libxfs/logitem.c     |  8 ++------
 libxfs/util.c        | 12 ++++++++++++
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 157a99d6..7551ed65 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -564,6 +564,7 @@ int xfs_zero_extent(struct xfs_inode *ip, xfs_fsblock_t start_fsb,
 
 
 bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t);
+void xfs_log_item_init(struct xfs_mount *, struct xfs_log_item *, int);
 #define xfs_log_in_recovery(mp)	(false)
 
 /* xfs_icache.c */
diff --git a/libxfs/logitem.c b/libxfs/logitem.c
index e862ab4f..14c62f67 100644
--- a/libxfs/logitem.c
+++ b/libxfs/logitem.c
@@ -103,9 +103,7 @@ xfs_buf_item_init(
 	fprintf(stderr, "adding buf item %p for not-logged buffer %p\n",
 		bip, bp);
 #endif
-	bip->bli_item.li_type = XFS_LI_BUF;
-	bip->bli_item.li_mountp = mp;
-	INIT_LIST_HEAD(&bip->bli_item.li_trans);
+	xfs_log_item_init(mp, &bip->bli_item, XFS_LI_BUF);
 	bip->bli_buf = bp;
 	bip->__bli_format.blf_type = XFS_LI_BUF;
 	bip->__bli_format.blf_blkno = (int64_t)XFS_BUF_ADDR(bp);
@@ -149,8 +147,6 @@ xfs_inode_item_init(
 		ip->i_ino, iip);
 #endif
 
-	iip->ili_item.li_type = XFS_LI_INODE;
-	iip->ili_item.li_mountp = mp;
-	INIT_LIST_HEAD(&iip->ili_item.li_trans);
+	xfs_log_item_init(mp, &iip->ili_item, XFS_LI_INODE);
 	iip->ili_inode = ip;
 }
diff --git a/libxfs/util.c b/libxfs/util.c
index 4901123a..aff91080 100644
--- a/libxfs/util.c
+++ b/libxfs/util.c
@@ -691,6 +691,18 @@ xfs_log_check_lsn(
 	return true;
 }
 
+void
+xfs_log_item_init(
+	struct xfs_mount	*mp,
+	struct xfs_log_item	*item,
+	int			type)
+{
+	item->li_mountp = mp; 
+	item->li_type = type;
+        
+	INIT_LIST_HEAD(&item->li_trans);
+}   
+
 static struct xfs_buftarg *
 xfs_find_bdev_for_inode(
 	struct xfs_inode	*ip)
-- 
2.17.0

  parent reply	other threads:[~2019-05-16 20:41 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 17:42 [PATCH 0/3] xfsprogs: more libxfs/ spring cleaning Eric Sandeen
2019-05-16 17:43 ` [PATCH 1/3] libxfs: rename shared kernel functions from libxfs_ to xfs_ Eric Sandeen
2019-05-17 20:49   ` Allison Collins
2019-05-17 21:00     ` Eric Sandeen
2019-05-16 17:45 ` [PATCH 2/3] libxfs: remove libxfs API #defines for unexported xfs functions Eric Sandeen
2019-05-17 21:06   ` Allison Collins
2019-05-16 17:46 ` [PATCH 3/3] xfsprogs: remove unused flags arg from getsb interfaces Eric Sandeen
2019-05-17 21:09   ` Allison Collins
2019-05-16 20:38 ` [PATCH 4/3] libxfs: Remove XACT_DEBUG #ifdefs Eric Sandeen
2019-05-17 21:36   ` Allison Collins
2019-05-20 22:53     ` Darrick J. Wong
2019-05-16 20:39 ` [PATCH 5/3] libxfs: rename bli_format to avoid confusion with bli_formats Eric Sandeen
2019-05-17 22:29   ` Allison Collins
2019-05-17 23:01     ` Eric Sandeen
2019-05-17 23:41       ` Allison Collins
2019-05-16 20:39 ` [PATCH 6/3] libxfs: factor common xfs_trans_bjoin code Eric Sandeen
2019-05-17 22:56   ` Allison Collins
2019-05-20 22:56   ` Darrick J. Wong
2019-05-20 22:58     ` Eric Sandeen
2019-05-20 23:12       ` Darrick J. Wong
2019-05-16 20:40 ` [PATCH 7/3] libxfs: fix argument to xfs_trans_add_item Eric Sandeen
2019-05-17 22:57   ` Allison Collins
2019-05-16 20:41 ` Eric Sandeen [this message]
2019-05-17 23:50   ` [PATCH 8/3] xfs: factor log item initialisation Allison Collins
2019-05-17 19:46 ` [PATCH 9/3] libxfs: create current_time helper and sync xfs_trans_ichgtime Eric Sandeen
2019-05-17 19:50 ` [PATCH 10/3] libxfs: share kernel's xfs_trans_inode.c Eric Sandeen
2019-05-20 23:00   ` Darrick J. Wong
2019-05-20 23:03 ` [PATCH 0/3] xfsprogs: more libxfs/ spring cleaning Darrick J. Wong
2019-05-20 23:10   ` Darrick J. Wong

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=31991357-c836-6a50-4203-dae25c051def@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /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.