diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:45:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:45:01 -0500 |
commit | 275220f0fcff1adf28a717076e00f575edf05fda (patch) | |
tree | d249bccc80c64443dab211639050c4fb14332648 /include/linux | |
parent | fe3c560b8a22cb28e54fe8950abef38e88d75831 (diff) | |
parent | 81c5e2ae33c4b19e53966b427e33646bf6811830 (diff) |
Merge branch 'for-2.6.38/core' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.38/core' of git://git.kernel.dk/linux-2.6-block: (43 commits)
block: ensure that completion error gets properly traced
blktrace: add missing probe argument to block_bio_complete
block cfq: don't use atomic_t for cfq_group
block cfq: don't use atomic_t for cfq_queue
block: trace event block fix unassigned field
block: add internal hd part table references
block: fix accounting bug on cross partition merges
kref: add kref_test_and_get
bio-integrity: mark kintegrityd_wq highpri and CPU intensive
block: make kblockd_workqueue smarter
Revert "sd: implement sd_check_events()"
block: Clean up exit_io_context() source code.
Fix compile warnings due to missing removal of a 'ret' variable
fs/block: type signature of major_to_index(int) to major_to_index(unsigned)
block: convert !IS_ERR(p) && p to !IS_ERR_NOR_NULL(p)
cfq-iosched: don't check cfqg in choose_service_tree()
fs/splice: Pull buf->ops->confirm() from splice_from_pipe actors
cdrom: export cdrom_check_events()
sd: implement sd_check_events()
sr: implement sr_check_events()
...
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/blkdev.h | 5 | ||||
-rw-r--r-- | include/linux/cdrom.h | 6 | ||||
-rw-r--r-- | include/linux/fs.h | 26 | ||||
-rw-r--r-- | include/linux/genhd.h | 45 |
4 files changed, 66 insertions, 16 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 36ab42c9bb99..4d18ff34670a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -115,6 +115,7 @@ struct request { | |||
115 | void *elevator_private3; | 115 | void *elevator_private3; |
116 | 116 | ||
117 | struct gendisk *rq_disk; | 117 | struct gendisk *rq_disk; |
118 | struct hd_struct *part; | ||
118 | unsigned long start_time; | 119 | unsigned long start_time; |
119 | #ifdef CONFIG_BLK_CGROUP | 120 | #ifdef CONFIG_BLK_CGROUP |
120 | unsigned long long start_time_ns; | 121 | unsigned long long start_time_ns; |
@@ -646,7 +647,6 @@ static inline void rq_flush_dcache_pages(struct request *rq) | |||
646 | 647 | ||
647 | extern int blk_register_queue(struct gendisk *disk); | 648 | extern int blk_register_queue(struct gendisk *disk); |
648 | extern void blk_unregister_queue(struct gendisk *disk); | 649 | extern void blk_unregister_queue(struct gendisk *disk); |
649 | extern void register_disk(struct gendisk *dev); | ||
650 | extern void generic_make_request(struct bio *bio); | 650 | extern void generic_make_request(struct bio *bio); |
651 | extern void blk_rq_init(struct request_queue *q, struct request *rq); | 651 | extern void blk_rq_init(struct request_queue *q, struct request *rq); |
652 | extern void blk_put_request(struct request *); | 652 | extern void blk_put_request(struct request *); |
@@ -1256,6 +1256,9 @@ struct block_device_operations { | |||
1256 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1256 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
1257 | int (*direct_access) (struct block_device *, sector_t, | 1257 | int (*direct_access) (struct block_device *, sector_t, |
1258 | void **, unsigned long *); | 1258 | void **, unsigned long *); |
1259 | unsigned int (*check_events) (struct gendisk *disk, | ||
1260 | unsigned int clearing); | ||
1261 | /* ->media_changed() is DEPRECATED, use ->check_events() instead */ | ||
1259 | int (*media_changed) (struct gendisk *); | 1262 | int (*media_changed) (struct gendisk *); |
1260 | void (*unlock_native_capacity) (struct gendisk *); | 1263 | void (*unlock_native_capacity) (struct gendisk *); |
1261 | int (*revalidate_disk) (struct gendisk *); | 1264 | int (*revalidate_disk) (struct gendisk *); |
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 78e904796622..35eae4b67503 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h | |||
@@ -946,6 +946,8 @@ struct cdrom_device_info { | |||
946 | /* device-related storage */ | 946 | /* device-related storage */ |
947 | unsigned int options : 30; /* options flags */ | 947 | unsigned int options : 30; /* options flags */ |
948 | unsigned mc_flags : 2; /* media change buffer flags */ | 948 | unsigned mc_flags : 2; /* media change buffer flags */ |
949 | unsigned int vfs_events; /* cached events for vfs path */ | ||
950 | unsigned int ioctl_events; /* cached events for ioctl path */ | ||
949 | int use_count; /* number of times device opened */ | 951 | int use_count; /* number of times device opened */ |
950 | char name[20]; /* name of the device type */ | 952 | char name[20]; /* name of the device type */ |
951 | /* per-device flags */ | 953 | /* per-device flags */ |
@@ -965,6 +967,8 @@ struct cdrom_device_ops { | |||
965 | int (*open) (struct cdrom_device_info *, int); | 967 | int (*open) (struct cdrom_device_info *, int); |
966 | void (*release) (struct cdrom_device_info *); | 968 | void (*release) (struct cdrom_device_info *); |
967 | int (*drive_status) (struct cdrom_device_info *, int); | 969 | int (*drive_status) (struct cdrom_device_info *, int); |
970 | unsigned int (*check_events) (struct cdrom_device_info *cdi, | ||
971 | unsigned int clearing, int slot); | ||
968 | int (*media_changed) (struct cdrom_device_info *, int); | 972 | int (*media_changed) (struct cdrom_device_info *, int); |
969 | int (*tray_move) (struct cdrom_device_info *, int); | 973 | int (*tray_move) (struct cdrom_device_info *, int); |
970 | int (*lock_door) (struct cdrom_device_info *, int); | 974 | int (*lock_door) (struct cdrom_device_info *, int); |
@@ -993,6 +997,8 @@ extern int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, | |||
993 | extern void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode); | 997 | extern void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode); |
994 | extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev, | 998 | extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev, |
995 | fmode_t mode, unsigned int cmd, unsigned long arg); | 999 | fmode_t mode, unsigned int cmd, unsigned long arg); |
1000 | extern unsigned int cdrom_check_events(struct cdrom_device_info *cdi, | ||
1001 | unsigned int clearing); | ||
996 | extern int cdrom_media_changed(struct cdrom_device_info *); | 1002 | extern int cdrom_media_changed(struct cdrom_device_info *); |
997 | 1003 | ||
998 | extern int register_cdrom(struct cdrom_device_info *cdi); | 1004 | extern int register_cdrom(struct cdrom_device_info *cdi); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index c0701288d204..3984f2358d1f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -664,8 +664,9 @@ struct block_device { | |||
664 | void * bd_claiming; | 664 | void * bd_claiming; |
665 | void * bd_holder; | 665 | void * bd_holder; |
666 | int bd_holders; | 666 | int bd_holders; |
667 | bool bd_write_holder; | ||
667 | #ifdef CONFIG_SYSFS | 668 | #ifdef CONFIG_SYSFS |
668 | struct list_head bd_holder_list; | 669 | struct gendisk * bd_holder_disk; /* for sysfs slave linkng */ |
669 | #endif | 670 | #endif |
670 | struct block_device * bd_contains; | 671 | struct block_device * bd_contains; |
671 | unsigned bd_block_size; | 672 | unsigned bd_block_size; |
@@ -2019,7 +2020,6 @@ extern struct block_device *bdgrab(struct block_device *bdev); | |||
2019 | extern void bd_set_size(struct block_device *, loff_t size); | 2020 | extern void bd_set_size(struct block_device *, loff_t size); |
2020 | extern void bd_forget(struct inode *inode); | 2021 | extern void bd_forget(struct inode *inode); |
2021 | extern void bdput(struct block_device *); | 2022 | extern void bdput(struct block_device *); |
2022 | extern struct block_device *open_by_devnum(dev_t, fmode_t); | ||
2023 | extern void invalidate_bdev(struct block_device *); | 2023 | extern void invalidate_bdev(struct block_device *); |
2024 | extern int sync_blockdev(struct block_device *bdev); | 2024 | extern int sync_blockdev(struct block_device *bdev); |
2025 | extern struct super_block *freeze_bdev(struct block_device *); | 2025 | extern struct super_block *freeze_bdev(struct block_device *); |
@@ -2050,16 +2050,20 @@ extern const struct file_operations def_fifo_fops; | |||
2050 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); | 2050 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); |
2051 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); | 2051 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); |
2052 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); | 2052 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); |
2053 | extern int blkdev_get(struct block_device *, fmode_t); | 2053 | extern int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder); |
2054 | extern int blkdev_put(struct block_device *, fmode_t); | 2054 | extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, |
2055 | extern int bd_claim(struct block_device *, void *); | 2055 | void *holder); |
2056 | extern void bd_release(struct block_device *); | 2056 | extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, |
2057 | void *holder); | ||
2058 | extern int blkdev_put(struct block_device *bdev, fmode_t mode); | ||
2057 | #ifdef CONFIG_SYSFS | 2059 | #ifdef CONFIG_SYSFS |
2058 | extern int bd_claim_by_disk(struct block_device *, void *, struct gendisk *); | 2060 | extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); |
2059 | extern void bd_release_from_disk(struct block_device *, struct gendisk *); | ||
2060 | #else | 2061 | #else |
2061 | #define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder) | 2062 | static inline int bd_link_disk_holder(struct block_device *bdev, |
2062 | #define bd_release_from_disk(bdev, disk) bd_release(bdev) | 2063 | struct gendisk *disk) |
2064 | { | ||
2065 | return 0; | ||
2066 | } | ||
2063 | #endif | 2067 | #endif |
2064 | #endif | 2068 | #endif |
2065 | 2069 | ||
@@ -2095,8 +2099,6 @@ static inline void unregister_chrdev(unsigned int major, const char *name) | |||
2095 | extern const char *__bdevname(dev_t, char *buffer); | 2099 | extern const char *__bdevname(dev_t, char *buffer); |
2096 | extern const char *bdevname(struct block_device *bdev, char *buffer); | 2100 | extern const char *bdevname(struct block_device *bdev, char *buffer); |
2097 | extern struct block_device *lookup_bdev(const char *); | 2101 | extern struct block_device *lookup_bdev(const char *); |
2098 | extern struct block_device *open_bdev_exclusive(const char *, fmode_t, void *); | ||
2099 | extern void close_bdev_exclusive(struct block_device *, fmode_t); | ||
2100 | extern void blkdev_show(struct seq_file *,off_t); | 2102 | extern void blkdev_show(struct seq_file *,off_t); |
2101 | 2103 | ||
2102 | #else | 2104 | #else |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 7a7b9c1644e4..c0d5f6945c1e 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -115,6 +115,7 @@ struct hd_struct { | |||
115 | #else | 115 | #else |
116 | struct disk_stats dkstats; | 116 | struct disk_stats dkstats; |
117 | #endif | 117 | #endif |
118 | atomic_t ref; | ||
118 | struct rcu_head rcu_head; | 119 | struct rcu_head rcu_head; |
119 | }; | 120 | }; |
120 | 121 | ||
@@ -127,6 +128,11 @@ struct hd_struct { | |||
127 | #define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ | 128 | #define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ |
128 | #define GENHD_FL_NATIVE_CAPACITY 128 | 129 | #define GENHD_FL_NATIVE_CAPACITY 128 |
129 | 130 | ||
131 | enum { | ||
132 | DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */ | ||
133 | DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */ | ||
134 | }; | ||
135 | |||
130 | #define BLK_SCSI_MAX_CMDS (256) | 136 | #define BLK_SCSI_MAX_CMDS (256) |
131 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | 137 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) |
132 | 138 | ||
@@ -143,6 +149,8 @@ struct disk_part_tbl { | |||
143 | struct hd_struct __rcu *part[]; | 149 | struct hd_struct __rcu *part[]; |
144 | }; | 150 | }; |
145 | 151 | ||
152 | struct disk_events; | ||
153 | |||
146 | struct gendisk { | 154 | struct gendisk { |
147 | /* major, first_minor and minors are input parameters only, | 155 | /* major, first_minor and minors are input parameters only, |
148 | * don't use directly. Use disk_devt() and disk_max_parts(). | 156 | * don't use directly. Use disk_devt() and disk_max_parts(). |
@@ -154,6 +162,10 @@ struct gendisk { | |||
154 | 162 | ||
155 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ | 163 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ |
156 | char *(*devnode)(struct gendisk *gd, mode_t *mode); | 164 | char *(*devnode)(struct gendisk *gd, mode_t *mode); |
165 | |||
166 | unsigned int events; /* supported events */ | ||
167 | unsigned int async_events; /* async events, subset of all */ | ||
168 | |||
157 | /* Array of pointers to partitions indexed by partno. | 169 | /* Array of pointers to partitions indexed by partno. |
158 | * Protected with matching bdev lock but stat and other | 170 | * Protected with matching bdev lock but stat and other |
159 | * non-critical accesses use RCU. Always access through | 171 | * non-critical accesses use RCU. Always access through |
@@ -171,9 +183,8 @@ struct gendisk { | |||
171 | struct kobject *slave_dir; | 183 | struct kobject *slave_dir; |
172 | 184 | ||
173 | struct timer_rand_state *random; | 185 | struct timer_rand_state *random; |
174 | |||
175 | atomic_t sync_io; /* RAID */ | 186 | atomic_t sync_io; /* RAID */ |
176 | struct work_struct async_notify; | 187 | struct disk_events *ev; |
177 | #ifdef CONFIG_BLK_DEV_INTEGRITY | 188 | #ifdef CONFIG_BLK_DEV_INTEGRITY |
178 | struct blk_integrity *integrity; | 189 | struct blk_integrity *integrity; |
179 | #endif | 190 | #endif |
@@ -395,7 +406,6 @@ extern void part_round_stats(int cpu, struct hd_struct *part); | |||
395 | /* block/genhd.c */ | 406 | /* block/genhd.c */ |
396 | extern void add_disk(struct gendisk *disk); | 407 | extern void add_disk(struct gendisk *disk); |
397 | extern void del_gendisk(struct gendisk *gp); | 408 | extern void del_gendisk(struct gendisk *gp); |
398 | extern void unlink_gendisk(struct gendisk *gp); | ||
399 | extern struct gendisk *get_gendisk(dev_t dev, int *partno); | 409 | extern struct gendisk *get_gendisk(dev_t dev, int *partno); |
400 | extern struct block_device *bdget_disk(struct gendisk *disk, int partno); | 410 | extern struct block_device *bdget_disk(struct gendisk *disk, int partno); |
401 | 411 | ||
@@ -407,6 +417,11 @@ static inline int get_disk_ro(struct gendisk *disk) | |||
407 | return disk->part0.policy; | 417 | return disk->part0.policy; |
408 | } | 418 | } |
409 | 419 | ||
420 | extern void disk_block_events(struct gendisk *disk); | ||
421 | extern void disk_unblock_events(struct gendisk *disk); | ||
422 | extern void disk_check_events(struct gendisk *disk); | ||
423 | extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask); | ||
424 | |||
410 | /* drivers/char/random.c */ | 425 | /* drivers/char/random.c */ |
411 | extern void add_disk_randomness(struct gendisk *disk); | 426 | extern void add_disk_randomness(struct gendisk *disk); |
412 | extern void rand_initialize_disk(struct gendisk *disk); | 427 | extern void rand_initialize_disk(struct gendisk *disk); |
@@ -583,6 +598,7 @@ extern struct hd_struct * __must_check add_partition(struct gendisk *disk, | |||
583 | sector_t len, int flags, | 598 | sector_t len, int flags, |
584 | struct partition_meta_info | 599 | struct partition_meta_info |
585 | *info); | 600 | *info); |
601 | extern void __delete_partition(struct hd_struct *); | ||
586 | extern void delete_partition(struct gendisk *, int); | 602 | extern void delete_partition(struct gendisk *, int); |
587 | extern void printk_all_partitions(void); | 603 | extern void printk_all_partitions(void); |
588 | 604 | ||
@@ -611,6 +627,29 @@ extern ssize_t part_fail_store(struct device *dev, | |||
611 | const char *buf, size_t count); | 627 | const char *buf, size_t count); |
612 | #endif /* CONFIG_FAIL_MAKE_REQUEST */ | 628 | #endif /* CONFIG_FAIL_MAKE_REQUEST */ |
613 | 629 | ||
630 | static inline void hd_ref_init(struct hd_struct *part) | ||
631 | { | ||
632 | atomic_set(&part->ref, 1); | ||
633 | smp_mb(); | ||
634 | } | ||
635 | |||
636 | static inline void hd_struct_get(struct hd_struct *part) | ||
637 | { | ||
638 | atomic_inc(&part->ref); | ||
639 | smp_mb__after_atomic_inc(); | ||
640 | } | ||
641 | |||
642 | static inline int hd_struct_try_get(struct hd_struct *part) | ||
643 | { | ||
644 | return atomic_inc_not_zero(&part->ref); | ||
645 | } | ||
646 | |||
647 | static inline void hd_struct_put(struct hd_struct *part) | ||
648 | { | ||
649 | if (atomic_dec_and_test(&part->ref)) | ||
650 | __delete_partition(part); | ||
651 | } | ||
652 | |||
614 | #else /* CONFIG_BLOCK */ | 653 | #else /* CONFIG_BLOCK */ |
615 | 654 | ||
616 | static inline void printk_all_partitions(void) { } | 655 | static inline void printk_all_partitions(void) { } |