Lines Matching refs:disk
12 struct gendisk *disk; /* the associated disk */ member
41 static unsigned long disk_events_poll_jiffies(struct gendisk *disk) in disk_events_poll_jiffies() argument
43 struct disk_events *ev = disk->ev; in disk_events_poll_jiffies()
52 else if (disk->event_flags & DISK_EVENT_FLAG_POLL) in disk_events_poll_jiffies()
73 void disk_block_events(struct gendisk *disk) in disk_block_events() argument
75 struct disk_events *ev = disk->ev; in disk_block_events()
93 cancel_delayed_work_sync(&disk->ev->dwork); in disk_block_events()
98 static void __disk_unblock_events(struct gendisk *disk, bool check_now) in __disk_unblock_events() argument
100 struct disk_events *ev = disk->ev; in __disk_unblock_events()
112 intv = disk_events_poll_jiffies(disk); in __disk_unblock_events()
133 void disk_unblock_events(struct gendisk *disk) in disk_unblock_events() argument
135 if (disk->ev) in disk_unblock_events()
136 __disk_unblock_events(disk, false); in disk_unblock_events()
151 void disk_flush_events(struct gendisk *disk, unsigned int mask) in disk_flush_events() argument
153 struct disk_events *ev = disk->ev; in disk_flush_events()
171 static void disk_event_uevent(struct gendisk *disk, unsigned int events) in disk_event_uevent() argument
177 if (events & disk->events & (1 << i)) in disk_event_uevent()
181 kobject_uevent_env(&disk_to_dev(disk)->kobj, KOBJ_CHANGE, envp); in disk_event_uevent()
187 struct gendisk *disk = ev->disk; in disk_check_events() local
193 events = disk->fops->check_events(disk, clearing); in disk_check_events()
202 intv = disk_events_poll_jiffies(disk); in disk_check_events()
210 inc_diskseq(disk); in disk_check_events()
212 if (disk->event_flags & DISK_EVENT_FLAG_UEVENT) in disk_check_events()
213 disk_event_uevent(disk, events); in disk_check_events()
227 static unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask) in disk_clear_events() argument
229 struct disk_events *ev = disk->ev; in disk_clear_events()
236 disk_block_events(disk); in disk_clear_events()
253 __disk_unblock_events(disk, ev->clearing ? true : false); in disk_clear_events()
303 bool disk_force_media_change(struct gendisk *disk, unsigned int events) in disk_force_media_change() argument
305 disk_event_uevent(disk, events); in disk_force_media_change()
310 if (__invalidate_device(disk->part0, true)) in disk_force_media_change()
312 disk->disk_name); in disk_force_media_change()
313 set_bit(GD_NEED_PART_SCAN, &disk->state); in disk_force_media_change()
359 struct gendisk *disk = dev_to_disk(dev); in disk_events_show() local
361 if (!(disk->event_flags & DISK_EVENT_FLAG_UEVENT)) in disk_events_show()
363 return __disk_events_show(disk->events, buf); in disk_events_show()
376 struct gendisk *disk = dev_to_disk(dev); in disk_events_poll_msecs_show() local
378 if (!disk->ev) in disk_events_poll_msecs_show()
380 return sprintf(buf, "%ld\n", disk->ev->poll_msecs); in disk_events_poll_msecs_show()
387 struct gendisk *disk = dev_to_disk(dev); in disk_events_poll_msecs_store() local
396 if (!disk->ev) in disk_events_poll_msecs_store()
399 disk_block_events(disk); in disk_events_poll_msecs_store()
400 disk->ev->poll_msecs = intv; in disk_events_poll_msecs_store()
401 __disk_unblock_events(disk, true); in disk_events_poll_msecs_store()
428 disk_flush_events(ev->disk, 0); in disk_events_set_dfl_poll_msecs()
447 int disk_alloc_events(struct gendisk *disk) in disk_alloc_events() argument
451 if (!disk->fops->check_events || !disk->events) in disk_alloc_events()
456 pr_warn("%s: failed to initialize events\n", disk->disk_name); in disk_alloc_events()
461 ev->disk = disk; in disk_alloc_events()
468 disk->ev = ev; in disk_alloc_events()
472 void disk_add_events(struct gendisk *disk) in disk_add_events() argument
474 if (!disk->ev) in disk_add_events()
478 list_add_tail(&disk->ev->node, &disk_events); in disk_add_events()
485 __disk_unblock_events(disk, true); in disk_add_events()
488 void disk_del_events(struct gendisk *disk) in disk_del_events() argument
490 if (disk->ev) { in disk_del_events()
491 disk_block_events(disk); in disk_del_events()
494 list_del_init(&disk->ev->node); in disk_del_events()
499 void disk_release_events(struct gendisk *disk) in disk_release_events() argument
502 WARN_ON_ONCE(disk->ev && disk->ev->block != 1); in disk_release_events()
503 kfree(disk->ev); in disk_release_events()