diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 16:15:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 16:15:14 -0400 |
commit | dddec01eb8e2b56267b37a6f9f0997a64b4e0b2a (patch) | |
tree | b6d8bfbce9abd105384b9d116499afbe306b9c22 /include | |
parent | 7daf705f362e349983e92037a198b8821db198af (diff) | |
parent | 32502b8413a77b54b9e19809404109590c32dfb7 (diff) |
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: (37 commits)
splice: fix generic_file_splice_read() race with page invalidation
ramfs: enable splice write
drivers/block/pktcdvd.c: avoid useless memset
cdrom: revert commit 22a9189 (cdrom: use kmalloced buffers instead of buffers on stack)
scsi: sr avoids useless buffer allocation
block: blk_rq_map_kern uses the bounce buffers for stack buffers
block: add blk_queue_update_dma_pad
DAC960: push down BKL
pktcdvd: push BKL down into driver
paride: push ioctl down into driver
block: use get_unaligned_* helpers
block: extend queue_flag bitops
block: request_module(): use format string
Add bvec_merge_data to handle stacked devices and ->merge_bvec()
block: integrity flags can't use bit ops on unsigned short
cmdfilter: extend default read filter
sg: fix odd style (extra parenthesis) introduced by cmd filter patch
block: add bounce support to blk_rq_map_user_iov
cfq-iosched: get rid of enable_idle being unused warning
allow userspace to modify scsi command filter on per device basis
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/bio.h | 130 | ||||
-rw-r--r-- | include/linux/blkdev.h | 163 | ||||
-rw-r--r-- | include/linux/blktrace_api.h | 1 | ||||
-rw-r--r-- | include/linux/genhd.h | 12 | ||||
-rw-r--r-- | include/linux/iocontext.h | 18 |
5 files changed, 301 insertions, 23 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 61c15eaf3fb3..0933a14e6414 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -64,6 +64,7 @@ struct bio_vec { | |||
64 | 64 | ||
65 | struct bio_set; | 65 | struct bio_set; |
66 | struct bio; | 66 | struct bio; |
67 | struct bio_integrity_payload; | ||
67 | typedef void (bio_end_io_t) (struct bio *, int); | 68 | typedef void (bio_end_io_t) (struct bio *, int); |
68 | typedef void (bio_destructor_t) (struct bio *); | 69 | typedef void (bio_destructor_t) (struct bio *); |
69 | 70 | ||
@@ -112,6 +113,9 @@ struct bio { | |||
112 | atomic_t bi_cnt; /* pin count */ | 113 | atomic_t bi_cnt; /* pin count */ |
113 | 114 | ||
114 | void *bi_private; | 115 | void *bi_private; |
116 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
117 | struct bio_integrity_payload *bi_integrity; /* data integrity */ | ||
118 | #endif | ||
115 | 119 | ||
116 | bio_destructor_t *bi_destructor; /* destructor */ | 120 | bio_destructor_t *bi_destructor; /* destructor */ |
117 | }; | 121 | }; |
@@ -271,6 +275,29 @@ static inline void *bio_data(struct bio *bio) | |||
271 | */ | 275 | */ |
272 | #define bio_get(bio) atomic_inc(&(bio)->bi_cnt) | 276 | #define bio_get(bio) atomic_inc(&(bio)->bi_cnt) |
273 | 277 | ||
278 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
279 | /* | ||
280 | * bio integrity payload | ||
281 | */ | ||
282 | struct bio_integrity_payload { | ||
283 | struct bio *bip_bio; /* parent bio */ | ||
284 | struct bio_vec *bip_vec; /* integrity data vector */ | ||
285 | |||
286 | sector_t bip_sector; /* virtual start sector */ | ||
287 | |||
288 | void *bip_buf; /* generated integrity data */ | ||
289 | bio_end_io_t *bip_end_io; /* saved I/O completion fn */ | ||
290 | |||
291 | int bip_error; /* saved I/O error */ | ||
292 | unsigned int bip_size; | ||
293 | |||
294 | unsigned short bip_pool; /* pool the ivec came from */ | ||
295 | unsigned short bip_vcnt; /* # of integrity bio_vecs */ | ||
296 | unsigned short bip_idx; /* current bip_vec index */ | ||
297 | |||
298 | struct work_struct bip_work; /* I/O completion */ | ||
299 | }; | ||
300 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | ||
274 | 301 | ||
275 | /* | 302 | /* |
276 | * A bio_pair is used when we need to split a bio. | 303 | * A bio_pair is used when we need to split a bio. |
@@ -283,10 +310,14 @@ static inline void *bio_data(struct bio *bio) | |||
283 | * in bio2.bi_private | 310 | * in bio2.bi_private |
284 | */ | 311 | */ |
285 | struct bio_pair { | 312 | struct bio_pair { |
286 | struct bio bio1, bio2; | 313 | struct bio bio1, bio2; |
287 | struct bio_vec bv1, bv2; | 314 | struct bio_vec bv1, bv2; |
288 | atomic_t cnt; | 315 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
289 | int error; | 316 | struct bio_integrity_payload bip1, bip2; |
317 | struct bio_vec iv1, iv2; | ||
318 | #endif | ||
319 | atomic_t cnt; | ||
320 | int error; | ||
290 | }; | 321 | }; |
291 | extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, | 322 | extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, |
292 | int first_sectors); | 323 | int first_sectors); |
@@ -333,6 +364,39 @@ extern struct bio *bio_copy_user_iov(struct request_queue *, struct sg_iovec *, | |||
333 | int, int); | 364 | int, int); |
334 | extern int bio_uncopy_user(struct bio *); | 365 | extern int bio_uncopy_user(struct bio *); |
335 | void zero_fill_bio(struct bio *bio); | 366 | void zero_fill_bio(struct bio *bio); |
367 | extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); | ||
368 | extern unsigned int bvec_nr_vecs(unsigned short idx); | ||
369 | |||
370 | /* | ||
371 | * bio_set is used to allow other portions of the IO system to | ||
372 | * allocate their own private memory pools for bio and iovec structures. | ||
373 | * These memory pools in turn all allocate from the bio_slab | ||
374 | * and the bvec_slabs[]. | ||
375 | */ | ||
376 | #define BIO_POOL_SIZE 2 | ||
377 | #define BIOVEC_NR_POOLS 6 | ||
378 | |||
379 | struct bio_set { | ||
380 | mempool_t *bio_pool; | ||
381 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
382 | mempool_t *bio_integrity_pool; | ||
383 | #endif | ||
384 | mempool_t *bvec_pools[BIOVEC_NR_POOLS]; | ||
385 | }; | ||
386 | |||
387 | struct biovec_slab { | ||
388 | int nr_vecs; | ||
389 | char *name; | ||
390 | struct kmem_cache *slab; | ||
391 | }; | ||
392 | |||
393 | extern struct bio_set *fs_bio_set; | ||
394 | |||
395 | /* | ||
396 | * a small number of entries is fine, not going to be performance critical. | ||
397 | * basically we just need to survive | ||
398 | */ | ||
399 | #define BIO_SPLIT_ENTRIES 2 | ||
336 | 400 | ||
337 | #ifdef CONFIG_HIGHMEM | 401 | #ifdef CONFIG_HIGHMEM |
338 | /* | 402 | /* |
@@ -381,5 +445,63 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, | |||
381 | __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) | 445 | __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) |
382 | #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) | 446 | #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) |
383 | 447 | ||
448 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
449 | |||
450 | #define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) | ||
451 | #define bip_vec(bip) bip_vec_idx(bip, 0) | ||
452 | |||
453 | #define __bip_for_each_vec(bvl, bip, i, start_idx) \ | ||
454 | for (bvl = bip_vec_idx((bip), (start_idx)), i = (start_idx); \ | ||
455 | i < (bip)->bip_vcnt; \ | ||
456 | bvl++, i++) | ||
457 | |||
458 | #define bip_for_each_vec(bvl, bip, i) \ | ||
459 | __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx) | ||
460 | |||
461 | static inline int bio_integrity(struct bio *bio) | ||
462 | { | ||
463 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
464 | return bio->bi_integrity != NULL; | ||
465 | #else | ||
466 | return 0; | ||
467 | #endif | ||
468 | } | ||
469 | |||
470 | extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *); | ||
471 | extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); | ||
472 | extern void bio_integrity_free(struct bio *, struct bio_set *); | ||
473 | extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); | ||
474 | extern int bio_integrity_enabled(struct bio *bio); | ||
475 | extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); | ||
476 | extern int bio_integrity_get_tag(struct bio *, void *, unsigned int); | ||
477 | extern int bio_integrity_prep(struct bio *); | ||
478 | extern void bio_integrity_endio(struct bio *, int); | ||
479 | extern void bio_integrity_advance(struct bio *, unsigned int); | ||
480 | extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); | ||
481 | extern void bio_integrity_split(struct bio *, struct bio_pair *, int); | ||
482 | extern int bio_integrity_clone(struct bio *, struct bio *, struct bio_set *); | ||
483 | extern int bioset_integrity_create(struct bio_set *, int); | ||
484 | extern void bioset_integrity_free(struct bio_set *); | ||
485 | extern void bio_integrity_init_slab(void); | ||
486 | |||
487 | #else /* CONFIG_BLK_DEV_INTEGRITY */ | ||
488 | |||
489 | #define bio_integrity(a) (0) | ||
490 | #define bioset_integrity_create(a, b) (0) | ||
491 | #define bio_integrity_prep(a) (0) | ||
492 | #define bio_integrity_enabled(a) (0) | ||
493 | #define bio_integrity_clone(a, b, c) (0) | ||
494 | #define bioset_integrity_free(a) do { } while (0) | ||
495 | #define bio_integrity_free(a, b) do { } while (0) | ||
496 | #define bio_integrity_endio(a, b) do { } while (0) | ||
497 | #define bio_integrity_advance(a, b) do { } while (0) | ||
498 | #define bio_integrity_trim(a, b, c) do { } while (0) | ||
499 | #define bio_integrity_split(a, b, c) do { } while (0) | ||
500 | #define bio_integrity_set_tag(a, b, c) do { } while (0) | ||
501 | #define bio_integrity_get_tag(a, b, c) do { } while (0) | ||
502 | #define bio_integrity_init_slab(a) do { } while (0) | ||
503 | |||
504 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | ||
505 | |||
384 | #endif /* CONFIG_BLOCK */ | 506 | #endif /* CONFIG_BLOCK */ |
385 | #endif /* __LINUX_BIO_H */ | 507 | #endif /* __LINUX_BIO_H */ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index d2a1b71e93c3..1ffd8bfdc4c9 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -23,7 +23,6 @@ | |||
23 | struct scsi_ioctl_command; | 23 | struct scsi_ioctl_command; |
24 | 24 | ||
25 | struct request_queue; | 25 | struct request_queue; |
26 | typedef struct request_queue request_queue_t __deprecated; | ||
27 | struct elevator_queue; | 26 | struct elevator_queue; |
28 | typedef struct elevator_queue elevator_t; | 27 | typedef struct elevator_queue elevator_t; |
29 | struct request_pm_state; | 28 | struct request_pm_state; |
@@ -34,12 +33,6 @@ struct sg_io_hdr; | |||
34 | #define BLKDEV_MIN_RQ 4 | 33 | #define BLKDEV_MIN_RQ 4 |
35 | #define BLKDEV_MAX_RQ 128 /* Default maximum */ | 34 | #define BLKDEV_MAX_RQ 128 /* Default maximum */ |
36 | 35 | ||
37 | int put_io_context(struct io_context *ioc); | ||
38 | void exit_io_context(void); | ||
39 | struct io_context *get_io_context(gfp_t gfp_flags, int node); | ||
40 | struct io_context *alloc_io_context(gfp_t gfp_flags, int node); | ||
41 | void copy_io_context(struct io_context **pdst, struct io_context **psrc); | ||
42 | |||
43 | struct request; | 36 | struct request; |
44 | typedef void (rq_end_io_fn)(struct request *, int); | 37 | typedef void (rq_end_io_fn)(struct request *, int); |
45 | 38 | ||
@@ -113,6 +106,7 @@ enum rq_flag_bits { | |||
113 | __REQ_ALLOCED, /* request came from our alloc pool */ | 106 | __REQ_ALLOCED, /* request came from our alloc pool */ |
114 | __REQ_RW_META, /* metadata io request */ | 107 | __REQ_RW_META, /* metadata io request */ |
115 | __REQ_COPY_USER, /* contains copies of user pages */ | 108 | __REQ_COPY_USER, /* contains copies of user pages */ |
109 | __REQ_INTEGRITY, /* integrity metadata has been remapped */ | ||
116 | __REQ_NR_BITS, /* stops here */ | 110 | __REQ_NR_BITS, /* stops here */ |
117 | }; | 111 | }; |
118 | 112 | ||
@@ -135,6 +129,7 @@ enum rq_flag_bits { | |||
135 | #define REQ_ALLOCED (1 << __REQ_ALLOCED) | 129 | #define REQ_ALLOCED (1 << __REQ_ALLOCED) |
136 | #define REQ_RW_META (1 << __REQ_RW_META) | 130 | #define REQ_RW_META (1 << __REQ_RW_META) |
137 | #define REQ_COPY_USER (1 << __REQ_COPY_USER) | 131 | #define REQ_COPY_USER (1 << __REQ_COPY_USER) |
132 | #define REQ_INTEGRITY (1 << __REQ_INTEGRITY) | ||
138 | 133 | ||
139 | #define BLK_MAX_CDB 16 | 134 | #define BLK_MAX_CDB 16 |
140 | 135 | ||
@@ -259,7 +254,14 @@ typedef int (prep_rq_fn) (struct request_queue *, struct request *); | |||
259 | typedef void (unplug_fn) (struct request_queue *); | 254 | typedef void (unplug_fn) (struct request_queue *); |
260 | 255 | ||
261 | struct bio_vec; | 256 | struct bio_vec; |
262 | typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *); | 257 | struct bvec_merge_data { |
258 | struct block_device *bi_bdev; | ||
259 | sector_t bi_sector; | ||
260 | unsigned bi_size; | ||
261 | unsigned long bi_rw; | ||
262 | }; | ||
263 | typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *, | ||
264 | struct bio_vec *); | ||
263 | typedef void (prepare_flush_fn) (struct request_queue *, struct request *); | 265 | typedef void (prepare_flush_fn) (struct request_queue *, struct request *); |
264 | typedef void (softirq_done_fn)(struct request *); | 266 | typedef void (softirq_done_fn)(struct request *); |
265 | typedef int (dma_drain_needed_fn)(struct request *); | 267 | typedef int (dma_drain_needed_fn)(struct request *); |
@@ -426,6 +428,32 @@ static inline void queue_flag_set_unlocked(unsigned int flag, | |||
426 | __set_bit(flag, &q->queue_flags); | 428 | __set_bit(flag, &q->queue_flags); |
427 | } | 429 | } |
428 | 430 | ||
431 | static inline int queue_flag_test_and_clear(unsigned int flag, | ||
432 | struct request_queue *q) | ||
433 | { | ||
434 | WARN_ON_ONCE(!queue_is_locked(q)); | ||
435 | |||
436 | if (test_bit(flag, &q->queue_flags)) { | ||
437 | __clear_bit(flag, &q->queue_flags); | ||
438 | return 1; | ||
439 | } | ||
440 | |||
441 | return 0; | ||
442 | } | ||
443 | |||
444 | static inline int queue_flag_test_and_set(unsigned int flag, | ||
445 | struct request_queue *q) | ||
446 | { | ||
447 | WARN_ON_ONCE(!queue_is_locked(q)); | ||
448 | |||
449 | if (!test_bit(flag, &q->queue_flags)) { | ||
450 | __set_bit(flag, &q->queue_flags); | ||
451 | return 0; | ||
452 | } | ||
453 | |||
454 | return 1; | ||
455 | } | ||
456 | |||
429 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) | 457 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) |
430 | { | 458 | { |
431 | WARN_ON_ONCE(!queue_is_locked(q)); | 459 | WARN_ON_ONCE(!queue_is_locked(q)); |
@@ -676,7 +704,6 @@ extern int blk_execute_rq(struct request_queue *, struct gendisk *, | |||
676 | struct request *, int); | 704 | struct request *, int); |
677 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, | 705 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, |
678 | struct request *, int, rq_end_io_fn *); | 706 | struct request *, int, rq_end_io_fn *); |
679 | extern int blk_verify_command(unsigned char *, int); | ||
680 | extern void blk_unplug(struct request_queue *q); | 707 | extern void blk_unplug(struct request_queue *q); |
681 | 708 | ||
682 | static inline struct request_queue *bdev_get_queue(struct block_device *bdev) | 709 | static inline struct request_queue *bdev_get_queue(struct block_device *bdev) |
@@ -749,6 +776,7 @@ extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); | |||
749 | extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); | 776 | extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); |
750 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); | 777 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); |
751 | extern void blk_queue_dma_pad(struct request_queue *, unsigned int); | 778 | extern void blk_queue_dma_pad(struct request_queue *, unsigned int); |
779 | extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int); | ||
752 | extern int blk_queue_dma_drain(struct request_queue *q, | 780 | extern int blk_queue_dma_drain(struct request_queue *q, |
753 | dma_drain_needed_fn *dma_drain_needed, | 781 | dma_drain_needed_fn *dma_drain_needed, |
754 | void *buf, unsigned int size); | 782 | void *buf, unsigned int size); |
@@ -802,6 +830,15 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, | |||
802 | 830 | ||
803 | extern int blkdev_issue_flush(struct block_device *, sector_t *); | 831 | extern int blkdev_issue_flush(struct block_device *, sector_t *); |
804 | 832 | ||
833 | /* | ||
834 | * command filter functions | ||
835 | */ | ||
836 | extern int blk_verify_command(struct file *file, unsigned char *cmd); | ||
837 | extern int blk_cmd_filter_verify_command(struct blk_scsi_cmd_filter *filter, | ||
838 | unsigned char *cmd, mode_t *f_mode); | ||
839 | extern int blk_register_filter(struct gendisk *disk); | ||
840 | extern void blk_unregister_filter(struct gendisk *disk); | ||
841 | |||
805 | #define MAX_PHYS_SEGMENTS 128 | 842 | #define MAX_PHYS_SEGMENTS 128 |
806 | #define MAX_HW_SEGMENTS 128 | 843 | #define MAX_HW_SEGMENTS 128 |
807 | #define SAFE_MAX_SECTORS 255 | 844 | #define SAFE_MAX_SECTORS 255 |
@@ -865,28 +902,116 @@ void kblockd_flush_work(struct work_struct *work); | |||
865 | #define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ | 902 | #define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ |
866 | MODULE_ALIAS("block-major-" __stringify(major) "-*") | 903 | MODULE_ALIAS("block-major-" __stringify(major) "-*") |
867 | 904 | ||
905 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
868 | 906 | ||
869 | #else /* CONFIG_BLOCK */ | 907 | #define INTEGRITY_FLAG_READ 2 /* verify data integrity on read */ |
870 | /* | 908 | #define INTEGRITY_FLAG_WRITE 4 /* generate data integrity on write */ |
871 | * stubs for when the block layer is configured out | ||
872 | */ | ||
873 | #define buffer_heads_over_limit 0 | ||
874 | 909 | ||
875 | static inline long nr_blockdev_pages(void) | 910 | struct blk_integrity_exchg { |
911 | void *prot_buf; | ||
912 | void *data_buf; | ||
913 | sector_t sector; | ||
914 | unsigned int data_size; | ||
915 | unsigned short sector_size; | ||
916 | const char *disk_name; | ||
917 | }; | ||
918 | |||
919 | typedef void (integrity_gen_fn) (struct blk_integrity_exchg *); | ||
920 | typedef int (integrity_vrfy_fn) (struct blk_integrity_exchg *); | ||
921 | typedef void (integrity_set_tag_fn) (void *, void *, unsigned int); | ||
922 | typedef void (integrity_get_tag_fn) (void *, void *, unsigned int); | ||
923 | |||
924 | struct blk_integrity { | ||
925 | integrity_gen_fn *generate_fn; | ||
926 | integrity_vrfy_fn *verify_fn; | ||
927 | integrity_set_tag_fn *set_tag_fn; | ||
928 | integrity_get_tag_fn *get_tag_fn; | ||
929 | |||
930 | unsigned short flags; | ||
931 | unsigned short tuple_size; | ||
932 | unsigned short sector_size; | ||
933 | unsigned short tag_size; | ||
934 | |||
935 | const char *name; | ||
936 | |||
937 | struct kobject kobj; | ||
938 | }; | ||
939 | |||
940 | extern int blk_integrity_register(struct gendisk *, struct blk_integrity *); | ||
941 | extern void blk_integrity_unregister(struct gendisk *); | ||
942 | extern int blk_integrity_compare(struct block_device *, struct block_device *); | ||
943 | extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *); | ||
944 | extern int blk_rq_count_integrity_sg(struct request *); | ||
945 | |||
946 | static inline unsigned short blk_integrity_tuple_size(struct blk_integrity *bi) | ||
876 | { | 947 | { |
948 | if (bi) | ||
949 | return bi->tuple_size; | ||
950 | |||
877 | return 0; | 951 | return 0; |
878 | } | 952 | } |
879 | 953 | ||
880 | static inline void exit_io_context(void) | 954 | static inline struct blk_integrity *bdev_get_integrity(struct block_device *bdev) |
881 | { | 955 | { |
956 | return bdev->bd_disk->integrity; | ||
882 | } | 957 | } |
883 | 958 | ||
884 | struct io_context; | 959 | static inline unsigned int bdev_get_tag_size(struct block_device *bdev) |
885 | static inline int put_io_context(struct io_context *ioc) | ||
886 | { | 960 | { |
887 | return 1; | 961 | struct blk_integrity *bi = bdev_get_integrity(bdev); |
962 | |||
963 | if (bi) | ||
964 | return bi->tag_size; | ||
965 | |||
966 | return 0; | ||
967 | } | ||
968 | |||
969 | static inline int bdev_integrity_enabled(struct block_device *bdev, int rw) | ||
970 | { | ||
971 | struct blk_integrity *bi = bdev_get_integrity(bdev); | ||
972 | |||
973 | if (bi == NULL) | ||
974 | return 0; | ||
975 | |||
976 | if (rw == READ && bi->verify_fn != NULL && | ||
977 | (bi->flags & INTEGRITY_FLAG_READ)) | ||
978 | return 1; | ||
979 | |||
980 | if (rw == WRITE && bi->generate_fn != NULL && | ||
981 | (bi->flags & INTEGRITY_FLAG_WRITE)) | ||
982 | return 1; | ||
983 | |||
984 | return 0; | ||
888 | } | 985 | } |
889 | 986 | ||
987 | static inline int blk_integrity_rq(struct request *rq) | ||
988 | { | ||
989 | return bio_integrity(rq->bio); | ||
990 | } | ||
991 | |||
992 | #else /* CONFIG_BLK_DEV_INTEGRITY */ | ||
993 | |||
994 | #define blk_integrity_rq(rq) (0) | ||
995 | #define blk_rq_count_integrity_sg(a) (0) | ||
996 | #define blk_rq_map_integrity_sg(a, b) (0) | ||
997 | #define bdev_get_integrity(a) (0) | ||
998 | #define bdev_get_tag_size(a) (0) | ||
999 | #define blk_integrity_compare(a, b) (0) | ||
1000 | #define blk_integrity_register(a, b) (0) | ||
1001 | #define blk_integrity_unregister(a) do { } while (0); | ||
1002 | |||
1003 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | ||
1004 | |||
1005 | #else /* CONFIG_BLOCK */ | ||
1006 | /* | ||
1007 | * stubs for when the block layer is configured out | ||
1008 | */ | ||
1009 | #define buffer_heads_over_limit 0 | ||
1010 | |||
1011 | static inline long nr_blockdev_pages(void) | ||
1012 | { | ||
1013 | return 0; | ||
1014 | } | ||
890 | 1015 | ||
891 | #endif /* CONFIG_BLOCK */ | 1016 | #endif /* CONFIG_BLOCK */ |
892 | 1017 | ||
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index e3ef903aae88..d084b8d227a5 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -129,6 +129,7 @@ struct blk_trace { | |||
129 | u32 dev; | 129 | u32 dev; |
130 | struct dentry *dir; | 130 | struct dentry *dir; |
131 | struct dentry *dropped_file; | 131 | struct dentry *dropped_file; |
132 | struct dentry *msg_file; | ||
132 | atomic_t dropped; | 133 | atomic_t dropped; |
133 | }; | 134 | }; |
134 | 135 | ||
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index ae7aec3cabee..e8787417f65a 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -110,6 +110,14 @@ struct hd_struct { | |||
110 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 | 110 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 |
111 | #define GENHD_FL_FAIL 64 | 111 | #define GENHD_FL_FAIL 64 |
112 | 112 | ||
113 | #define BLK_SCSI_MAX_CMDS (256) | ||
114 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | ||
115 | |||
116 | struct blk_scsi_cmd_filter { | ||
117 | unsigned long read_ok[BLK_SCSI_CMD_PER_LONG]; | ||
118 | unsigned long write_ok[BLK_SCSI_CMD_PER_LONG]; | ||
119 | struct kobject kobj; | ||
120 | }; | ||
113 | 121 | ||
114 | struct gendisk { | 122 | struct gendisk { |
115 | int major; /* major number of driver */ | 123 | int major; /* major number of driver */ |
@@ -120,6 +128,7 @@ struct gendisk { | |||
120 | struct hd_struct **part; /* [indexed by minor] */ | 128 | struct hd_struct **part; /* [indexed by minor] */ |
121 | struct block_device_operations *fops; | 129 | struct block_device_operations *fops; |
122 | struct request_queue *queue; | 130 | struct request_queue *queue; |
131 | struct blk_scsi_cmd_filter cmd_filter; | ||
123 | void *private_data; | 132 | void *private_data; |
124 | sector_t capacity; | 133 | sector_t capacity; |
125 | 134 | ||
@@ -141,6 +150,9 @@ struct gendisk { | |||
141 | struct disk_stats dkstats; | 150 | struct disk_stats dkstats; |
142 | #endif | 151 | #endif |
143 | struct work_struct async_notify; | 152 | struct work_struct async_notify; |
153 | #ifdef CONFIG_BLK_DEV_INTEGRITY | ||
154 | struct blk_integrity *integrity; | ||
155 | #endif | ||
144 | }; | 156 | }; |
145 | 157 | ||
146 | /* | 158 | /* |
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h index 2b7a1187cb29..08b987bccf89 100644 --- a/include/linux/iocontext.h +++ b/include/linux/iocontext.h | |||
@@ -99,4 +99,22 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc) | |||
99 | return NULL; | 99 | return NULL; |
100 | } | 100 | } |
101 | 101 | ||
102 | #ifdef CONFIG_BLOCK | ||
103 | int put_io_context(struct io_context *ioc); | ||
104 | void exit_io_context(void); | ||
105 | struct io_context *get_io_context(gfp_t gfp_flags, int node); | ||
106 | struct io_context *alloc_io_context(gfp_t gfp_flags, int node); | ||
107 | void copy_io_context(struct io_context **pdst, struct io_context **psrc); | ||
108 | #else | ||
109 | static inline void exit_io_context(void) | ||
110 | { | ||
111 | } | ||
112 | |||
113 | struct io_context; | ||
114 | static inline int put_io_context(struct io_context *ioc) | ||
115 | { | ||
116 | return 1; | ||
117 | } | ||
118 | #endif | ||
119 | |||
102 | #endif | 120 | #endif |