[PATCH 1/2] md: journal: Add journal_disks member to mdu_array_info_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Modify mdu_array_info_t in include/uapi/linux/raid/md_u.h to
include a journal_disks member which tracks the number of disks
being used as a RAID-5/6 journal in the array. Also modify
get_array_info function in drivers/md/md.c to update this member,
and add spaces between variables on second declaration line to
prevent checkpatch.pl errors.

I've written a corresponding patch for mdadm which exposes this
information via the --detail mode and fixes compatibility due
to larger struct size.

Signed-off-by: Phillip Potter <phil@xxxxxxxxxxxxxxxx>
---
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 63ceabb4e020..eeca966046c1 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6209,10 +6209,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++;
@@ -6223,8 +6223,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++;
 		}
@@ -6256,6 +6255,7 @@ static int get_array_info(struct mddev *mddev, void __user *arg)
 	info.working_disks = working;
 	info.failed_disks  = failed;
 	info.spare_disks   = spare;
+	info.journal_disks = journal;
 
 	info.layout        = mddev->layout;
 	info.chunk_size    = mddev->chunk_sectors << 9;
diff --git a/include/uapi/linux/raid/md_u.h b/include/uapi/linux/raid/md_u.h
index 105307244961..6b3b3f7699ad 100644
--- a/include/uapi/linux/raid/md_u.h
+++ b/include/uapi/linux/raid/md_u.h
@@ -98,6 +98,7 @@ typedef struct mdu_array_info_s {
 	int working_disks;	/*  3 Number of working disks		      */
 	int failed_disks;	/*  4 Number of failed disks		      */
 	int spare_disks;	/*  5 Number of spare disks		      */
+	int journal_disks;	/*  6 Number of journal disks for RAID-5/6    */
 
 	/*
 	 * Personality information



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux