diff options
author | NeilBrown <neilb@suse.de> | 2010-06-01 19:37:32 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-07-26 13:21:31 +1000 |
commit | 5ff5afffe6527543866a47ffab12769427283917 (patch) | |
tree | b37cf6ad3557ffada21aa05174bb055ea8e6c173 /drivers | |
parent | ac2f40be46ce6ab3bec4c8c297d6923f941741ce (diff) |
md/bitmap: reduce dependence on sysfs.
For dm-raid45 we will want to use bitmaps in dm-targets which don't
have entries in sysfs, so cope with the mddev not living in sysfs.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/bitmap.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 67fb32d1124..8af4d655b2d 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -1358,7 +1358,7 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto bitmap->events_cleared < bitmap->mddev->events) { bitmap->events_cleared = bitmap->mddev->events; bitmap->need_sync = 1; - sysfs_notify_dirent(bitmap->sysfs_can_clear); + sysfs_notify_dirent_safe(bitmap->sysfs_can_clear); } if (!success && ! (*bmc & NEEDED_MASK)) @@ -1643,7 +1643,7 @@ int bitmap_create(mddev_t *mddev) struct file *file = mddev->bitmap_info.file; int err; sector_t start; - struct sysfs_dirent *bm; + struct sysfs_dirent *bm = NULL; BUILD_BUG_ON(sizeof(bitmap_super_t) != 256); @@ -1664,7 +1664,8 @@ int bitmap_create(mddev_t *mddev) bitmap->mddev = mddev; - bm = sysfs_get_dirent(mddev->kobj.sd, NULL, "bitmap"); + if (mddev->kobj.sd) + bm = sysfs_get_dirent(mddev->kobj.sd, NULL, "bitmap"); if (bm) { bitmap->sysfs_can_clear = sysfs_get_dirent(bm, NULL, "can_clear"); sysfs_put(bm); |