Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:Update
drbd
bsc-1197431-drbd-new-helper-function-drbd_req_i...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc-1197431-drbd-new-helper-function-drbd_req_in_actlog.patch of Package drbd
From e7c61115277ff1aa534b284df2261f0506e364ee Mon Sep 17 00:00:00 2001 From: Lars Ellenberg <lars.ellenberg@linbit.com> Date: Thu, 19 Jul 2018 11:51:49 +0200 Subject: [PATCH] drbd: new helper function drbd_req_in_actlog() Reduce code duplication. Also reduce indentation in drbd_request_prepare(). No functional change. --- drbd/drbd_req.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c index 85b96d5e..3a6be65b 100644 --- a/drbd/drbd_req.c +++ b/drbd/drbd_req.c @@ -1549,6 +1549,12 @@ static void req_make_private_bio(struct drbd_request *req, struct bio *bio_src) bio->bi_next = NULL; } +static void drbd_req_in_actlog(struct drbd_request *req) +{ + req->local_rq_state |= RQ_IN_ACT_LOG; + ktime_get_accounting(req->in_actlog_kt); +} + /* returns the new drbd_request pointer, if the caller is expected to * drbd_send_and_submit() it (to save latency), or NULL if we queued the * request on the submitter thread. @@ -1578,23 +1584,23 @@ drbd_request_prepare(struct drbd_device *device, struct bio *bio, ktime_t start_ /* Update disk stats */ _drbd_start_io_acct(device, req); + if (rw != WRITE || req->i.size == 0) + return req; + /* process discards always from our submitter thread */ if ((bio_op(bio) == REQ_OP_WRITE_ZEROES) || (bio_op(bio) == REQ_OP_DISCARD)) goto queue_for_submitter_thread; - if (rw == WRITE && req->i.size) { - /* Unconditionally defer to worker, - * if we still need to bumpt our data generation id */ - if (test_bit(NEW_CUR_UUID, &device->flags)) - goto queue_for_submitter_thread; + /* Unconditionally defer to worker, + * if we still need to bumpt our data generation id */ + if (test_bit(NEW_CUR_UUID, &device->flags)) + goto queue_for_submitter_thread; - if (req->private_bio && !test_bit(AL_SUSPENDED, &device->flags)) { - if (!drbd_al_begin_io_fastpath(device, &req->i)) - goto queue_for_submitter_thread; - req->local_rq_state |= RQ_IN_ACT_LOG; - ktime_get_accounting(req->in_actlog_kt); - } + if (req->private_bio && !test_bit(AL_SUSPENDED, &device->flags)) { + if (!drbd_al_begin_io_fastpath(device, &req->i)) + goto queue_for_submitter_thread; + drbd_req_in_actlog(req); } return req; @@ -1930,8 +1936,7 @@ static void submit_fast_path(struct drbd_device *device, struct waiting_for_act_ if (!drbd_al_begin_io_fastpath(device, &req->i)) continue; - req->local_rq_state |= RQ_IN_ACT_LOG; - ktime_get_accounting(req->in_actlog_kt); + drbd_req_in_actlog(req); atomic_dec(&device->ap_actlog_cnt); } @@ -2020,8 +2025,7 @@ static void send_and_submit_pending(struct drbd_device *device, struct waiting_f __drbd_submit_peer_request(pr); } list_for_each_entry_safe(req, tmp, &wfa->requests.pending, tl_requests) { - req->local_rq_state |= RQ_IN_ACT_LOG; - ktime_get_accounting(req->in_actlog_kt); + drbd_req_in_actlog(req); atomic_dec(&device->ap_actlog_cnt); list_del_init(&req->tl_requests); drbd_send_and_submit(device, req); -- 2.34.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor