18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci drbd_req.h 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci This file is part of DRBD by Philipp Reisner and Lars Ellenberg. 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci Copyright (C) 2006-2008, LINBIT Information Technologies GmbH. 88c2ecf20Sopenharmony_ci Copyright (C) 2006-2008, Lars Ellenberg <lars.ellenberg@linbit.com>. 98c2ecf20Sopenharmony_ci Copyright (C) 2006-2008, Philipp Reisner <philipp.reisner@linbit.com>. 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifndef _DRBD_REQ_H 148c2ecf20Sopenharmony_ci#define _DRBD_REQ_H 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/module.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include <linux/slab.h> 198c2ecf20Sopenharmony_ci#include <linux/drbd.h> 208c2ecf20Sopenharmony_ci#include "drbd_int.h" 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* The request callbacks will be called in irq context by the IDE drivers, 238c2ecf20Sopenharmony_ci and in Softirqs/Tasklets/BH context by the SCSI drivers, 248c2ecf20Sopenharmony_ci and by the receiver and worker in kernel-thread context. 258c2ecf20Sopenharmony_ci Try to get the locking right :) */ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* 288c2ecf20Sopenharmony_ci * Objects of type struct drbd_request do only exist on a R_PRIMARY node, and are 298c2ecf20Sopenharmony_ci * associated with IO requests originating from the block layer above us. 308c2ecf20Sopenharmony_ci * 318c2ecf20Sopenharmony_ci * There are quite a few things that may happen to a drbd request 328c2ecf20Sopenharmony_ci * during its lifetime. 338c2ecf20Sopenharmony_ci * 348c2ecf20Sopenharmony_ci * It will be created. 358c2ecf20Sopenharmony_ci * It will be marked with the intention to be 368c2ecf20Sopenharmony_ci * submitted to local disk and/or 378c2ecf20Sopenharmony_ci * send via the network. 388c2ecf20Sopenharmony_ci * 398c2ecf20Sopenharmony_ci * It has to be placed on the transfer log and other housekeeping lists, 408c2ecf20Sopenharmony_ci * In case we have a network connection. 418c2ecf20Sopenharmony_ci * 428c2ecf20Sopenharmony_ci * It may be identified as a concurrent (write) request 438c2ecf20Sopenharmony_ci * and be handled accordingly. 448c2ecf20Sopenharmony_ci * 458c2ecf20Sopenharmony_ci * It may me handed over to the local disk subsystem. 468c2ecf20Sopenharmony_ci * It may be completed by the local disk subsystem, 478c2ecf20Sopenharmony_ci * either successfully or with io-error. 488c2ecf20Sopenharmony_ci * In case it is a READ request, and it failed locally, 498c2ecf20Sopenharmony_ci * it may be retried remotely. 508c2ecf20Sopenharmony_ci * 518c2ecf20Sopenharmony_ci * It may be queued for sending. 528c2ecf20Sopenharmony_ci * It may be handed over to the network stack, 538c2ecf20Sopenharmony_ci * which may fail. 548c2ecf20Sopenharmony_ci * It may be acknowledged by the "peer" according to the wire_protocol in use. 558c2ecf20Sopenharmony_ci * this may be a negative ack. 568c2ecf20Sopenharmony_ci * It may receive a faked ack when the network connection is lost and the 578c2ecf20Sopenharmony_ci * transfer log is cleaned up. 588c2ecf20Sopenharmony_ci * Sending may be canceled due to network connection loss. 598c2ecf20Sopenharmony_ci * When it finally has outlived its time, 608c2ecf20Sopenharmony_ci * corresponding dirty bits in the resync-bitmap may be cleared or set, 618c2ecf20Sopenharmony_ci * it will be destroyed, 628c2ecf20Sopenharmony_ci * and completion will be signalled to the originator, 638c2ecf20Sopenharmony_ci * with or without "success". 648c2ecf20Sopenharmony_ci */ 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_cienum drbd_req_event { 678c2ecf20Sopenharmony_ci CREATED, 688c2ecf20Sopenharmony_ci TO_BE_SENT, 698c2ecf20Sopenharmony_ci TO_BE_SUBMITTED, 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci /* XXX yes, now I am inconsistent... 728c2ecf20Sopenharmony_ci * these are not "events" but "actions" 738c2ecf20Sopenharmony_ci * oh, well... */ 748c2ecf20Sopenharmony_ci QUEUE_FOR_NET_WRITE, 758c2ecf20Sopenharmony_ci QUEUE_FOR_NET_READ, 768c2ecf20Sopenharmony_ci QUEUE_FOR_SEND_OOS, 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci /* An empty flush is queued as P_BARRIER, 798c2ecf20Sopenharmony_ci * which will cause it to complete "successfully", 808c2ecf20Sopenharmony_ci * even if the local disk flush failed. 818c2ecf20Sopenharmony_ci * 828c2ecf20Sopenharmony_ci * Just like "real" requests, empty flushes (blkdev_issue_flush()) will 838c2ecf20Sopenharmony_ci * only see an error if neither local nor remote data is reachable. */ 848c2ecf20Sopenharmony_ci QUEUE_AS_DRBD_BARRIER, 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci SEND_CANCELED, 878c2ecf20Sopenharmony_ci SEND_FAILED, 888c2ecf20Sopenharmony_ci HANDED_OVER_TO_NETWORK, 898c2ecf20Sopenharmony_ci OOS_HANDED_TO_NETWORK, 908c2ecf20Sopenharmony_ci CONNECTION_LOST_WHILE_PENDING, 918c2ecf20Sopenharmony_ci READ_RETRY_REMOTE_CANCELED, 928c2ecf20Sopenharmony_ci RECV_ACKED_BY_PEER, 938c2ecf20Sopenharmony_ci WRITE_ACKED_BY_PEER, 948c2ecf20Sopenharmony_ci WRITE_ACKED_BY_PEER_AND_SIS, /* and set_in_sync */ 958c2ecf20Sopenharmony_ci CONFLICT_RESOLVED, 968c2ecf20Sopenharmony_ci POSTPONE_WRITE, 978c2ecf20Sopenharmony_ci NEG_ACKED, 988c2ecf20Sopenharmony_ci BARRIER_ACKED, /* in protocol A and B */ 998c2ecf20Sopenharmony_ci DATA_RECEIVED, /* (remote read) */ 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci COMPLETED_OK, 1028c2ecf20Sopenharmony_ci READ_COMPLETED_WITH_ERROR, 1038c2ecf20Sopenharmony_ci READ_AHEAD_COMPLETED_WITH_ERROR, 1048c2ecf20Sopenharmony_ci WRITE_COMPLETED_WITH_ERROR, 1058c2ecf20Sopenharmony_ci DISCARD_COMPLETED_NOTSUPP, 1068c2ecf20Sopenharmony_ci DISCARD_COMPLETED_WITH_ERROR, 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci ABORT_DISK_IO, 1098c2ecf20Sopenharmony_ci RESEND, 1108c2ecf20Sopenharmony_ci FAIL_FROZEN_DISK_IO, 1118c2ecf20Sopenharmony_ci RESTART_FROZEN_DISK_IO, 1128c2ecf20Sopenharmony_ci NOTHING, 1138c2ecf20Sopenharmony_ci}; 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci/* encoding of request states for now. we don't actually need that many bits. 1168c2ecf20Sopenharmony_ci * we don't need to do atomic bit operations either, since most of the time we 1178c2ecf20Sopenharmony_ci * need to look at the connection state and/or manipulate some lists at the 1188c2ecf20Sopenharmony_ci * same time, so we should hold the request lock anyways. 1198c2ecf20Sopenharmony_ci */ 1208c2ecf20Sopenharmony_cienum drbd_req_state_bits { 1218c2ecf20Sopenharmony_ci /* 3210 1228c2ecf20Sopenharmony_ci * 0000: no local possible 1238c2ecf20Sopenharmony_ci * 0001: to be submitted 1248c2ecf20Sopenharmony_ci * UNUSED, we could map: 011: submitted, completion still pending 1258c2ecf20Sopenharmony_ci * 0110: completed ok 1268c2ecf20Sopenharmony_ci * 0010: completed with error 1278c2ecf20Sopenharmony_ci * 1001: Aborted (before completion) 1288c2ecf20Sopenharmony_ci * 1x10: Aborted and completed -> free 1298c2ecf20Sopenharmony_ci */ 1308c2ecf20Sopenharmony_ci __RQ_LOCAL_PENDING, 1318c2ecf20Sopenharmony_ci __RQ_LOCAL_COMPLETED, 1328c2ecf20Sopenharmony_ci __RQ_LOCAL_OK, 1338c2ecf20Sopenharmony_ci __RQ_LOCAL_ABORTED, 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci /* 87654 1368c2ecf20Sopenharmony_ci * 00000: no network possible 1378c2ecf20Sopenharmony_ci * 00001: to be send 1388c2ecf20Sopenharmony_ci * 00011: to be send, on worker queue 1398c2ecf20Sopenharmony_ci * 00101: sent, expecting recv_ack (B) or write_ack (C) 1408c2ecf20Sopenharmony_ci * 11101: sent, 1418c2ecf20Sopenharmony_ci * recv_ack (B) or implicit "ack" (A), 1428c2ecf20Sopenharmony_ci * still waiting for the barrier ack. 1438c2ecf20Sopenharmony_ci * master_bio may already be completed and invalidated. 1448c2ecf20Sopenharmony_ci * 11100: write acked (C), 1458c2ecf20Sopenharmony_ci * data received (for remote read, any protocol) 1468c2ecf20Sopenharmony_ci * or finally the barrier ack has arrived (B,A)... 1478c2ecf20Sopenharmony_ci * request can be freed 1488c2ecf20Sopenharmony_ci * 01100: neg-acked (write, protocol C) 1498c2ecf20Sopenharmony_ci * or neg-d-acked (read, any protocol) 1508c2ecf20Sopenharmony_ci * or killed from the transfer log 1518c2ecf20Sopenharmony_ci * during cleanup after connection loss 1528c2ecf20Sopenharmony_ci * request can be freed 1538c2ecf20Sopenharmony_ci * 01000: canceled or send failed... 1548c2ecf20Sopenharmony_ci * request can be freed 1558c2ecf20Sopenharmony_ci */ 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci /* if "SENT" is not set, yet, this can still fail or be canceled. 1588c2ecf20Sopenharmony_ci * if "SENT" is set already, we still wait for an Ack packet. 1598c2ecf20Sopenharmony_ci * when cleared, the master_bio may be completed. 1608c2ecf20Sopenharmony_ci * in (B,A) the request object may still linger on the transaction log 1618c2ecf20Sopenharmony_ci * until the corresponding barrier ack comes in */ 1628c2ecf20Sopenharmony_ci __RQ_NET_PENDING, 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci /* If it is QUEUED, and it is a WRITE, it is also registered in the 1658c2ecf20Sopenharmony_ci * transfer log. Currently we need this flag to avoid conflicts between 1668c2ecf20Sopenharmony_ci * worker canceling the request and tl_clear_barrier killing it from 1678c2ecf20Sopenharmony_ci * transfer log. We should restructure the code so this conflict does 1688c2ecf20Sopenharmony_ci * no longer occur. */ 1698c2ecf20Sopenharmony_ci __RQ_NET_QUEUED, 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci /* well, actually only "handed over to the network stack". 1728c2ecf20Sopenharmony_ci * 1738c2ecf20Sopenharmony_ci * TODO can potentially be dropped because of the similar meaning 1748c2ecf20Sopenharmony_ci * of RQ_NET_SENT and ~RQ_NET_QUEUED. 1758c2ecf20Sopenharmony_ci * however it is not exactly the same. before we drop it 1768c2ecf20Sopenharmony_ci * we must ensure that we can tell a request with network part 1778c2ecf20Sopenharmony_ci * from a request without, regardless of what happens to it. */ 1788c2ecf20Sopenharmony_ci __RQ_NET_SENT, 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci /* when set, the request may be freed (if RQ_NET_QUEUED is clear). 1818c2ecf20Sopenharmony_ci * basically this means the corresponding P_BARRIER_ACK was received */ 1828c2ecf20Sopenharmony_ci __RQ_NET_DONE, 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci /* whether or not we know (C) or pretend (B,A) that the write 1858c2ecf20Sopenharmony_ci * was successfully written on the peer. 1868c2ecf20Sopenharmony_ci */ 1878c2ecf20Sopenharmony_ci __RQ_NET_OK, 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci /* peer called drbd_set_in_sync() for this write */ 1908c2ecf20Sopenharmony_ci __RQ_NET_SIS, 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci /* keep this last, its for the RQ_NET_MASK */ 1938c2ecf20Sopenharmony_ci __RQ_NET_MAX, 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci /* Set when this is a write, clear for a read */ 1968c2ecf20Sopenharmony_ci __RQ_WRITE, 1978c2ecf20Sopenharmony_ci __RQ_WSAME, 1988c2ecf20Sopenharmony_ci __RQ_UNMAP, 1998c2ecf20Sopenharmony_ci __RQ_ZEROES, 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci /* Should call drbd_al_complete_io() for this request... */ 2028c2ecf20Sopenharmony_ci __RQ_IN_ACT_LOG, 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci /* This was the most recent request during some blk_finish_plug() 2058c2ecf20Sopenharmony_ci * or its implicit from-schedule equivalent. 2068c2ecf20Sopenharmony_ci * We may use it as hint to send a P_UNPLUG_REMOTE */ 2078c2ecf20Sopenharmony_ci __RQ_UNPLUG, 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci /* The peer has sent a retry ACK */ 2108c2ecf20Sopenharmony_ci __RQ_POSTPONED, 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci /* would have been completed, 2138c2ecf20Sopenharmony_ci * but was not, because of drbd_suspended() */ 2148c2ecf20Sopenharmony_ci __RQ_COMPLETION_SUSP, 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci /* We expect a receive ACK (wire proto B) */ 2178c2ecf20Sopenharmony_ci __RQ_EXP_RECEIVE_ACK, 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci /* We expect a write ACK (wite proto C) */ 2208c2ecf20Sopenharmony_ci __RQ_EXP_WRITE_ACK, 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci /* waiting for a barrier ack, did an extra kref_get */ 2238c2ecf20Sopenharmony_ci __RQ_EXP_BARR_ACK, 2248c2ecf20Sopenharmony_ci}; 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci#define RQ_LOCAL_PENDING (1UL << __RQ_LOCAL_PENDING) 2278c2ecf20Sopenharmony_ci#define RQ_LOCAL_COMPLETED (1UL << __RQ_LOCAL_COMPLETED) 2288c2ecf20Sopenharmony_ci#define RQ_LOCAL_OK (1UL << __RQ_LOCAL_OK) 2298c2ecf20Sopenharmony_ci#define RQ_LOCAL_ABORTED (1UL << __RQ_LOCAL_ABORTED) 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci#define RQ_LOCAL_MASK ((RQ_LOCAL_ABORTED << 1)-1) 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci#define RQ_NET_PENDING (1UL << __RQ_NET_PENDING) 2348c2ecf20Sopenharmony_ci#define RQ_NET_QUEUED (1UL << __RQ_NET_QUEUED) 2358c2ecf20Sopenharmony_ci#define RQ_NET_SENT (1UL << __RQ_NET_SENT) 2368c2ecf20Sopenharmony_ci#define RQ_NET_DONE (1UL << __RQ_NET_DONE) 2378c2ecf20Sopenharmony_ci#define RQ_NET_OK (1UL << __RQ_NET_OK) 2388c2ecf20Sopenharmony_ci#define RQ_NET_SIS (1UL << __RQ_NET_SIS) 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci#define RQ_NET_MASK (((1UL << __RQ_NET_MAX)-1) & ~RQ_LOCAL_MASK) 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci#define RQ_WRITE (1UL << __RQ_WRITE) 2438c2ecf20Sopenharmony_ci#define RQ_WSAME (1UL << __RQ_WSAME) 2448c2ecf20Sopenharmony_ci#define RQ_UNMAP (1UL << __RQ_UNMAP) 2458c2ecf20Sopenharmony_ci#define RQ_ZEROES (1UL << __RQ_ZEROES) 2468c2ecf20Sopenharmony_ci#define RQ_IN_ACT_LOG (1UL << __RQ_IN_ACT_LOG) 2478c2ecf20Sopenharmony_ci#define RQ_UNPLUG (1UL << __RQ_UNPLUG) 2488c2ecf20Sopenharmony_ci#define RQ_POSTPONED (1UL << __RQ_POSTPONED) 2498c2ecf20Sopenharmony_ci#define RQ_COMPLETION_SUSP (1UL << __RQ_COMPLETION_SUSP) 2508c2ecf20Sopenharmony_ci#define RQ_EXP_RECEIVE_ACK (1UL << __RQ_EXP_RECEIVE_ACK) 2518c2ecf20Sopenharmony_ci#define RQ_EXP_WRITE_ACK (1UL << __RQ_EXP_WRITE_ACK) 2528c2ecf20Sopenharmony_ci#define RQ_EXP_BARR_ACK (1UL << __RQ_EXP_BARR_ACK) 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci/* For waking up the frozen transfer log mod_req() has to return if the request 2558c2ecf20Sopenharmony_ci should be counted in the epoch object*/ 2568c2ecf20Sopenharmony_ci#define MR_WRITE 1 2578c2ecf20Sopenharmony_ci#define MR_READ 2 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_cistatic inline void drbd_req_make_private_bio(struct drbd_request *req, struct bio *bio_src) 2608c2ecf20Sopenharmony_ci{ 2618c2ecf20Sopenharmony_ci struct bio *bio; 2628c2ecf20Sopenharmony_ci bio = bio_clone_fast(bio_src, GFP_NOIO, &drbd_io_bio_set); 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci req->private_bio = bio; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci bio->bi_private = req; 2678c2ecf20Sopenharmony_ci bio->bi_end_io = drbd_request_endio; 2688c2ecf20Sopenharmony_ci bio->bi_next = NULL; 2698c2ecf20Sopenharmony_ci} 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci/* Short lived temporary struct on the stack. 2728c2ecf20Sopenharmony_ci * We could squirrel the error to be returned into 2738c2ecf20Sopenharmony_ci * bio->bi_iter.bi_size, or similar. But that would be too ugly. */ 2748c2ecf20Sopenharmony_cistruct bio_and_error { 2758c2ecf20Sopenharmony_ci struct bio *bio; 2768c2ecf20Sopenharmony_ci int error; 2778c2ecf20Sopenharmony_ci}; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ciextern void start_new_tl_epoch(struct drbd_connection *connection); 2808c2ecf20Sopenharmony_ciextern void drbd_req_destroy(struct kref *kref); 2818c2ecf20Sopenharmony_ciextern void _req_may_be_done(struct drbd_request *req, 2828c2ecf20Sopenharmony_ci struct bio_and_error *m); 2838c2ecf20Sopenharmony_ciextern int __req_mod(struct drbd_request *req, enum drbd_req_event what, 2848c2ecf20Sopenharmony_ci struct bio_and_error *m); 2858c2ecf20Sopenharmony_ciextern void complete_master_bio(struct drbd_device *device, 2868c2ecf20Sopenharmony_ci struct bio_and_error *m); 2878c2ecf20Sopenharmony_ciextern void request_timer_fn(struct timer_list *t); 2888c2ecf20Sopenharmony_ciextern void tl_restart(struct drbd_connection *connection, enum drbd_req_event what); 2898c2ecf20Sopenharmony_ciextern void _tl_restart(struct drbd_connection *connection, enum drbd_req_event what); 2908c2ecf20Sopenharmony_ciextern void tl_abort_disk_io(struct drbd_device *device); 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci/* this is in drbd_main.c */ 2938c2ecf20Sopenharmony_ciextern void drbd_restart_request(struct drbd_request *req); 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci/* use this if you don't want to deal with calling complete_master_bio() 2968c2ecf20Sopenharmony_ci * outside the spinlock, e.g. when walking some list on cleanup. */ 2978c2ecf20Sopenharmony_cistatic inline int _req_mod(struct drbd_request *req, enum drbd_req_event what) 2988c2ecf20Sopenharmony_ci{ 2998c2ecf20Sopenharmony_ci struct drbd_device *device = req->device; 3008c2ecf20Sopenharmony_ci struct bio_and_error m; 3018c2ecf20Sopenharmony_ci int rv; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci /* __req_mod possibly frees req, do not touch req after that! */ 3048c2ecf20Sopenharmony_ci rv = __req_mod(req, what, &m); 3058c2ecf20Sopenharmony_ci if (m.bio) 3068c2ecf20Sopenharmony_ci complete_master_bio(device, &m); 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ci return rv; 3098c2ecf20Sopenharmony_ci} 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci/* completion of master bio is outside of our spinlock. 3128c2ecf20Sopenharmony_ci * We still may or may not be inside some irqs disabled section 3138c2ecf20Sopenharmony_ci * of the lower level driver completion callback, so we need to 3148c2ecf20Sopenharmony_ci * spin_lock_irqsave here. */ 3158c2ecf20Sopenharmony_cistatic inline int req_mod(struct drbd_request *req, 3168c2ecf20Sopenharmony_ci enum drbd_req_event what) 3178c2ecf20Sopenharmony_ci{ 3188c2ecf20Sopenharmony_ci unsigned long flags; 3198c2ecf20Sopenharmony_ci struct drbd_device *device = req->device; 3208c2ecf20Sopenharmony_ci struct bio_and_error m; 3218c2ecf20Sopenharmony_ci int rv; 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci spin_lock_irqsave(&device->resource->req_lock, flags); 3248c2ecf20Sopenharmony_ci rv = __req_mod(req, what, &m); 3258c2ecf20Sopenharmony_ci spin_unlock_irqrestore(&device->resource->req_lock, flags); 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci if (m.bio) 3288c2ecf20Sopenharmony_ci complete_master_bio(device, &m); 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci return rv; 3318c2ecf20Sopenharmony_ci} 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ciextern bool drbd_should_do_remote(union drbd_dev_state); 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_ci#endif 336