diff options
author | NeilBrown <neilb@suse.de> | 2011-12-23 04:10:41 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-12-23 04:10:41 +0100 |
commit | c0c1acd691e3809647f464f88e57405a01e12b30 (patch) | |
tree | dca7eaf66aa8781b799a4294bd0103c9d260325b /sysfs.c | |
parent | super1: use awrite when writing a new bitmap. (diff) | |
download | mdadm-c0c1acd691e3809647f464f88e57405a01e12b30.tar.xz mdadm-c0c1acd691e3809647f464f88e57405a01e12b30.zip |
Grow/bitmap: support adding bitmap via sysfs.
Adding a bitmap via ioctl can only add it at a fixed location.
That location is not suitable for 4K-block devices.
So allow setting the bitmap location via sysfs if kernel supports it
and aim to always use 4K alignments.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'sysfs.c')
-rw-r--r-- | sysfs.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -217,6 +217,19 @@ struct mdinfo *sysfs_read(int fd, int devnum, unsigned long options) msec = (msec * 1000) / scale; sra->safe_mode_delay = msec; } + if (options & GET_BITMAP_LOCATION) { + strcpy(base, "bitmap/location"); + if (load_sys(fname, buf)) + goto abort; + if (strncmp(buf, "file", 4) == 0) + sra->bitmap_offset = 1; + else if (strncmp(buf, "none", 4) == 0) + sra->bitmap_offset = 0; + else if (buf[0] == '+') + sra->bitmap_offset = strtoul(buf+1, NULL, 10); + else + goto abort; + } if (! (options & GET_DEVS)) return sra; |