public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Chandan Babu R <chandan.babu@oracle.com>
Cc: linux-xfs@vger.kernel.org, cem@kernel.org
Subject: Re: [PATCH V3 12/23] xfs_db: Add support to read from external log device
Date: Tue, 1 Aug 2023 16:49:59 -0700	[thread overview]
Message-ID: <20230801234959.GT11352@frogsfrogsfrogs> (raw)
In-Reply-To: <20230724043527.238600-13-chandan.babu@oracle.com>

On Mon, Jul 24, 2023 at 10:05:16AM +0530, Chandan Babu R wrote:
> This commit introduces a new function set_log_cur() allowing xfs_db to read
> from an external log device. This is required by a future commit which will
> add the ability to dump metadata from external log devices.
> 
> Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>

Looks good now,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  db/io.c | 56 +++++++++++++++++++++++++++++++++++++++++++-------------
>  db/io.h |  2 ++
>  2 files changed, 45 insertions(+), 13 deletions(-)
> 
> diff --git a/db/io.c b/db/io.c
> index 3d257236..5ccfe3b5 100644
> --- a/db/io.c
> +++ b/db/io.c
> @@ -508,18 +508,19 @@ write_cur(void)
>  
>  }
>  
> -void
> -set_cur(
> -	const typ_t	*type,
> -	xfs_daddr_t	blknum,
> -	int		len,
> -	int		ring_flag,
> -	bbmap_t		*bbmap)
> +static void
> +__set_cur(
> +	struct xfs_buftarg	*btargp,
> +	const typ_t		*type,
> +	xfs_daddr_t		 blknum,
> +	int			 len,
> +	int			 ring_flag,
> +	bbmap_t			*bbmap)
>  {
> -	struct xfs_buf	*bp;
> -	xfs_ino_t	dirino;
> -	xfs_ino_t	ino;
> -	uint16_t	mode;
> +	struct xfs_buf		*bp;
> +	xfs_ino_t		dirino;
> +	xfs_ino_t		ino;
> +	uint16_t		mode;
>  	const struct xfs_buf_ops *ops = type ? type->bops : NULL;
>  	int		error;
>  
> @@ -548,11 +549,11 @@ set_cur(
>  		if (!iocur_top->bbmap)
>  			return;
>  		memcpy(iocur_top->bbmap, bbmap, sizeof(struct bbmap));
> -		error = -libxfs_buf_read_map(mp->m_ddev_targp, bbmap->b,
> +		error = -libxfs_buf_read_map(btargp, bbmap->b,
>  				bbmap->nmaps, LIBXFS_READBUF_SALVAGE, &bp,
>  				ops);
>  	} else {
> -		error = -libxfs_buf_read(mp->m_ddev_targp, blknum, len,
> +		error = -libxfs_buf_read(btargp, blknum, len,
>  				LIBXFS_READBUF_SALVAGE, &bp, ops);
>  		iocur_top->bbmap = NULL;
>  	}
> @@ -589,6 +590,35 @@ set_cur(
>  		ring_add();
>  }
>  
> +void
> +set_cur(
> +	const typ_t	*type,
> +	xfs_daddr_t	blknum,
> +	int		len,
> +	int		ring_flag,
> +	bbmap_t		*bbmap)
> +{
> +	__set_cur(mp->m_ddev_targp, type, blknum, len, ring_flag, bbmap);
> +}
> +
> +void
> +set_log_cur(
> +	const typ_t	*type,
> +	xfs_daddr_t	blknum,
> +	int		len,
> +	int		ring_flag,
> +	bbmap_t		*bbmap)
> +{
> +	if (mp->m_logdev_targp->bt_bdev == mp->m_ddev_targp->bt_bdev) {
> +		fprintf(stderr, "no external log specified\n");
> +		exitcode = 1;
> +		return;
> +	}
> +
> +	__set_cur(mp->m_logdev_targp, type, blknum, len, ring_flag, bbmap);
> +}
> +
> +
>  void
>  set_iocur_type(
>  	const typ_t	*type)
> diff --git a/db/io.h b/db/io.h
> index c29a7488..bd86c31f 100644
> --- a/db/io.h
> +++ b/db/io.h
> @@ -49,6 +49,8 @@ extern void	push_cur_and_set_type(void);
>  extern void	write_cur(void);
>  extern void	set_cur(const struct typ *type, xfs_daddr_t blknum,
>  			int len, int ring_add, bbmap_t *bbmap);
> +extern void	set_log_cur(const struct typ *type, xfs_daddr_t blknum,
> +			int len, int ring_add, bbmap_t *bbmap);
>  extern void     ring_add(void);
>  extern void	set_iocur_type(const struct typ *type);
>  extern void	xfs_dummy_verify(struct xfs_buf *bp);
> -- 
> 2.39.1
> 

  reply	other threads:[~2023-08-01 23:50 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24  4:35 [PATCH V3 00/23] Metadump v2 Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 01/23] metadump: Use boolean values true/false instead of 1/0 Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 02/23] mdrestore: Fix logic used to check if target device is large enough Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 03/23] metadump: Declare boolean variables with bool type Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 04/23] metadump: Define and use struct metadump Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 05/23] metadump: Add initialization and release functions Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 06/23] metadump: Postpone invocation of init_metadump() Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 07/23] metadump: Introduce struct metadump_ops Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 08/23] metadump: Introduce metadump v1 operations Chandan Babu R
