Linux-Raid Archives mirror
 help / color / mirror / Atom feed
From: Abhinav Jain <jain.abhinav177@gmail.com>
To: song@kernel.org, yukuai3@huawei.com, linux-raid@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: skhan@linuxfoundation.org, javier.carrasco.cruz@gmail.com,
	Abhinav Jain <jain.abhinav177@gmail.com>
Subject: [PATCH] md: Added journal count to md_u.h
Date: Mon, 15 Apr 2024 16:08:18 +0000	[thread overview]
Message-ID: <20240415160818.8276-1-jain.abhinav177@gmail.com> (raw)

This patch addresses TODO in "./drivers/md/md.c:6752".
Add journal struct member to mdu_array_info_t in "md_u.h".
Add the journal field in get_array_info function in "md.c".
Need feedback on if the update_array_info function needs to be updated.

Signed-off-by: Abhinav Jain <jain.abhinav177@gmail.com>
---
 drivers/md/md.c                | 8 ++++----
 include/uapi/linux/raid/md_u.h | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index e575e74aabf5..4958d6e21923 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6735,10 +6735,10 @@ static int get_version(void __user *arg)
 static int get_array_info(struct mddev *mddev, void __user *arg)
 {
 	mdu_array_info_t info;
-	int nr,working,insync,failed,spare;
+	int nr, working, insync, failed, spare, journal;
 	struct md_rdev *rdev;
 
-	nr = working = insync = failed = spare = 0;
+	nr = working = insync = failed = spare = journal = 0;
 	rcu_read_lock();
 	rdev_for_each_rcu(rdev, mddev) {
 		nr++;
@@ -6749,8 +6749,7 @@ static int get_array_info(struct mddev *mddev, void __user *arg)
 			if (test_bit(In_sync, &rdev->flags))
 				insync++;
 			else if (test_bit(Journal, &rdev->flags))
-				/* TODO: add journal count to md_u.h */
-				;
+				journal++;
 			else
 				spare++;
 		}
@@ -6769,6 +6768,7 @@ static int get_array_info(struct mddev *mddev, void __user *arg)
 	info.raid_disks    = mddev->raid_disks;
 	info.md_minor      = mddev->md_minor;
 	info.not_persistent= !mddev->persistent;
+	info.journal       = journal;
 
 	info.utime         = clamp_t(time64_t, mddev->utime, 0, U32_MAX);
 	info.state         = 0;
diff --git a/include/uapi/linux/raid/md_u.h b/include/uapi/linux/raid/md_u.h
index 7be89a4906e7..485befa2205d 100644
--- a/include/uapi/linux/raid/md_u.h
+++ b/include/uapi/linux/raid/md_u.h
@@ -84,6 +84,7 @@ typedef struct mdu_array_info_s {
 	int raid_disks;
 	int md_minor;
 	int not_persistent;
+	int journal;
 
 	/*
 	 * Generic state information
-- 
2.34.1


             reply	other threads:[~2024-04-15 16:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 16:08 Abhinav Jain [this message]
2024-04-15 21:14 ` [PATCH] md: Added journal count to md_u.h Paul Menzel
2024-04-16 14:29 ` Mariusz Tkaczyk

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=20240415160818.8276-1-jain.abhinav177@gmail.com \
    --to=jain.abhinav177@gmail.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=song@kernel.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).