All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] erofs: scan devices from device table
Date: Thu, 12 May 2022 13:41:02 +0800	[thread overview]
Message-ID: <Ynyd7iTbE+NhnTmh@B-P7TQMD6M-0146.local> (raw)
In-Reply-To: <20220510093511.77473-1-jefflexu@linux.alibaba.com>

On Tue, May 10, 2022 at 05:35:11PM +0800, Jeffle Xu wrote:
> When "-o device" mount option is not specified, scan the device table
> and instantiate the devices if there's any in the device table. In this
> case, the tag field of each device slot uniquely specifies a device.
> 
> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
> ---
>  fs/erofs/erofs_fs.h |   9 ++--
>  fs/erofs/super.c    | 102 ++++++++++++++++++++++++++++++--------------
>  2 files changed, 72 insertions(+), 39 deletions(-)
> 
> diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h
> index 1238ca104f09..1adde3a813b4 100644
> --- a/fs/erofs/erofs_fs.h
> +++ b/fs/erofs/erofs_fs.h
> @@ -37,12 +37,9 @@
>  #define EROFS_SB_EXTSLOT_SIZE	16
>  
>  struct erofs_deviceslot {
> -	union {
> -		u8 uuid[16];		/* used for device manager later */
> -		u8 userdata[64];	/* digest(sha256), etc. */
> -	} u;
> -	__le32 blocks;			/* total fs blocks of this device */
> -	__le32 mapped_blkaddr;		/* map starting at mapped_blkaddr */
> +	u8 tag[64];		/* digest(sha256), etc. */
> +	__le32 blocks;		/* total fs blocks of this device */
> +	__le32 mapped_blkaddr;	/* map starting at mapped_blkaddr */
>  	u8 reserved[56];
>  };
>  #define EROFS_DEVT_SLOT_SIZE	sizeof(struct erofs_deviceslot)
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index 4a623630e1c4..3f19c2031e69 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -219,7 +219,52 @@ static int erofs_load_compr_cfgs(struct super_block *sb,
>  }
>  #endif
>  
> -static int erofs_init_devices(struct super_block *sb,
> +static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
> +			     struct erofs_device_info *dif, erofs_off_t *pos)
> +{
> +	struct erofs_sb_info *sbi = EROFS_SB(sb);
> +	struct erofs_deviceslot *dis;
> +	struct block_device *bdev;
> +	void *ptr;
> +	int ret;
> +
> +	ptr = erofs_read_metabuf(buf, sb, erofs_blknr(*pos), EROFS_KMAP);
> +	if (IS_ERR(ptr))
> +		return PTR_ERR(ptr);
> +	dis = ptr + erofs_blkoff(*pos);
> +
> +	if (!dif->path) {
> +		if (!dis->tag[0]) {
> +			erofs_err(sb, "Empty digest data (pos %llu)", *pos);

			erofs_err(sb, "empty tag @ pos %llu", *pos);
?

Otherwise it looks good to me,
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

WARNING: multiple messages have this Message-ID (diff)
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] erofs: scan devices from device table
Date: Thu, 12 May 2022 13:41:02 +0800	[thread overview]
Message-ID: <Ynyd7iTbE+NhnTmh@B-P7TQMD6M-0146.local> (raw)
In-Reply-To: <20220510093511.77473-1-jefflexu@linux.alibaba.com>

On Tue, May 10, 2022 at 05:35:11PM +0800, Jeffle Xu wrote:
> When "-o device" mount option is not specified, scan the device table
> and instantiate the devices if there's any in the device table. In this
> case, the tag field of each device slot uniquely specifies a device.
> 
> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
> ---
>  fs/erofs/erofs_fs.h |   9 ++--
>  fs/erofs/super.c    | 102 ++++++++++++++++++++++++++++++--------------
>  2 files changed, 72 insertions(+), 39 deletions(-)
> 
> diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h
> index 1238ca104f09..1adde3a813b4 100644
> --- a/fs/erofs/erofs_fs.h
> +++ b/fs/erofs/erofs_fs.h
> @@ -37,12 +37,9 @@
>  #define EROFS_SB_EXTSLOT_SIZE	16
>  
>  struct erofs_deviceslot {
> -	union {
> -		u8 uuid[16];		/* used for device manager later */
> -		u8 userdata[64];	/* digest(sha256), etc. */
> -	} u;
> -	__le32 blocks;			/* total fs blocks of this device */
> -	__le32 mapped_blkaddr;		/* map starting at mapped_blkaddr */
> +	u8 tag[64];		/* digest(sha256), etc. */
> +	__le32 blocks;		/* total fs blocks of this device */
> +	__le32 mapped_blkaddr;	/* map starting at mapped_blkaddr */
>  	u8 reserved[56];
>  };
>  #define EROFS_DEVT_SLOT_SIZE	sizeof(struct erofs_deviceslot)
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index 4a623630e1c4..3f19c2031e69 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -219,7 +219,52 @@ static int erofs_load_compr_cfgs(struct super_block *sb,
>  }
>  #endif
>  
> -static int erofs_init_devices(struct super_block *sb,
> +static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
> +			     struct erofs_device_info *dif, erofs_off_t *pos)
> +{
> +	struct erofs_sb_info *sbi = EROFS_SB(sb);
> +	struct erofs_deviceslot *dis;
> +	struct block_device *bdev;
> +	void *ptr;
> +	int ret;
> +
> +	ptr = erofs_read_metabuf(buf, sb, erofs_blknr(*pos), EROFS_KMAP);
> +	if (IS_ERR(ptr))
> +		return PTR_ERR(ptr);
> +	dis = ptr + erofs_blkoff(*pos);
> +
> +	if (!dif->path) {
> +		if (!dis->tag[0]) {
> +			erofs_err(sb, "Empty digest data (pos %llu)", *pos);

			erofs_err(sb, "empty tag @ pos %llu", *pos);
?

Otherwise it looks good to me,
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

  reply	other threads:[~2022-05-12  5:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10  9:35 [PATCH] erofs: scan devices from device table Jeffle Xu
2022-05-12  5:41 ` Gao Xiang [this message]
2022-05-12  5:41   ` Gao Xiang

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=Ynyd7iTbE+NhnTmh@B-P7TQMD6M-0146.local \
    --to=hsiangkao@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=jefflexu@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiang@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.