aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-11 12:58:49 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-11 12:58:49 -0400
commitcabca0cb0d0e8579428d8f8c3f606e2f01d26d14 (patch)
treea32426d345bab465488df20a228a495a12b26b8b
parent853da0022023c046e0a5ccc51d427745f0c94de7 (diff)
parent87c1efbfeac49849b981a7eac8cba42d4a49b2e9 (diff)
Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block: Fix compile/link of init/do_mounts.c with !CONFIG_BLOCK When stacked block devices are in-use (e.g. md or dm), the recursive calls
-rw-r--r--block/ll_rw_blk.c53
-rw-r--r--include/linux/genhd.h6
-rw-r--r--include/linux/sched.h4
3 files changed, 61 insertions, 2 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 17e188973428..74a567afb830 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3116,7 +3116,7 @@ static inline int should_fail_request(struct bio *bio)
3116 * bi_sector for remaps as it sees fit. So the values of these fields 3116 * bi_sector for remaps as it sees fit. So the values of these fields
3117 * should NOT be depended on after the call to generic_make_request. 3117 * should NOT be depended on after the call to generic_make_request.
3118 */ 3118 */
3119void generic_make_request(struct bio *bio) 3119static inline void __generic_make_request(struct bio *bio)
3120{ 3120{
3121 request_queue_t *q; 3121 request_queue_t *q;
3122 sector_t maxsector; 3122 sector_t maxsector;
@@ -3215,6 +3215,57 @@ end_io:
3215 } while (ret); 3215 } while (ret);
3216} 3216}
3217 3217
3218/*
3219 * We only want one ->make_request_fn to be active at a time,
3220 * else stack usage with stacked devices could be a problem.
3221 * So use current->bio_{list,tail} to keep a list of requests
3222 * submited by a make_request_fn function.
3223 * current->bio_tail is also used as a flag to say if
3224 * generic_make_request is currently active in this task or not.
3225 * If it is NULL, then no make_request is active. If it is non-NULL,
3226 * then a make_request is active, and new requests should be added
3227 * at the tail
3228 */
3229void generic_make_request(struct bio *bio)
3230{
3231 if (current->bio_tail) {
3232 /* make_request is active */
3233 *(current->bio_tail) = bio;
3234 bio->bi_next = NULL;
3235 current->bio_tail = &bio->bi_next;
3236 return;
3237 }
3238 /* following loop may be a bit non-obvious, and so deserves some
3239 * explanation.
3240 * Before entering the loop, bio->bi_next is NULL (as all callers
3241 * ensure that) so we have a list with a single bio.
3242 * We pretend that we have just taken it off a longer list, so
3243 * we assign bio_list to the next (which is NULL) and bio_tail
3244 * to &bio_list, thus initialising the bio_list of new bios to be
3245 * added. __generic_make_request may indeed add some more bios
3246 * through a recursive call to generic_make_request. If it
3247 * did, we find a non-NULL value in bio_list and re-enter the loop
3248 * from the top. In this case we really did just take the bio
3249 * of the top of the list (no pretending) and so fixup bio_list and
3250 * bio_tail or bi_next, and call into __generic_make_request again.
3251 *
3252 * The loop was structured like this to make only one call to
3253 * __generic_make_request (which is important as it is large and
3254 * inlined) and to keep the structure simple.
3255 */
3256 BUG_ON(bio->bi_next);
3257 do {
3258 current->bio_list = bio->bi_next;
3259 if (bio->bi_next == NULL)
3260 current->bio_tail = &current->bio_list;
3261 else
3262 bio->bi_next = NULL;
3263 __generic_make_request(bio);
3264 bio = current->bio_list;
3265 } while (bio);
3266 current->bio_tail = NULL; /* deactivate */
3267}
3268
3218EXPORT_SYMBOL(generic_make_request); 3269EXPORT_SYMBOL(generic_make_request);
3219 3270
3220/** 3271/**
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index f589559cf070..4c03ee353e78 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -434,6 +434,10 @@ static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
434 434
435#endif 435#endif
436 436
437#endif 437#else /* CONFIG_BLOCK */
438
439static inline void printk_all_partitions(void) { }
440
441#endif /* CONFIG_BLOCK */
438 442
439#endif 443#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 97c0c7da58ef..a81897e2a244 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -88,6 +88,7 @@ struct sched_param {
88 88
89struct exec_domain; 89struct exec_domain;
90struct futex_pi_state; 90struct futex_pi_state;
91struct bio;
91 92
92/* 93/*
93 * List of flags we want to share for kernel threads, 94 * List of flags we want to share for kernel threads,
@@ -1016,6 +1017,9 @@ struct task_struct {
1016/* journalling filesystem info */ 1017/* journalling filesystem info */
1017 void *journal_info; 1018 void *journal_info;
1018 1019
1020/* stacked block device info */
1021 struct bio *bio_list, **bio_tail;
1022
1019/* VM state */ 1023/* VM state */
1020 struct reclaim_state *reclaim_state; 1024 struct reclaim_state *reclaim_state;
1021 1025