[PATCH 4/7] Add block_subarray()

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

 



Put code for blocking subarray in to separate function.
This little code/function will be used for blocking arrays from mdmon
monitoring during assembly process. Arrays cannot wait for container
assembly finish, because meanwhile monitor can enable arrays for writing.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 msg.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/msg.c b/msg.c
index 76e74e7..ce2ce00 100644
--- a/msg.c
+++ b/msg.c
@@ -255,6 +255,18 @@ static int unblock_subarray(struct mdinfo *sra, const int unfreeze)
 	return rc;
 }
 
+int block_subarray(struct mdinfo *sra)
+{
+	char buf[64];
+	int rc = 0;
+
+	sprintf(buf, "external:%s\n", sra->text_version);
+	buf[9] = '-';
+	if (sysfs_set_str(sra, NULL, "metadata_version", buf))
+		rc = -1;
+
+	return rc;
+}
 /**
  * block_monitor - prevent mdmon spare assignment
  * @container - container to block
@@ -334,9 +346,7 @@ int block_monitor(char *container, const int freeze)
 		 * takeover in reshape case and spare reassignment in the
 		 * auto-rebuild case)
 		 */
-		sprintf(buf, "external:%s\n", sra->text_version);
-		buf[9] = '-';
-		if (sysfs_set_str(sra, NULL, "metadata_version", buf))
+		if (block_subarray(sra))
 			break;
 		ping_monitor(container);
 

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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