block: remove non-syncing __disk_block_events() and fold it into disk_block_events()
After the previous update to disk_check_events(), nobody is using non-syncing __disk_block_events(). Remove @sync and, as this makes __disk_block_events() virtually identical to disk_block_events(), remove the underscore prefixed version. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
This commit is contained in:
parent
a9dce2a3b4
commit
c3af54afba
1 changed files with 24 additions and 31 deletions
|
@ -1414,22 +1414,36 @@ static unsigned long disk_events_poll_jiffies(struct gendisk *disk)
|
||||||
return msecs_to_jiffies(intv_msecs);
|
return msecs_to_jiffies(intv_msecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __disk_block_events(struct gendisk *disk, bool sync)
|
/**
|
||||||
|
* disk_block_events - block and flush disk event checking
|
||||||
|
* @disk: disk to block events for
|
||||||
|
*
|
||||||
|
* On return from this function, it is guaranteed that event checking
|
||||||
|
* isn't in progress and won't happen until unblocked by
|
||||||
|
* disk_unblock_events(). Events blocking is counted and the actual
|
||||||
|
* unblocking happens after the matching number of unblocks are done.
|
||||||
|
*
|
||||||
|
* Note that this intentionally does not block event checking from
|
||||||
|
* disk_clear_events().
|
||||||
|
*
|
||||||
|
* CONTEXT:
|
||||||
|
* Might sleep.
|
||||||
|
*/
|
||||||
|
void disk_block_events(struct gendisk *disk)
|
||||||
{
|
{
|
||||||
struct disk_events *ev = disk->ev;
|
struct disk_events *ev = disk->ev;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
bool cancel;
|
bool cancel;
|
||||||
|
|
||||||
|
if (!ev)
|
||||||
|
return;
|
||||||
|
|
||||||
spin_lock_irqsave(&ev->lock, flags);
|
spin_lock_irqsave(&ev->lock, flags);
|
||||||
cancel = !ev->block++;
|
cancel = !ev->block++;
|
||||||
spin_unlock_irqrestore(&ev->lock, flags);
|
spin_unlock_irqrestore(&ev->lock, flags);
|
||||||
|
|
||||||
if (cancel) {
|
if (cancel)
|
||||||
if (sync)
|
cancel_delayed_work_sync(&disk->ev->dwork);
|
||||||
cancel_delayed_work_sync(&disk->ev->dwork);
|
|
||||||
else
|
|
||||||
cancel_delayed_work(&disk->ev->dwork);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __disk_unblock_events(struct gendisk *disk, bool check_now)
|
static void __disk_unblock_events(struct gendisk *disk, bool check_now)
|
||||||
|
@ -1460,27 +1474,6 @@ out_unlock:
|
||||||
spin_unlock_irqrestore(&ev->lock, flags);
|
spin_unlock_irqrestore(&ev->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* disk_block_events - block and flush disk event checking
|
|
||||||
* @disk: disk to block events for
|
|
||||||
*
|
|
||||||
* On return from this function, it is guaranteed that event checking
|
|
||||||
* isn't in progress and won't happen until unblocked by
|
|
||||||
* disk_unblock_events(). Events blocking is counted and the actual
|
|
||||||
* unblocking happens after the matching number of unblocks are done.
|
|
||||||
*
|
|
||||||
* Note that this intentionally does not block event checking from
|
|
||||||
* disk_clear_events().
|
|
||||||
*
|
|
||||||
* CONTEXT:
|
|
||||||
* Might sleep.
|
|
||||||
*/
|
|
||||||
void disk_block_events(struct gendisk *disk)
|
|
||||||
{
|
|
||||||
if (disk->ev)
|
|
||||||
__disk_block_events(disk, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* disk_unblock_events - unblock disk event checking
|
* disk_unblock_events - unblock disk event checking
|
||||||
* @disk: disk to unblock events for
|
* @disk: disk to unblock events for
|
||||||
|
@ -1554,7 +1547,7 @@ unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask)
|
||||||
spin_unlock_irq(&ev->lock);
|
spin_unlock_irq(&ev->lock);
|
||||||
|
|
||||||
/* uncondtionally schedule event check and wait for it to finish */
|
/* uncondtionally schedule event check and wait for it to finish */
|
||||||
__disk_block_events(disk, true);
|
disk_block_events(disk);
|
||||||
queue_delayed_work(system_nrt_wq, &ev->dwork, 0);
|
queue_delayed_work(system_nrt_wq, &ev->dwork, 0);
|
||||||
flush_delayed_work(&ev->dwork);
|
flush_delayed_work(&ev->dwork);
|
||||||
__disk_unblock_events(disk, false);
|
__disk_unblock_events(disk, false);
|
||||||
|
@ -1672,7 +1665,7 @@ static ssize_t disk_events_poll_msecs_store(struct device *dev,
|
||||||
if (intv < 0 && intv != -1)
|
if (intv < 0 && intv != -1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
__disk_block_events(disk, true);
|
disk_block_events(disk);
|
||||||
disk->ev->poll_msecs = intv;
|
disk->ev->poll_msecs = intv;
|
||||||
__disk_unblock_events(disk, true);
|
__disk_unblock_events(disk, true);
|
||||||
|
|
||||||
|
@ -1778,7 +1771,7 @@ static void disk_del_events(struct gendisk *disk)
|
||||||
if (!disk->ev)
|
if (!disk->ev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
__disk_block_events(disk, true);
|
disk_block_events(disk);
|
||||||
|
|
||||||
mutex_lock(&disk_events_mutex);
|
mutex_lock(&disk_events_mutex);
|
||||||
list_del_init(&disk->ev->node);
|
list_del_init(&disk->ev->node);
|
||||||
|
|
Loading…
Add table
Reference in a new issue