From: Adam Kwolek <adam.kwolek@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
ed.ciechanowski@intel.com, grzegorz.grabowski@intel.com,
maciej.patelczyk@intel.com, anna.czarnowska@intel.com,
Adam Kwolek <adam.kwolek@intel.com>
Subject: [PATCH 04/14] imsm: Execute size change for external metatdata
Date: Fri, 13 Apr 2012 16:51:58 +0200 [thread overview]
Message-ID: <1334328728-12544-5-git-send-email-adam.kwolek@intel.com> (raw)
In-Reply-To: <1334328728-12544-4-git-send-email-adam.kwolek@intel.com>
For external metatdata ioctl doesn't set new size. Set new size using sysfs.
Put code for size change in to function to re-use the same code as during
On-line Capacity Expansion
Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
---
Grow.c | 78 ++++++++++++++++++++++++++++++++++++++-------------------------
1 files changed, 47 insertions(+), 31 deletions(-)
diff --git a/Grow.c b/Grow.c
index e3ef8d4..5fd44aa 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1386,6 +1386,44 @@ char *analyse_change(struct mdinfo *info, struct reshape *re)
return NULL;
}
+static int set_array_size(struct supertype *st, struct mdinfo *sra,
+ char *text_version)
+{
+ struct mdinfo *info;
+ char *subarray;
+ int ret_val = -1;
+
+ if ((st == NULL) || (sra == NULL))
+ return ret_val;
+
+ if (text_version == NULL)
+ text_version = sra->text_version;
+ subarray = strchr(text_version+1, '/')+1;
+ info = st->ss->container_content(st, subarray);
+ if (info) {
+ unsigned long long current_size = 0;
+ unsigned long long new_size =
+ info->custom_array_size/2;
+
+ if (sysfs_get_ll(sra, NULL, "array_size", ¤t_size) == 0 &&
+ new_size > current_size) {
+ if (sysfs_set_num(sra, NULL, "array_size", new_size)
+ < 0)
+ dprintf("Error: Cannot set array size");
+ else {
+ ret_val = 0;
+ dprintf("Array size changed");
+ }
+ dprintf(" from %llu to %llu.\n",
+ current_size, new_size);
+ }
+ sysfs_free(info);
+ } else
+ dprintf("Error: set_array_size(): info pointer in NULL\n");
+
+ return ret_val;
+}
+
static int reshape_array(char *container, int fd, char *devname,
struct supertype *st, struct mdinfo *info,
int force, struct mddev_dev *devlist,
@@ -1636,7 +1674,6 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
"2TB per device\n");
size = min_csize;
}
-
array.size = size;
if (array.size != size) {
/* got truncated to 32bit, write to
@@ -1647,8 +1684,14 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
"component_size", size);
else
rv = -1;
- } else
+ } else {
rv = ioctl(fd, SET_ARRAY_INFO, &array);
+ /* manage array size when it is managed externally
+ */
+ if ((rv == 0) && st->ss->external)
+ rv = set_array_size(st, sra, sra->text_version);
+ }
+
if (rv != 0) {
int err = errno;
@@ -2507,35 +2550,8 @@ started:
*/
if (reshape.before.data_disks !=
reshape.after.data_disks &&
- info->custom_array_size) {
- struct mdinfo *info2;
- char *subarray = strchr(info->text_version+1, '/')+1;
-
- info2 = st->ss->container_content(st, subarray);
- if (info2) {
- unsigned long long current_size = 0;
- unsigned long long new_size =
- info2->custom_array_size/2;
-
- if (sysfs_get_ll(sra,
- NULL,
- "array_size",
- ¤t_size) == 0 &&
- new_size > current_size) {
- if (sysfs_set_num(sra, NULL,
- "array_size", new_size)
- < 0)
- dprintf("Error: Cannot"
- " set array size");
- else
- dprintf("Array size "
- "changed");
- dprintf(" from %llu to %llu.\n",
- current_size, new_size);
- }
- sysfs_free(info2);
- }
- }
+ info->custom_array_size)
+ set_array_size(st, info, info->text_version);
if (info->new_level != reshape.level) {
--
1.6.4.2
next prev parent reply other threads:[~2012-04-13 14:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-13 14:51 [PATCH 00/14] imsm: volume expand Adam Kwolek
2012-04-13 14:51 ` [PATCH 01/14] imsm: FIX: Update function imsm_num_data_members() for Raid1/10 Adam Kwolek
2012-04-13 14:51 ` [PATCH 02/14] imsm: FIX: Add volume size expand support to imsm_analyze_change() Adam Kwolek
2012-04-13 14:51 ` [PATCH 03/14] imsm: Add new metadata update for volume size expansion Adam Kwolek
2012-04-13 14:51 ` Adam Kwolek [this message]
2012-04-13 14:51 ` [PATCH 05/14] FIX: Support metadata changes rollback Adam Kwolek
2012-04-13 14:52 ` [PATCH 06/14] imsm: " Adam Kwolek
2012-04-13 14:52 ` [PATCH 07/14] FIX: Extend size of raid0 array Adam Kwolek
2012-04-13 14:52 ` [PATCH 08/14] FIX: Respect metadata size limitations Adam Kwolek
2012-04-13 14:52 ` [PATCH 09/14] FIX: Detect error and rollback metadata Adam Kwolek
2012-04-13 14:52 ` [PATCH 10/14] imsm: Add function imsm_get_free_size() Adam Kwolek
2012-04-13 14:52 ` [PATCH 11/14] imsm: Support setting max size for size change operation Adam Kwolek
2012-04-13 14:52 ` [PATCH 12/14] imsm: FIX: Component size alignment check Adam Kwolek
2012-04-13 14:52 ` [PATCH 13/14] FIX: Size change is possible as standalone change only Adam Kwolek
2012-04-13 14:52 ` [PATCH 14/14] FIX: Assembled second array is in read only state during reshape Adam Kwolek
2012-04-17 2:52 ` [PATCH 07/14] FIX: Extend size of raid0 array NeilBrown
2012-04-19 15:09 ` Dorau, Lukasz
2012-04-19 21:23 ` NeilBrown
2012-04-20 8:48 ` Dorau, Lukasz
2012-04-17 2:56 ` [PATCH 00/14] imsm: volume expand NeilBrown
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=1334328728-12544-5-git-send-email-adam.kwolek@intel.com \
--to=adam.kwolek@intel.com \
--cc=anna.czarnowska@intel.com \
--cc=dan.j.williams@intel.com \
--cc=ed.ciechanowski@intel.com \
--cc=grzegorz.grabowski@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=maciej.patelczyk@intel.com \
--cc=neilb@suse.de \
/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 NNTP newsgroup(s).