diff options
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index a92d9e4ea96e..a135256b272c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -87,7 +87,9 @@ enum { | |||
87 | */ | 87 | */ |
88 | enum rq_flag_bits { | 88 | enum rq_flag_bits { |
89 | __REQ_RW, /* not set, read. set, write */ | 89 | __REQ_RW, /* not set, read. set, write */ |
90 | __REQ_FAILFAST, /* no low level driver retries */ | 90 | __REQ_FAILFAST_DEV, /* no driver retries of device errors */ |
91 | __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */ | ||
92 | __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */ | ||
91 | __REQ_DISCARD, /* request to discard sectors */ | 93 | __REQ_DISCARD, /* request to discard sectors */ |
92 | __REQ_SORTED, /* elevator knows about this request */ | 94 | __REQ_SORTED, /* elevator knows about this request */ |
93 | __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ | 95 | __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ |
@@ -111,8 +113,10 @@ enum rq_flag_bits { | |||
111 | }; | 113 | }; |
112 | 114 | ||
113 | #define REQ_RW (1 << __REQ_RW) | 115 | #define REQ_RW (1 << __REQ_RW) |
116 | #define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV) | ||
117 | #define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT) | ||
118 | #define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER) | ||
114 | #define REQ_DISCARD (1 << __REQ_DISCARD) | 119 | #define REQ_DISCARD (1 << __REQ_DISCARD) |
115 | #define REQ_FAILFAST (1 << __REQ_FAILFAST) | ||
116 | #define REQ_SORTED (1 << __REQ_SORTED) | 120 | #define REQ_SORTED (1 << __REQ_SORTED) |
117 | #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) | 121 | #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) |
118 | #define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) | 122 | #define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) |
@@ -560,7 +564,12 @@ enum { | |||
560 | #define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) | 564 | #define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) |
561 | #define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) | 565 | #define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) |
562 | 566 | ||
563 | #define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST) | 567 | #define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV) |
568 | #define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT) | ||
569 | #define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER) | ||
570 | #define blk_noretry_request(rq) (blk_failfast_dev(rq) || \ | ||
571 | blk_failfast_transport(rq) || \ | ||
572 | blk_failfast_driver(rq)) | ||
564 | #define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) | 573 | #define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) |
565 | 574 | ||
566 | #define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq))) | 575 | #define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq))) |
@@ -708,10 +717,10 @@ extern void blk_plug_device(struct request_queue *); | |||
708 | extern void blk_plug_device_unlocked(struct request_queue *); | 717 | extern void blk_plug_device_unlocked(struct request_queue *); |
709 | extern int blk_remove_plug(struct request_queue *); | 718 | extern int blk_remove_plug(struct request_queue *); |
710 | extern void blk_recount_segments(struct request_queue *, struct bio *); | 719 | extern void blk_recount_segments(struct request_queue *, struct bio *); |
711 | extern int scsi_cmd_ioctl(struct file *, struct request_queue *, | 720 | extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
712 | struct gendisk *, unsigned int, void __user *); | 721 | unsigned int, void __user *); |
713 | extern int sg_scsi_ioctl(struct file *, struct request_queue *, | 722 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
714 | struct gendisk *, struct scsi_ioctl_command __user *); | 723 | struct scsi_ioctl_command __user *); |
715 | 724 | ||
716 | /* | 725 | /* |
717 | * Temporary export, until SCSI gets fixed up. | 726 | * Temporary export, until SCSI gets fixed up. |
@@ -856,7 +865,6 @@ extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int); | |||
856 | extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); | 865 | extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); |
857 | extern void blk_dump_rq_flags(struct request *, char *); | 866 | extern void blk_dump_rq_flags(struct request *, char *); |
858 | extern void generic_unplug_device(struct request_queue *); | 867 | extern void generic_unplug_device(struct request_queue *); |
859 | extern void __generic_unplug_device(struct request_queue *); | ||
860 | extern long nr_blockdev_pages(void); | 868 | extern long nr_blockdev_pages(void); |
861 | 869 | ||
862 | int blk_get_queue(struct request_queue *); | 870 | int blk_get_queue(struct request_queue *); |
@@ -902,7 +910,8 @@ static inline int sb_issue_discard(struct super_block *sb, | |||
902 | * command filter functions | 910 | * command filter functions |
903 | */ | 911 | */ |
904 | extern int blk_verify_command(struct blk_cmd_filter *filter, | 912 | extern int blk_verify_command(struct blk_cmd_filter *filter, |
905 | unsigned char *cmd, int has_write_perm); | 913 | unsigned char *cmd, fmode_t has_write_perm); |
914 | extern void blk_unregister_filter(struct gendisk *disk); | ||
906 | extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); | 915 | extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); |
907 | 916 | ||
908 | #define MAX_PHYS_SEGMENTS 128 | 917 | #define MAX_PHYS_SEGMENTS 128 |
@@ -1048,6 +1057,22 @@ static inline int blk_integrity_rq(struct request *rq) | |||
1048 | 1057 | ||
1049 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | 1058 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
1050 | 1059 | ||
1060 | struct block_device_operations { | ||
1061 | int (*open) (struct block_device *, fmode_t); | ||
1062 | int (*release) (struct gendisk *, fmode_t); | ||
1063 | int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
1064 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
1065 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
1066 | int (*direct_access) (struct block_device *, sector_t, | ||
1067 | void **, unsigned long *); | ||
1068 | int (*media_changed) (struct gendisk *); | ||
1069 | int (*revalidate_disk) (struct gendisk *); | ||
1070 | int (*getgeo)(struct block_device *, struct hd_geometry *); | ||
1071 | struct module *owner; | ||
1072 | }; | ||
1073 | |||
1074 | extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, | ||
1075 | unsigned long); | ||
1051 | #else /* CONFIG_BLOCK */ | 1076 | #else /* CONFIG_BLOCK */ |
1052 | /* | 1077 | /* |
1053 | * stubs for when the block layer is configured out | 1078 | * stubs for when the block layer is configured out |