Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1719587
| From | Philipp Reisner <philipp.reisner@linbit.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 03/17] drbd: add explicit plugging when submitting batches |
| Date | 2017-08-24 23:30 +0200 |
| Message-ID | <ui7Rn-3tg-7@gated-at.bofh.it> (permalink) |
| References | <ui7Rn-3tg-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Lars Ellenberg <lars.ellenberg@linbit.com>
When submitting batches of requests which had been queued on the
submitter thread, typically because they needed to wait for an
activity log transactions, use explicit plugging to help potential
merging of requests in the backend io-scheduler.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 85e05ee..2c82330 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -1292,6 +1292,7 @@ static void drbd_unplug(struct blk_plug_cb *cb, bool from_schedule)
struct drbd_resource *resource = plug->cb.data;
struct drbd_request *req = plug->most_recent_req;
+ kfree(cb);
if (!req)
return;
@@ -1301,8 +1302,8 @@ static void drbd_unplug(struct blk_plug_cb *cb, bool from_schedule)
req->rq_state |= RQ_UNPLUG;
/* but also queue a generic unplug */
drbd_queue_unplug(req->device);
- spin_unlock_irq(&resource->req_lock);
kref_put(&req->kref, drbd_req_destroy);
+ spin_unlock_irq(&resource->req_lock);
}
static struct drbd_plug_cb* drbd_check_plugged(struct drbd_resource *resource)
@@ -1343,8 +1344,6 @@ static void drbd_send_and_submit(struct drbd_device *device, struct drbd_request
bool no_remote = false;
bool submit_private_bio = false;
- struct drbd_plug_cb *plug = drbd_check_plugged(resource);
-
spin_lock_irq(&resource->req_lock);
if (rw == WRITE) {
/* This may temporarily give up the req_lock,
@@ -1409,8 +1408,11 @@ static void drbd_send_and_submit(struct drbd_device *device, struct drbd_request
no_remote = true;
}
- if (plug != NULL && no_remote == false)
- drbd_update_plug(plug, req);
+ if (no_remote == false) {
+ struct drbd_plug_cb *plug = drbd_check_plugged(resource);
+ if (plug)
+ drbd_update_plug(plug, req);
+ }
/* If it took the fast path in drbd_request_prepare, add it here.
* The slow path has added it already. */
@@ -1460,7 +1462,10 @@ void __drbd_make_request(struct drbd_device *device, struct bio *bio, unsigned l
static void submit_fast_path(struct drbd_device *device, struct list_head *incoming)
{
+ struct blk_plug plug;
struct drbd_request *req, *tmp;
+
+ blk_start_plug(&plug);
list_for_each_entry_safe(req, tmp, incoming, tl_requests) {
const int rw = bio_data_dir(req->master_bio);
@@ -1478,6 +1483,7 @@ static void submit_fast_path(struct drbd_device *device, struct list_head *incom
list_del_init(&req->tl_requests);
drbd_send_and_submit(device, req);
}
+ blk_finish_plug(&plug);
}
static bool prepare_al_transaction_nonblock(struct drbd_device *device,
@@ -1507,10 +1513,12 @@ static bool prepare_al_transaction_nonblock(struct drbd_device *device,
return !list_empty(pending);
}
-void send_and_submit_pending(struct drbd_device *device, struct list_head *pending)
+static void send_and_submit_pending(struct drbd_device *device, struct list_head *pending)
{
+ struct blk_plug plug;
struct drbd_request *req;
+ blk_start_plug(&plug);
while ((req = list_first_entry_or_null(pending, struct drbd_request, tl_requests))) {
req->rq_state |= RQ_IN_ACT_LOG;
req->in_actlog_jif = jiffies;
@@ -1518,6 +1526,7 @@ void send_and_submit_pending(struct drbd_device *device, struct list_head *pendi
list_del_init(&req->tl_requests);
drbd_send_and_submit(device, req);
}
+ blk_finish_plug(&plug);
}
void do_submit(struct work_struct *ws)
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/17] DRBD updates Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 12/17] drbd: fix potential deadlock when trying to detach during handshake Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 04/17] drbd: Send P_NEG_ACK upon write error in protocol != C Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 03/17] drbd: add explicit plugging when submitting batches Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 05/17] drbd: mark symbols static where possible Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 02/17] drbd: change list_for_each_safe to while(list_first_entry_or_null) Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 01/17] drbd: introduce drbd_recv_header_maybe_unplug Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
Re: [PATCH 01/17] drbd: introduce drbd_recv_header_maybe_unplug Jens Axboe <axboe@kernel.dk> - 2017-08-25 19:30 +0200
Re: [PATCH 01/17] drbd: introduce drbd_recv_header_maybe_unplug Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-28 15:40 +0200
[PATCH 01/17] drbd: introduce drbd_recv_header_maybe_unplug Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-28 16:00 +0200
[PATCH 08/17] drbd: fix potential get_ldev/put_ldev refcount imbalance during attach Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 17/17] drbd: switch from kmalloc() to kmalloc_array() Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 07/17] drbd: new disk-option disable-write-same Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 15/17] drbd: move global variables to drbd namespace and make some static Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 16/17] drbd: abort drbd_start_resync if there is no connection Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 13/17] drbd: fix race between handshake and admin disconnect/down Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
[PATCH 10/17] drbd: fix rmmod cleanup, remove _all_ debugfs entries Philipp Reisner <philipp.reisner@linbit.com> - 2017-08-24 23:30 +0200
csiph-web