Repository navigation
Commit 85ef06d
block: flush MEDIA_CHANGE from drivers on close(2)
Currently, only open(2) is defined as the 'clearing' point. It has
two roles - first, it's an acknowledgement from userland indicating
that the event has been received and kernel can clear pending states
and proceed to generate more events. Secondly, it's passed on to
device drivers as a hint indicating that a synchronization point has
been reached and it might want to take a deeper look at the device.
The latter currently is only used by sr which uses two different
mechanisms - GET_EVENT_MEDIA_STATUS_NOTIFICATION and TEST_UNIT_READY
to discover events, where the former is lighter weight and safe to be
used repeatedly but may not provide full coverage. Among other
things, GET_EVENT can't detect media removal while TUR can.
This patch makes close(2) - blkdev_put() - indicate clearing hint for
MEDIA_CHANGE to drivers. disk_check_events() is renamed to
disk_flush_events() and updated to take @Mask for events to flush
which is or'd to ev->clearing and will be passed to the driver on the
next ->check_events() invocation.
This change makes sr generate MEDIA_CHANGE when media is ejected from
userland - e.g. with eject(1).
Note: Given the current usage, it seems @clearing hint is needlessly
complex. disk_clear_events() can simply clear all events and the hint
can be boolean @flush.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>1 parent 04bf786 commit 85ef06d
3 files changed
Lines changed: 27 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1500 | 1500 | | |
1501 | 1501 | | |
1502 | 1502 | | |
1503 | | - | |
1504 | | - | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
1505 | 1506 | | |
1506 | | - | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
1507 | 1510 | | |
1508 | 1511 | | |
1509 | | - | |
| 1512 | + | |
1510 | 1513 | | |
1511 | | - | |
| 1514 | + | |
1512 | 1515 | | |
1513 | 1516 | | |
1514 | | - | |
1515 | 1517 | | |
1516 | 1518 | | |
1517 | 1519 | | |
1518 | 1520 | | |
1519 | | - | |
| 1521 | + | |
| 1522 | + | |
1520 | 1523 | | |
1521 | 1524 | | |
1522 | 1525 | | |
1523 | 1526 | | |
1524 | | - | |
| 1527 | + | |
1525 | 1528 | | |
1526 | | - | |
1527 | 1529 | | |
1528 | 1530 | | |
1529 | 1531 | | |
| |||
1713 | 1715 | | |
1714 | 1716 | | |
1715 | 1717 | | |
1716 | | - | |
| 1718 | + | |
1717 | 1719 | | |
1718 | 1720 | | |
1719 | 1721 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1447 | 1447 | | |
1448 | 1448 | | |
1449 | 1449 | | |
| 1450 | + | |
| 1451 | + | |
1450 | 1452 | | |
1451 | 1453 | | |
1452 | 1454 | | |
| |||
1455 | 1457 | | |
1456 | 1458 | | |
1457 | 1459 | | |
1458 | | - | |
1459 | 1460 | | |
1460 | 1461 | | |
1461 | 1462 | | |
| |||
1473 | 1474 | | |
1474 | 1475 | | |
1475 | 1476 | | |
1476 | | - | |
1477 | | - | |
1478 | | - | |
1479 | | - | |
1480 | | - | |
1481 | | - | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
1482 | 1480 | | |
1483 | | - | |
1484 | | - | |
1485 | 1481 | | |
1486 | 1482 | | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
1487 | 1492 | | |
1488 | 1493 | | |
1489 | 1494 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
| 423 | + | |
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
| |||
0 commit comments