aoecmd_sleepwork(struct work_struct *work)
{
struct aoedev *d = container_of(work, struct aoedev, work);
- struct block_device *bd;
- u64 ssize;
if (d->flags & DEVFL_GDALLOC)
aoeblk_gdalloc(d);
if (d->flags & DEVFL_NEWSIZE) {
- ssize = get_capacity(d->gd);
- bd = bdget_disk(d->gd, 0);
- if (bd) {
- bd_set_nr_sectors(bd, ssize);
- bdput(bd);
- }
+ set_capacity_and_notify(d->gd, d->ssize);
+
spin_lock_irq(&d->lock);
d->flags |= DEVFL_UP;
d->flags &= ~DEVFL_NEWSIZE;
d->geo.start = 0;
if (d->flags & (DEVFL_GDALLOC|DEVFL_NEWSIZE))
return;
- if (d->gd != NULL) {
- set_capacity(d->gd, ssize);
+ if (d->gd != NULL)
d->flags |= DEVFL_NEWSIZE;
- } else
+ else
d->flags |= DEVFL_GDALLOC;
schedule_work(&d->work);
}