Skip to content

Commit c3af54a

Browse files
htejunJens Axboe
authored andcommitted
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>
1 parent a9dce2a commit c3af54a

File tree

1 file changed

+24
-31
lines changed

1 file changed

+24
-31
lines changed

block/genhd.c

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,22 +1414,36 @@ static unsigned long disk_events_poll_jiffies(struct gendisk *disk)
14141414
return msecs_to_jiffies(intv_msecs);
14151415
}
14161416

1417-
static void __disk_block_events(struct gendisk *disk, bool sync)
1417+
/**
1418+
* disk_block_events - block and flush disk event checking
1419+
* @disk: disk to block events for
1420+
*
1421+
* On return from this function, it is guaranteed that event checking
1422+
* isn't in progress and won't happen until unblocked by
1423+
* disk_unblock_events(). Events blocking is counted and the actual
1424+
* unblocking happens after the matching number of unblocks are done.
1425+
*
1426+
* Note that this intentionally does not block event checking from
1427+
* disk_clear_events().
1428+
*
1429+
* CONTEXT:
1430+
* Might sleep.
1431+
*/
1432+
void disk_block_events(struct gendisk *disk)
14181433
{
14191434
struct disk_events *ev = disk->ev;
14201435
unsigned long flags;
14211436
bool cancel;
14221437

1438+
if (!ev)
1439+
return;
1440+
14231441
spin_lock_irqsave(&ev->lock, flags);
14241442
cancel = !ev->block++;
14251443
spin_unlock_irqrestore(&ev->lock, flags);
14261444

1427-
if (cancel) {
1428-
if (sync)
1429-
cancel_delayed_work_sync(&disk->ev->dwork);
1430-
else
1431-
cancel_delayed_work(&disk->ev->dwork);
1432-
}
1445+
if (cancel)
1446+
cancel_delayed_work_sync(&disk->ev->dwork);
14331447
}
14341448

14351449
static void __disk_unblock_events(struct gendisk *disk, bool check_now)
@@ -1460,27 +1474,6 @@ static void __disk_unblock_events(struct gendisk *disk, bool check_now)
14601474
spin_unlock_irqrestore(&ev->lock, flags);
14611475
}
14621476

1463-
/**
1464-
* disk_block_events - block and flush disk event checking
1465-
* @disk: disk to block events for
1466-
*
1467-
* On return from this function, it is guaranteed that event checking
1468-
* isn't in progress and won't happen until unblocked by
1469-
* disk_unblock_events(). Events blocking is counted and the actual
1470-
* unblocking happens after the matching number of unblocks are done.
1471-
*
1472-
* Note that this intentionally does not block event checking from
1473-
* disk_clear_events().
1474-
*
1475-
* CONTEXT:
1476-
* Might sleep.
1477-
*/
1478-
void disk_block_events(struct gendisk *disk)
1479-
{
1480-
if (disk->ev)
1481-
__disk_block_events(disk, true);
1482-
}
1483-
14841477
/**
14851478
* disk_unblock_events - unblock disk event checking
14861479
* @disk: disk to unblock events for
@@ -1554,7 +1547,7 @@ unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask)
15541547
spin_unlock_irq(&ev->lock);
15551548

15561549
/* uncondtionally schedule event check and wait for it to finish */
1557-
__disk_block_events(disk, true);
1550+
disk_block_events(disk);
15581551
queue_delayed_work(system_nrt_wq, &ev->dwork, 0);
15591552
flush_delayed_work(&ev->dwork);
15601553
__disk_unblock_events(disk, false);
@@ -1672,7 +1665,7 @@ static ssize_t disk_events_poll_msecs_store(struct device *dev,
16721665
if (intv < 0 && intv != -1)
16731666
return -EINVAL;
16741667

1675-
__disk_block_events(disk, true);
1668+
disk_block_events(disk);
16761669
disk->ev->poll_msecs = intv;
16771670
__disk_unblock_events(disk, true);
16781671

@@ -1778,7 +1771,7 @@ static void disk_del_events(struct gendisk *disk)
17781771
if (!disk->ev)
17791772
return;
17801773

1781-
__disk_block_events(disk, true);
1774+
disk_block_events(disk);
17821775

17831776
mutex_lock(&disk_events_mutex);
17841777
list_del_init(&disk->ev->node);

0 commit comments

Comments
 (0)