public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: song@kernel.org, linux-kernel@vger.kernel.org,
	linux-raid@vger.kernel.org, yukuai3@huawei.com,
	yi.zhang@huawei.com, yangerkun@huawei.com
Subject: Re: [PATCH RFC -next 03/26] md/md-bitmap: merge md_bitmap_load() into bitmap_operations
Date: Tue, 13 Aug 2024 09:07:26 +0200	[thread overview]
Message-ID: <20240813090726.000032cd@linux.intel.com> (raw)
In-Reply-To: <20240810020854.797814-4-yukuai1@huaweicloud.com>

On Sat, 10 Aug 2024 10:08:31 +0800
Yu Kuai <yukuai1@huaweicloud.com> wrote:

> From: Yu Kuai <yukuai3@huawei.com>
> 
> So that the implementation won't be exposed, and it'll be possible
> to invent a new bitmap by replacing bitmap_operations.

I don't like repeating same commit message for few patches.

> 
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
>  drivers/md/md-bitmap.c |  6 +++---
>  drivers/md/md-bitmap.h | 10 +++++++++-
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index d731f7d4bbbb..9a9f0fe3ebd0 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -1965,7 +1965,7 @@ static struct bitmap *bitmap_create(struct mddev
> *mddev, int slot) return ERR_PTR(err);
>  }
>  
> -int md_bitmap_load(struct mddev *mddev)
> +static int bitmap_load(struct mddev *mddev)
>  {
>  	int err = 0;
>  	sector_t start = 0;
> @@ -2021,7 +2021,6 @@ int md_bitmap_load(struct mddev *mddev)
>  out:
>  	return err;
>  }
> -EXPORT_SYMBOL_GPL(md_bitmap_load);
>  
>  /* caller need to free returned bitmap with md_bitmap_free() */
>  struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot)
> @@ -2411,7 +2410,7 @@ location_store(struct mddev *mddev, const char *buf,
> size_t len) }
>  
>  			mddev->bitmap = bitmap;
> -			rv = md_bitmap_load(mddev);
> +			rv = bitmap_load(mddev);
>  			if (rv) {
>  				mddev->bitmap_info.offset = 0;
>  				md_bitmap_destroy(mddev);
> @@ -2710,6 +2709,7 @@ const struct attribute_group md_bitmap_group = {
>  
>  static struct bitmap_operations bitmap_ops = {
>  	.create			= bitmap_create,
> +	.load			= bitmap_load,
>  };
>  
>  void mddev_set_bitmap_ops(struct mddev *mddev)
> diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h
> index a7cbf0c692fc..de7fbe5903dd 100644
> --- a/drivers/md/md-bitmap.h
> +++ b/drivers/md/md-bitmap.h
> @@ -236,6 +236,7 @@ struct bitmap {
>  
>  struct bitmap_operations {
>  	struct bitmap* (*create)(struct mddev *mddev, int slot);
> +	int (*load)(struct mddev *mddev);
>  };
>  
>  /* the bitmap API */
> @@ -250,7 +251,14 @@ static inline struct bitmap *md_bitmap_create(struct
> mddev *mddev, int slot) return mddev->bitmap_ops->create(mddev, slot);
>  }
>  
> -int md_bitmap_load(struct mddev *mddev);
> +static inline int md_bitmap_load(struct mddev *mddev)
> +{
> +	if (!mddev->bitmap_ops->load)
> +		return -EOPNOTSUPP;
> +
> +	return mddev->bitmap_ops->load(mddev);
> +}

At this point we have only on bitmpa op (at that probably won't change), so if
we we have bitmap_ops assigned (mddev->bitmap_ops != NULL) then ->load is must
have, hence I don't see a need for this wrapper.

you probably made this to avoid changes across code. If yes, please mention it
in commit message but I still would prefer to replace them all by calls to
mddev->bitmap_ops->load().

Mariusz


  reply	other threads:[~2024-08-13  7:07 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-10  2:08 [PATCH RFC -next 00/26] md/md-bitmap: introduce bitmap_operations Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 01/26] md/md-bitmap: introduce struct bitmap_operations Yu Kuai
2024-08-13  6:58   ` Mariusz Tkaczyk
2024-08-13  7:25     ` Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 02/26] md/md-bitmap: merge md_bitmap_create() into bitmap_operations Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 03/26] md/md-bitmap: merge md_bitmap_load() " Yu Kuai
2024-08-13  7:07   ` Mariusz Tkaczyk [this message]
2024-08-13  7:30     ` Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 04/26] md/md-bitmap: merge md_bitmap_destroy() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 05/26] md/md-bitmap: merge md_bitmap_flush() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 06/26] md/md-bitmap: don't expose md_bitmap_print_sb() Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 07/26] md/md-bitmap: merge md_bitmap_update_sb() into bitmap_operations Yu Kuai
2024-08-13  7:17   ` Mariusz Tkaczyk
2024-08-13  7:33     ` Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 08/26] md/md-bitmap: merge md_bitmap_status() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 09/26] md/md-bitmap: remove md_bitmap_setallbits() Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 10/26] md/md-bitmap: merge bitmap_write_all() into bitmap_operations Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 11/26] md/md-bitmap: merge md_bitmap_dirty_bits() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 12/26] md/md-bitmap: merge md_bitmap_startwrite() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 13/26] md/md-bitmap: merge md_bitmap_endwrite() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 14/26] md/md-bitmap: merge md_bitmap_start_sync() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 15/26] md/md-bitmap: merge md_bitmap_end_sync() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 16/26] md/md-bitmap: merge md_bitmap_close_sync() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 17/26] md/md-bitmap: mrege md_bitmap_cond_end_sync() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 18/26] md/md-bitmap: merge bitmap_sync_with_cluster() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 19/26] md/md-bitmap: merge md_bitmap_resize() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 20/26] md/md-bitmap: merge get_bitmap_from_slot() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 21/26] md/md-bitmap: merge md_bitmap_copy_from_slot() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 22/26] md/md-bitmap: merge md_bitmap_free() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 23/26] md/md-bitmap: merge md_bitmap_wait_behind_writes() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 24/26] md/md-bitmap: merge md_bitmap_daemon_work() " Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 25/26] md/md-bitmap: merge md_bitmap_unplug() and md_bitmap_unplug_async() Yu Kuai
2024-08-10  2:08 ` [PATCH RFC -next 26/26] md/md-bitmap: merge bitmap_unplug() into bitmap_operations Yu Kuai
2024-08-13  7:21 ` [PATCH RFC -next 00/26] md/md-bitmap: introduce bitmap_operations Christoph Hellwig
2024-08-13  7:36   ` Yu Kuai

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=20240813090726.000032cd@linux.intel.com \
    --to=mariusz.tkaczyk@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@kernel.org \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox