Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233661
b: refs/heads/master
c: f0b4f7e
h: refs/heads/master
i:
  233659: 6ccc28f
v: v3
  • Loading branch information
NeilBrown committed Feb 24, 2011
1 parent 0b75775 commit 6acbe51
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 93b270f76e7ef3b81001576860c2701931cdc78b
refs/heads/master: f0b4f7e2f29af678bd9af43422c537dcb6008603
22 changes: 21 additions & 1 deletion trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -4627,6 +4627,7 @@ static int do_md_run(mddev_t *mddev)
}
set_capacity(mddev->gendisk, mddev->array_sectors);
revalidate_disk(mddev->gendisk);
mddev->changed = 1;
kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
out:
return err;
Expand Down Expand Up @@ -4715,6 +4716,7 @@ static void md_clean(mddev_t *mddev)
mddev->sync_speed_min = mddev->sync_speed_max = 0;
mddev->recovery = 0;
mddev->in_sync = 0;
mddev->changed = 0;
mddev->degraded = 0;
mddev->safemode = 0;
mddev->bitmap_info.offset = 0;
Expand Down Expand Up @@ -4830,6 +4832,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)

set_capacity(disk, 0);
mutex_unlock(&mddev->open_mutex);
mddev->changed = 1;
revalidate_disk(disk);

if (mddev->ro)
Expand Down Expand Up @@ -6014,7 +6017,7 @@ static int md_open(struct block_device *bdev, fmode_t mode)
atomic_inc(&mddev->openers);
mutex_unlock(&mddev->open_mutex);

check_disk_size_change(mddev->gendisk, bdev);
check_disk_change(bdev);
out:
return err;
}
Expand All @@ -6029,6 +6032,21 @@ static int md_release(struct gendisk *disk, fmode_t mode)

return 0;
}

static int md_media_changed(struct gendisk *disk)
{
mddev_t *mddev = disk->private_data;

return mddev->changed;
}

static int md_revalidate(struct gendisk *disk)
{
mddev_t *mddev = disk->private_data;

mddev->changed = 0;
return 0;
}
static const struct block_device_operations md_fops =
{
.owner = THIS_MODULE,
Expand All @@ -6039,6 +6057,8 @@ static const struct block_device_operations md_fops =
.compat_ioctl = md_compat_ioctl,
#endif
.getgeo = md_getgeo,
.media_changed = md_media_changed,
.revalidate_disk= md_revalidate,
};

static int md_thread(void * arg)
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/md/md.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ struct mddev_s
atomic_t active; /* general refcount */
atomic_t openers; /* number of active opens */

int changed; /* True if we might need to
* reread partition info */
int degraded; /* whether md should consider
* adding a spare
*/
Expand Down

0 comments on commit 6acbe51

Please sign in to comment.