summaryrefslogtreecommitdiff
path: root/sysfs.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-12-23 14:10:41 +1100
committerNeilBrown <neilb@suse.de>2011-12-23 14:10:41 +1100
commitc0c1acd691e3809647f464f88e57405a01e12b30 (patch)
treedca7eaf66aa8781b799a4294bd0103c9d260325b /sysfs.c
parentb6db6fab11aedf2f04831d777e68a557b6d1f450 (diff)
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.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sysfs.c b/sysfs.c
index d923f7fb..e32ececa 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -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;