From: Luis Chamberlain <mcgrof@kernel.org>
To: Li Jinlin <lijinlin3@huawei.com>
Cc: song@kernel.org, axboe@kernel.dk, hare@suse.de, jack@suse.cz,
ming.lei@redhat.com, tj@kernel.org, linux-raid@vger.kernel.org,
linux-kernel@vger.kernel.org, linfeilong@huawei.com
Subject: Re: [PATCH] md: Fix unexpected behaviour in is_mddev_idle
Date: Wed, 1 Dec 2021 05:50:30 -0800 [thread overview]
Message-ID: <Yad9phRUdKF/giGD@bombadil.infradead.org> (raw)
In-Reply-To: <20211201032712.3684503-1-lijinlin3@huawei.com>
On Wed, Dec 01, 2021 at 11:27:12AM +0800, Li Jinlin wrote:
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 5111ed966947..f47035838c43 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -8429,14 +8429,14 @@ static int is_mddev_idle(struct mddev *mddev, int init)
> {
> struct md_rdev *rdev;
> int idle;
> - int curr_events;
> + long curr_events;
>
> idle = 1;
> rcu_read_lock();
> rdev_for_each_rcu(rdev, mddev) {
> struct gendisk *disk = rdev->bdev->bd_disk;
> - curr_events = (int)part_stat_read_accum(disk->part0, sectors) -
> - atomic_read(&disk->sync_io);
> + curr_events = (long)part_stat_read_accum(disk->part0, sectors) -
> + atomic64_read(&disk->sync_io);
And what makes you believe you might not have to go and change all other
drivers to address this as well?
> static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors)
> diff --git a/include/linux/genhd.h b/include/linux/genhd.h
> index 74c410263113..efa7884de11b 100644
> --- a/include/linux/genhd.h
> +++ b/include/linux/genhd.h
> @@ -150,7 +150,7 @@ struct gendisk {
> struct list_head slave_bdevs;
> #endif
> struct timer_rand_state *random;
> - atomic_t sync_io; /* RAID */
> + atomic64_t sync_io; /* RAID */
> struct disk_events *ev;
> #ifdef CONFIG_BLK_DEV_INTEGRITY
> struct kobject integrity_kobj;
> --
> 2.31.1
Luis
next prev parent reply other threads:[~2021-12-01 13:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-01 3:27 Li Jinlin
2021-12-01 13:50 ` Luis Chamberlain [this message]
2021-12-02 5:07 ` Li Jinlin
2021-12-09 17:39 ` Song Liu
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=Yad9phRUdKF/giGD@bombadil.infradead.org \
--to=mcgrof@kernel.org \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--cc=jack@suse.cz \
--cc=lijinlin3@huawei.com \
--cc=linfeilong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=song@kernel.org \
--cc=tj@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
all inboxes | Powered by JetHome®