2023-08-01 23:44   ` Darrick J. Wong
2023-07-24  4:35 ` [PATCH V3 09/23] metadump: Rename XFS_MD_MAGIC to XFS_MD_MAGIC_V1 Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 10/23] metadump: Define metadump v2 ondisk format structures and macros Chandan Babu R
2023-08-01 23:47   ` Darrick J. Wong
2023-08-02 13:08     ` Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 11/23] metadump: Define metadump ops for v2 format Chandan Babu R
2023-08-01 23:49   ` Darrick J. Wong
2023-08-02 13:08     ` Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 12/23] xfs_db: Add support to read from external log device Chandan Babu R
2023-08-01 23:49   ` Darrick J. Wong [this message]
2023-07-24  4:35 ` [PATCH V3 13/23] metadump: Add support for passing version option Chandan Babu R
2023-08-01 23:51   ` Darrick J. Wong
2023-08-02 13:18     ` Chandan Babu R
2023-08-02 17:14       ` Darrick J. Wong
2023-07-24  4:35 ` [PATCH V3 14/23] mdrestore: Declare boolean variables with bool type Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 15/23] mdrestore: Define and use struct mdrestore Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 16/23] mdrestore: Detect metadump v1 magic before reading the header Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 17/23] mdrestore: Add open_device(), read_header() and show_info() functions Chandan Babu R
2023-08-01 23:54   ` Darrick J. Wong
2023-07-24  4:35 ` [PATCH V3 18/23] mdrestore: Introduce struct mdrestore_ops Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 19/23] mdrestore: Replace metadump header pointer argument with a union pointer Chandan Babu R
2023-08-02  0:01   ` Darrick J. Wong
2023-08-02 13:17     ` Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 20/23] mdrestore: Introduce mdrestore v1 operations Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 21/23] mdrestore: Extract target device size verification into a function Chandan Babu R
2023-07-24  4:35 ` [PATCH V3 22/23] mdrestore: Define mdrestore ops for v2 format Chandan Babu R
2023-08-02 17:16   ` Darrick J. Wong
2023-07-24  4:35 ` [PATCH V3 23/23] mdrestore: Add support for passing log device as an argument Chandan Babu R
2023-10-31 16:46 ` [PATCH V3 00/23] Metadump v2 Darrick J. Wong
2023-11-01 14:58   ` Carlos Maiolino
2023-11-01 18:02     ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2023-07-21  9:45 Chandan Babu R
2023-07-21  9:45 ` [PATCH V3 12/23] xfs_db: Add support to read from external log device Chandan Babu R

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=20230801234959.GT11352@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=chandan.babu@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox