From: Christoph Hellwig <hch@lst.de>
To: Carlos Maiolino <cem@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 08/23] libxlog: don't require a libxfs_xinit structure for xlog_init
Date: Mon, 11 Dec 2023 17:37:27 +0100 [thread overview]
Message-ID: <20231211163742.837427-9-hch@lst.de> (raw)
In-Reply-To: <20231211163742.837427-1-hch@lst.de>
xlog_init currently requires a libxfs_args structure to be passed in,
and then clobbers various log-related arguments to it. There is no
good reason for that as all the required information can be calculated
without it.
Remove the x argument to xlog_init and xlog_is_dirty and the now unused
logBBstart member in struct libxfs_xinit.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
copy/xfs_copy.c | 2 +-
db/metadump.c | 4 ++--
db/sb.c | 2 +-
include/libxfs.h | 1 -
include/libxlog.h | 4 ++--
libxfs/init.c | 2 +-
libxlog/util.c | 25 ++++++++++---------------
logprint/logprint.c | 2 +-
repair/phase2.c | 2 +-
9 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 4bd473a04..86187086d 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -784,7 +784,7 @@ main(int argc, char **argv)
*/
memset(&xlog, 0, sizeof(struct xlog));
mp->m_log = &xlog;
- c = xlog_is_dirty(mp, mp->m_log, &xargs);
+ c = xlog_is_dirty(mp, mp->m_log);
if (!duplicate) {
if (c == 1) {
do_log(_(
diff --git a/db/metadump.c b/db/metadump.c
index e57b024cd..bac35b9cc 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -2615,7 +2615,7 @@ copy_log(void)
if (!metadump.obfuscate && !metadump.zero_stale_data)
goto done;
- dirty = xlog_is_dirty(mp, &log, &x);
+ dirty = xlog_is_dirty(mp, &log);
switch (dirty) {
case 0:
@@ -2945,7 +2945,7 @@ metadump_f(
if (iocur_top->data) { /* best effort */
struct xlog log;
- if (xlog_is_dirty(mp, &log, &x))
+ if (xlog_is_dirty(mp, &log))
metadump.dirty_log = true;
}
pop_cur();
diff --git a/db/sb.c b/db/sb.c
index a3a4a758f..2f046c6aa 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -235,7 +235,7 @@ sb_logcheck(void)
libxfs_buftarg_init(mp, x.ddev, x.logdev, x.rtdev);
- dirty = xlog_is_dirty(mp, mp->m_log, &x);
+ dirty = xlog_is_dirty(mp, mp->m_log);
if (dirty == -1) {
dbprintf(_("ERROR: cannot find log head/tail, run xfs_repair\n"));
return 0;
diff --git a/include/libxfs.h b/include/libxfs.h
index b35dc2184..270efb2c1 100644
--- a/include/libxfs.h
+++ b/include/libxfs.h
@@ -115,7 +115,6 @@ typedef struct libxfs_xinit {
long long logBBsize; /* size of log subvolume (BBs) */
/* (blocks allocated for use as
* log is stored in mount structure) */
- long long logBBstart; /* start block of log subvolume (BBs) */
long long rtsize; /* size of realtime subvolume (BBs) */
int dbsize; /* data subvolume device blksize */
int lbsize; /* log subvolume device blksize */
diff --git a/include/libxlog.h b/include/libxlog.h
index 657acfe42..57f39e4e8 100644
--- a/include/libxlog.h
+++ b/include/libxlog.h
@@ -71,8 +71,8 @@ extern int print_record_header;
/* libxfs parameters */
extern libxfs_init_t x;
-void xlog_init(struct xfs_mount *mp, struct xlog *log, libxfs_init_t *x);
-int xlog_is_dirty(struct xfs_mount *mp, struct xlog *log, libxfs_init_t *x);
+void xlog_init(struct xfs_mount *mp, struct xlog *log);
+int xlog_is_dirty(struct xfs_mount *mp, struct xlog *log);
extern struct xfs_buf *xlog_get_bp(struct xlog *, int);
extern int xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks,
diff --git a/libxfs/init.c b/libxfs/init.c
index 894d84057..6482ba52b 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -304,7 +304,7 @@ libxfs_init(libxfs_init_t *a)
a->dfd = a->logfd = a->rtfd = -1;
a->ddev = a->logdev = a->rtdev = 0;
a->dsize = a->lbsize = a->rtbsize = 0;
- a->dbsize = a->logBBsize = a->logBBstart = a->rtsize = 0;
+ a->dbsize = a->logBBsize = a->rtsize = 0;
flags = (a->isreadonly | a->isdirect);
diff --git a/libxlog/util.c b/libxlog/util.c
index bc4db478e..d1377c2e2 100644
--- a/libxlog/util.c
+++ b/libxlog/util.c
@@ -15,22 +15,18 @@ libxfs_init_t x;
void
xlog_init(
struct xfs_mount *mp,
- struct xlog *log,
- libxfs_init_t *x)
+ struct xlog *log)
{
- memset(log, 0, sizeof(*log));
+ unsigned int log_sect_size = BBSIZE;
- /* We (re-)init members of libxfs_init_t here? really? */
- x->logBBsize = XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
- x->logBBstart = XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart);
- x->lbsize = BBSIZE;
- if (xfs_has_sector(mp))
- x->lbsize <<= (mp->m_sb.sb_logsectlog - BBSHIFT);
+ memset(log, 0, sizeof(*log));
log->l_dev = mp->m_logdev_targp;
- log->l_logBBsize = x->logBBsize;
- log->l_logBBstart = x->logBBstart;
- log->l_sectBBsize = BTOBB(x->lbsize);
+ log->l_logBBsize = XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
+ log->l_logBBstart = XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart);
+ if (xfs_has_sector(mp))
+ log_sect_size <<= (mp->m_sb.sb_logsectlog - BBSHIFT);
+ log->l_sectBBsize = BTOBB(log_sect_size);
log->l_mp = mp;
if (xfs_has_sector(mp)) {
log->l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT;
@@ -50,13 +46,12 @@ xlog_init(
int
xlog_is_dirty(
struct xfs_mount *mp,
- struct xlog *log,
- libxfs_init_t *x)
+ struct xlog *log)
{
int error;
xfs_daddr_t head_blk, tail_blk;
- xlog_init(mp, log, x);
+ xlog_init(mp, log);
error = xlog_find_tail(log, &head_blk, &tail_blk);
if (error) {
diff --git a/logprint/logprint.c b/logprint/logprint.c
index c78aeb2f8..bcdb6b359 100644
--- a/logprint/logprint.c
+++ b/logprint/logprint.c
@@ -85,7 +85,7 @@ logstat(
mp->m_features |= libxfs_sb_version_to_features(&mp->m_sb);
mp->m_blkbb_log = sb->sb_blocklog - BBSHIFT;
- xlog_init(mp, log, &x);
+ xlog_init(mp, log);
if (!x.logname && sb->sb_logstart == 0) {
fprintf(stderr, _(" external log device not specified\n\n"));
diff --git a/repair/phase2.c b/repair/phase2.c
index a9dd77be3..48263e161 100644
--- a/repair/phase2.c
+++ b/repair/phase2.c
@@ -30,7 +30,7 @@ zero_log(
xfs_daddr_t tail_blk;
struct xlog *log = mp->m_log;
- xlog_init(mp, mp->m_log, &x);
+ xlog_init(mp, mp->m_log);
/*
* Find the log head and tail and alert the user to the situation if the
--
2.39.2
next prev parent reply other threads:[~2023-12-11 16:38 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 16:37 improve libxfs device handling Christoph Hellwig
2023-12-11 16:37 ` [PATCH 01/23] libxfs: remove the unused icache_flags member from struct libxfs_xinit Christoph Hellwig
2023-12-18 8:37 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 02/23] libxfs: remove the dead {d,log,rt}path variables in libxfs_init Christoph Hellwig
2023-12-18 8:38 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 03/23] libxfs/frog: remove latform_find{raw,block}path Christoph Hellwig
2023-12-18 8:41 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 04/23] libxfs: remove the volname concept Christoph Hellwig
2023-12-18 8:47 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 05/23] xfs_logprint: move all code to set up the fake xlog into logstat() Christoph Hellwig
2023-12-18 8:51 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 06/23] libxlog: remove the verbose argument to xlog_is_dirty Christoph Hellwig
2023-12-18 8:56 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 07/23] libxlog: add a helper to initialize a xlog without clobbering the x structure Christoph Hellwig
2023-12-18 9:00 ` Carlos Maiolino
2023-12-11 16:37 ` Christoph Hellwig [this message]
2023-12-18 9:06 ` [PATCH 08/23] libxlog: don't require a libxfs_xinit structure for xlog_init Carlos Maiolino
2023-12-11 16:37 ` [PATCH 09/23] libxlog: remove the global libxfs_xinit x structure Christoph Hellwig
2023-12-18 9:18 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 10/23] libxfs: rename struct libxfs_xinit to libxfs_init Christoph Hellwig
2023-12-18 9:20 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 11/23] libxfs: pass a struct libxfs_init to libxfs_mount Christoph Hellwig
2023-12-18 9:21 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 12/23] libxfs: pass a struct libxfs_init to libxfs_alloc_buftarg Christoph Hellwig
2023-12-18 9:21 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 13/23] libxfs: merge the file vs device cases in libxfs_init Christoph Hellwig
2023-12-18 9:23 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 14/23] libxfs: making passing flags to libxfs_init less confusing Christoph Hellwig
2023-12-18 12:30 ` Carlos Maiolino
2023-12-18 14:36 ` Christoph Hellwig
2023-12-11 16:37 ` [PATCH 15/23] libxfs: remove the setblksize == 1 case in libxfs_device_open Christoph Hellwig
2023-12-18 12:44 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 16/23] libfrog: make platform_set_blocksize exit on fatal failure Christoph Hellwig
2023-12-18 12:48 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 17/23] libxfs: remove dead size < 0 checks in libxfs_init Christoph Hellwig
2023-12-18 12:51 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 18/23] libxfs: mark libxfs_device_{open,close} static Christoph Hellwig
2023-12-18 12:52 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 19/23] libxfs: return the opened fd from libxfs_device_open Christoph Hellwig
2023-12-18 12:53 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 20/23] libxfs: pass the device fd to discard_blocks Christoph Hellwig
2023-12-18 12:53 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 21/23] xfs_repair: remove various libxfs_device_to_fd calls Christoph Hellwig
2023-12-18 12:55 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 22/23] libxfs: stash away the device fd in struct xfs_buftarg Christoph Hellwig
2023-12-18 12:58 ` Carlos Maiolino
2023-12-11 16:37 ` [PATCH 23/23] libxfs: split out a libxfs_dev structure from struct libxfs_init Christoph Hellwig
2023-12-18 13:01 ` Carlos Maiolino
2023-12-12 1:52 ` improve libxfs device handling 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=20231211163742.837427-9-hch@lst.de \
--to=hch@lst.de \
--cc=cem@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox