diff options
author | Kent Overstreet <koverstreet@google.com> | 2012-09-06 18:34:56 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-09-09 04:35:38 -0400 |
commit | 1e2a410ff71504a64d1af2e354287ac51aeac1b0 (patch) | |
tree | e4ae4669d958fc932e5ae67cafd8de860f1f91c9 /fs | |
parent | 395c72a707d966b36d5a42fe12c3a237ded3a0d9 (diff) |
block: Ues bi_pool for bio_integrity_alloc()
Now that bios keep track of where they were allocated from,
bio_integrity_alloc_bioset() becomes redundant.
Remove bio_integrity_alloc_bioset() and drop bio_set argument from the
related functions and make them use bio->bi_pool.
Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio-integrity.c | 44 | ||||
-rw-r--r-- | fs/bio.c | 6 |
2 files changed, 18 insertions, 32 deletions
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c index e85c04b9f61c..a3f28f331b2b 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c | |||
@@ -70,23 +70,25 @@ static inline int use_bip_pool(unsigned int idx) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * bio_integrity_alloc_bioset - Allocate integrity payload and attach it to bio | 73 | * bio_integrity_alloc - Allocate integrity payload and attach it to bio |
74 | * @bio: bio to attach integrity metadata to | 74 | * @bio: bio to attach integrity metadata to |
75 | * @gfp_mask: Memory allocation mask | 75 | * @gfp_mask: Memory allocation mask |
76 | * @nr_vecs: Number of integrity metadata scatter-gather elements | 76 | * @nr_vecs: Number of integrity metadata scatter-gather elements |
77 | * @bs: bio_set to allocate from | ||
78 | * | 77 | * |
79 | * Description: This function prepares a bio for attaching integrity | 78 | * Description: This function prepares a bio for attaching integrity |
80 | * metadata. nr_vecs specifies the maximum number of pages containing | 79 | * metadata. nr_vecs specifies the maximum number of pages containing |
81 | * integrity metadata that can be attached. | 80 | * integrity metadata that can be attached. |
82 | */ | 81 | */ |
83 | struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *bio, | 82 | struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, |
84 | gfp_t gfp_mask, | 83 | gfp_t gfp_mask, |
85 | unsigned int nr_vecs, | 84 | unsigned int nr_vecs) |
86 | struct bio_set *bs) | ||
87 | { | 85 | { |
88 | struct bio_integrity_payload *bip; | 86 | struct bio_integrity_payload *bip; |
89 | unsigned int idx = vecs_to_idx(nr_vecs); | 87 | unsigned int idx = vecs_to_idx(nr_vecs); |
88 | struct bio_set *bs = bio->bi_pool; | ||
89 | |||
90 | if (!bs) | ||
91 | bs = fs_bio_set; | ||
90 | 92 | ||
91 | BUG_ON(bio == NULL); | 93 | BUG_ON(bio == NULL); |
92 | bip = NULL; | 94 | bip = NULL; |
@@ -114,37 +116,22 @@ struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *bio, | |||
114 | 116 | ||
115 | return bip; | 117 | return bip; |
116 | } | 118 | } |
117 | EXPORT_SYMBOL(bio_integrity_alloc_bioset); | ||
118 | |||
119 | /** | ||
120 | * bio_integrity_alloc - Allocate integrity payload and attach it to bio | ||
121 | * @bio: bio to attach integrity metadata to | ||
122 | * @gfp_mask: Memory allocation mask | ||
123 | * @nr_vecs: Number of integrity metadata scatter-gather elements | ||
124 | * | ||
125 | * Description: This function prepares a bio for attaching integrity | ||
126 | * metadata. nr_vecs specifies the maximum number of pages containing | ||
127 | * integrity metadata that can be attached. | ||
128 | */ | ||
129 | struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, | ||
130 | gfp_t gfp_mask, | ||
131 | unsigned int nr_vecs) | ||
132 | { | ||
133 | return bio_integrity_alloc_bioset(bio, gfp_mask, nr_vecs, fs_bio_set); | ||
134 | } | ||
135 | EXPORT_SYMBOL(bio_integrity_alloc); | 119 | EXPORT_SYMBOL(bio_integrity_alloc); |
136 | 120 | ||
137 | /** | 121 | /** |
138 | * bio_integrity_free - Free bio integrity payload | 122 | * bio_integrity_free - Free bio integrity payload |
139 | * @bio: bio containing bip to be freed | 123 | * @bio: bio containing bip to be freed |
140 | * @bs: bio_set this bio was allocated from | ||
141 | * | 124 | * |
142 | * Description: Used to free the integrity portion of a bio. Usually | 125 | * Description: Used to free the integrity portion of a bio. Usually |
143 | * called from bio_free(). | 126 | * called from bio_free(). |
144 | */ | 127 | */ |
145 | void bio_integrity_free(struct bio *bio, struct bio_set *bs) | 128 | void bio_integrity_free(struct bio *bio) |
146 | { | 129 | { |
147 | struct bio_integrity_payload *bip = bio->bi_integrity; | 130 | struct bio_integrity_payload *bip = bio->bi_integrity; |
131 | struct bio_set *bs = bio->bi_pool; | ||
132 | |||
133 | if (!bs) | ||
134 | bs = fs_bio_set; | ||
148 | 135 | ||
149 | BUG_ON(bip == NULL); | 136 | BUG_ON(bip == NULL); |
150 | 137 | ||
@@ -730,19 +717,18 @@ EXPORT_SYMBOL(bio_integrity_split); | |||
730 | * @bio: New bio | 717 | * @bio: New bio |
731 | * @bio_src: Original bio | 718 | * @bio_src: Original bio |
732 | * @gfp_mask: Memory allocation mask | 719 | * @gfp_mask: Memory allocation mask |
733 | * @bs: bio_set to allocate bip from | ||
734 | * | 720 | * |
735 | * Description: Called to allocate a bip when cloning a bio | 721 | * Description: Called to allocate a bip when cloning a bio |
736 | */ | 722 | */ |
737 | int bio_integrity_clone(struct bio *bio, struct bio *bio_src, | 723 | int bio_integrity_clone(struct bio *bio, struct bio *bio_src, |
738 | gfp_t gfp_mask, struct bio_set *bs) | 724 | gfp_t gfp_mask) |
739 | { | 725 | { |
740 | struct bio_integrity_payload *bip_src = bio_src->bi_integrity; | 726 | struct bio_integrity_payload *bip_src = bio_src->bi_integrity; |
741 | struct bio_integrity_payload *bip; | 727 | struct bio_integrity_payload *bip; |
742 | 728 | ||
743 | BUG_ON(bip_src == NULL); | 729 | BUG_ON(bip_src == NULL); |
744 | 730 | ||
745 | bip = bio_integrity_alloc_bioset(bio, gfp_mask, bip_src->bip_vcnt, bs); | 731 | bip = bio_integrity_alloc(bio, gfp_mask, bip_src->bip_vcnt); |
746 | 732 | ||
747 | if (bip == NULL) | 733 | if (bip == NULL) |
748 | return -EIO; | 734 | return -EIO; |
@@ -241,7 +241,7 @@ void bio_free(struct bio *bio, struct bio_set *bs) | |||
241 | bvec_free_bs(bs, bio->bi_io_vec, BIO_POOL_IDX(bio)); | 241 | bvec_free_bs(bs, bio->bi_io_vec, BIO_POOL_IDX(bio)); |
242 | 242 | ||
243 | if (bio_integrity(bio)) | 243 | if (bio_integrity(bio)) |
244 | bio_integrity_free(bio, bs); | 244 | bio_integrity_free(bio); |
245 | 245 | ||
246 | /* | 246 | /* |
247 | * If we have front padding, adjust the bio pointer before freeing | 247 | * If we have front padding, adjust the bio pointer before freeing |
@@ -341,7 +341,7 @@ EXPORT_SYMBOL(bio_alloc); | |||
341 | static void bio_kmalloc_destructor(struct bio *bio) | 341 | static void bio_kmalloc_destructor(struct bio *bio) |
342 | { | 342 | { |
343 | if (bio_integrity(bio)) | 343 | if (bio_integrity(bio)) |
344 | bio_integrity_free(bio, fs_bio_set); | 344 | bio_integrity_free(bio); |
345 | kfree(bio); | 345 | kfree(bio); |
346 | } | 346 | } |
347 | 347 | ||
@@ -480,7 +480,7 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask) | |||
480 | if (bio_integrity(bio)) { | 480 | if (bio_integrity(bio)) { |
481 | int ret; | 481 | int ret; |
482 | 482 | ||
483 | ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set); | 483 | ret = bio_integrity_clone(b, bio, gfp_mask); |
484 | 484 | ||
485 | if (ret < 0) { | 485 | if (ret < 0) { |
486 | bio_put(b); | 486 | bio_put(b); |