diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-01-26 12:45:11 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2011-09-28 04:26:28 -0400 |
commit | 9e204cddaf76d19ce0e84f025b0946110694dbfb (patch) | |
tree | 1aa2b56518366033498a404bb4b35954894851d9 /drivers/block | |
parent | 3e394da184ab32d2c345fd459e1eeb7b9586bb4e (diff) |
drbd: Move some functions to where they are used
Move drbd_update_congested() to drbd_main.c, and drbd_req_new() and
drbd_req_free() to drbd_req.c: those functions are not used anywhere
else.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 7 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 7 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_req.c | 29 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_req.h | 26 |
4 files changed, 36 insertions, 33 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index cb45ca10d4b1..7922fa0403d0 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -2355,13 +2355,6 @@ static inline int drbd_set_ed_uuid(struct drbd_conf *mdev, u64 val) | |||
2355 | return changed; | 2355 | return changed; |
2356 | } | 2356 | } |
2357 | 2357 | ||
2358 | static inline void drbd_update_congested(struct drbd_conf *mdev) | ||
2359 | { | ||
2360 | struct sock *sk = mdev->tconn->data.socket->sk; | ||
2361 | if (sk->sk_wmem_queued > sk->sk_sndbuf * 4 / 5) | ||
2362 | set_bit(NET_CONGESTED, &mdev->flags); | ||
2363 | } | ||
2364 | |||
2365 | static inline int drbd_queue_order_type(struct drbd_conf *mdev) | 2358 | static inline int drbd_queue_order_type(struct drbd_conf *mdev) |
2366 | { | 2359 | { |
2367 | /* sorry, we currently have no working implementation | 2360 | /* sorry, we currently have no working implementation |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 701f231cf4bf..5da1df023a49 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -2528,6 +2528,13 @@ static int we_should_drop_the_connection(struct drbd_conf *mdev, struct socket * | |||
2528 | return drop_it; /* && (mdev->state == R_PRIMARY) */; | 2528 | return drop_it; /* && (mdev->state == R_PRIMARY) */; |
2529 | } | 2529 | } |
2530 | 2530 | ||
2531 | static void drbd_update_congested(struct drbd_conf *mdev) | ||
2532 | { | ||
2533 | struct sock *sk = mdev->tconn->data.socket->sk; | ||
2534 | if (sk->sk_wmem_queued > sk->sk_sndbuf * 4 / 5) | ||
2535 | set_bit(NET_CONGESTED, &mdev->flags); | ||
2536 | } | ||
2537 | |||
2531 | /* The idea of sendpage seems to be to put some kind of reference | 2538 | /* The idea of sendpage seems to be to put some kind of reference |
2532 | * to the page into the skb, and to hand it over to the NIC. In | 2539 | * to the page into the skb, and to hand it over to the NIC. In |
2533 | * this process get_page() gets called. | 2540 | * this process get_page() gets called. |
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index 74179f7986e1..25fa87c95a10 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
@@ -56,6 +56,35 @@ static void _drbd_end_io_acct(struct drbd_conf *mdev, struct drbd_request *req) | |||
56 | part_stat_unlock(); | 56 | part_stat_unlock(); |
57 | } | 57 | } |
58 | 58 | ||
59 | static struct drbd_request *drbd_req_new(struct drbd_conf *mdev, | ||
60 | struct bio *bio_src) | ||
61 | { | ||
62 | struct drbd_request *req; | ||
63 | |||
64 | req = mempool_alloc(drbd_request_mempool, GFP_NOIO); | ||
65 | if (!req) | ||
66 | return NULL; | ||
67 | |||
68 | drbd_req_make_private_bio(req, bio_src); | ||
69 | req->rq_state = bio_data_dir(bio_src) == WRITE ? RQ_WRITE : 0; | ||
70 | req->mdev = mdev; | ||
71 | req->master_bio = bio_src; | ||
72 | req->epoch = 0; | ||
73 | drbd_clear_interval(&req->i); | ||
74 | req->i.sector = bio_src->bi_sector; | ||
75 | req->i.size = bio_src->bi_size; | ||
76 | INIT_LIST_HEAD(&req->tl_requests); | ||
77 | INIT_LIST_HEAD(&req->w.list); | ||
78 | |||
79 | return req; | ||
80 | } | ||
81 | |||
82 | static void drbd_req_free(struct drbd_request *req) | ||
83 | { | ||
84 | mempool_free(req, drbd_request_mempool); | ||
85 | } | ||
86 | |||
87 | /* rw is bio_data_dir(), only READ or WRITE */ | ||
59 | static void _req_is_done(struct drbd_conf *mdev, struct drbd_request *req, const int rw) | 88 | static void _req_is_done(struct drbd_conf *mdev, struct drbd_request *req, const int rw) |
60 | { | 89 | { |
61 | const unsigned long s = req->rq_state; | 90 | const unsigned long s = req->rq_state; |
diff --git a/drivers/block/drbd/drbd_req.h b/drivers/block/drbd/drbd_req.h index 4b0858bf2866..431e3f962c3a 100644 --- a/drivers/block/drbd/drbd_req.h +++ b/drivers/block/drbd/drbd_req.h | |||
@@ -234,32 +234,6 @@ static inline void drbd_req_make_private_bio(struct drbd_request *req, struct bi | |||
234 | bio->bi_next = NULL; | 234 | bio->bi_next = NULL; |
235 | } | 235 | } |
236 | 236 | ||
237 | static inline struct drbd_request *drbd_req_new(struct drbd_conf *mdev, | ||
238 | struct bio *bio_src) | ||
239 | { | ||
240 | struct drbd_request *req = | ||
241 | mempool_alloc(drbd_request_mempool, GFP_NOIO); | ||
242 | if (likely(req)) { | ||
243 | drbd_req_make_private_bio(req, bio_src); | ||
244 | |||
245 | req->rq_state = bio_data_dir(bio_src) == WRITE ? RQ_WRITE : 0; | ||
246 | req->mdev = mdev; | ||
247 | req->master_bio = bio_src; | ||
248 | req->epoch = 0; | ||
249 | req->i.sector = bio_src->bi_sector; | ||
250 | req->i.size = bio_src->bi_size; | ||
251 | drbd_clear_interval(&req->i); | ||
252 | INIT_LIST_HEAD(&req->tl_requests); | ||
253 | INIT_LIST_HEAD(&req->w.list); | ||
254 | } | ||
255 | return req; | ||
256 | } | ||
257 | |||
258 | static inline void drbd_req_free(struct drbd_request *req) | ||
259 | { | ||
260 | mempool_free(req, drbd_request_mempool); | ||
261 | } | ||
262 | |||
263 | /* Short lived temporary struct on the stack. | 237 | /* Short lived temporary struct on the stack. |
264 | * We could squirrel the error to be returned into | 238 | * We could squirrel the error to be returned into |
265 | * bio->bi_size, or similar. But that would be too ugly. */ | 239 | * bio->bi_size, or similar. But that would be too ugly. */ |