linux/drivers/block/drbd/drbd_worker.c

// SPDX-License-Identifier: GPL-2.0-only
/*
   drbd_worker.c

   This file is part of DRBD by Philipp Reisner and Lars Ellenberg.

   Copyright (C) 2001-2008, LINBIT Information Technologies GmbH.
   Copyright (C) 1999-2008, Philipp Reisner <[email protected]>.
   Copyright (C) 2002-2008, Lars Ellenberg <[email protected]>.


*/

#include <linux/module.h>
#include <linux/drbd.h>
#include <linux/sched/signal.h>
#include <linux/wait.h>
#include <linux/mm.h>
#include <linux/memcontrol.h>
#include <linux/mm_inline.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/string.h>
#include <linux/scatterlist.h>
#include <linux/part_stat.h>

#include "drbd_int.h"
#include "drbd_protocol.h"
#include "drbd_req.h"

static int make_ov_request(struct drbd_peer_device *, int);
static int make_resync_request(struct drbd_peer_device *, int);

/* endio handlers:
 *   drbd_md_endio (defined here)
 *   drbd_request_endio (defined here)
 *   drbd_peer_request_endio (defined here)
 *   drbd_bm_endio (defined in drbd_bitmap.c)
 *
 * For all these callbacks, note the following:
 * The callbacks will be called in irq context by the IDE drivers,
 * and in Softirqs/Tasklets/BH context by the SCSI drivers.
 * Try to get the locking right :)
 *
 */

/* used for synchronous meta data and bitmap IO
 * submitted by drbd_md_sync_page_io()
 */
void drbd_md_endio(struct bio *bio)
{}

/* reads on behalf of the partner,
 * "submitted" by the receiver
 */
static void drbd_endio_read_sec_final(struct drbd_peer_request *peer_req) __releases(local)
{}

/* writes on behalf of the partner, or resync writes,
 * "submitted" by the receiver, final stage.  */
void drbd_endio_write_sec_final(struct drbd_peer_request *peer_req) __releases(local)
{}

/* writes on behalf of the partner, or resync writes,
 * "submitted" by the receiver.
 */
void drbd_peer_request_endio(struct bio *bio)
{}

static void
drbd_panic_after_delayed_completion_of_aborted_request(struct drbd_device *device)
{}

/* read, readA or write requests on R_PRIMARY coming from drbd_make_request
 */
void drbd_request_endio(struct bio *bio)
{}

void drbd_csum_ee(struct crypto_shash *tfm, struct drbd_peer_request *peer_req, void *digest)
{}

void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest)
{}

/* MAYBE merge common code with w_e_end_ov_req */
static int w_e_send_csum(struct drbd_work *w, int cancel)
{}

#define GFP_TRY

static int read_for_csum(struct drbd_peer_device *peer_device, sector_t sector, int size)
{}

int w_resync_timer(struct drbd_work *w, int cancel)
{}

void resync_timer_fn(struct timer_list *t)
{}

static void fifo_set(struct fifo_buffer *fb, int value)
{}

static int fifo_push(struct fifo_buffer *fb, int value)
{}

static void fifo_add_val(struct fifo_buffer *fb, int value)
{}

struct fifo_buffer *fifo_alloc(unsigned int fifo_size)
{}

static int drbd_rs_controller(struct drbd_peer_device *peer_device, unsigned int sect_in)
{}

static int drbd_rs_number_requests(struct drbd_peer_device *peer_device)
{}

static int make_resync_request(struct drbd_peer_device *const peer_device, int cancel)
{}

static int make_ov_request(struct drbd_peer_device *peer_device, int cancel)
{}

int w_ov_finished(struct drbd_work *w, int cancel)
{}

static int w_resync_finished(struct drbd_work *w, int cancel)
{}

static void ping_peer(struct drbd_device *device)
{}

int drbd_resync_finished(struct drbd_peer_device *peer_device)
{}

/* helper */
static void move_to_net_ee_or_free(struct drbd_device *device, struct drbd_peer_request *peer_req)
{}

/**
 * w_e_end_data_req() - Worker callback, to send a P_DATA_REPLY packet in response to a P_DATA_REQUEST
 * @w:		work object.
 * @cancel:	The connection will be closed anyways
 */
int w_e_end_data_req(struct drbd_work *w, int cancel)
{}

static bool all_zero(struct drbd_peer_request *peer_req)
{}

/**
 * w_e_end_rsdata_req() - Worker callback to send a P_RS_DATA_REPLY packet in response to a P_RS_DATA_REQUEST
 * @w:		work object.
 * @cancel:	The connection will be closed anyways
 */
int w_e_end_rsdata_req(struct drbd_work *w, int cancel)
{}

int w_e_end_csum_rs_req(struct drbd_work *w, int cancel)
{}

int w_e_end_ov_req(struct drbd_work *w, int cancel)
{}

void drbd_ov_out_of_sync_found(struct drbd_peer_device *peer_device, sector_t sector, int size)
{}

int w_e_end_ov_reply(struct drbd_work *w, int cancel)
{}

/* FIXME
 * We need to track the number of pending barrier acks,
 * and to be able to wait for them.
 * See also comment in drbd_adm_attach before drbd_suspend_io.
 */
static int drbd_send_barrier(struct drbd_connection *connection)
{}

static int pd_send_unplug_remote(struct drbd_peer_device *pd)
{}

int w_send_write_hint(struct drbd_work *w, int cancel)
{}

static void re_init_if_first_write(struct drbd_connection *connection, unsigned int epoch)
{}

static void maybe_send_barrier(struct drbd_connection *connection, unsigned int epoch)
{}

int w_send_out_of_sync(struct drbd_work *w, int cancel)
{}

/**
 * w_send_dblock() - Worker callback to send a P_DATA packet in order to mirror a write request
 * @w:		work object.
 * @cancel:	The connection will be closed anyways
 */
int w_send_dblock(struct drbd_work *w, int cancel)
{}

/**
 * w_send_read_req() - Worker callback to send a read request (P_DATA_REQUEST) packet
 * @w:		work object.
 * @cancel:	The connection will be closed anyways
 */
int w_send_read_req(struct drbd_work *w, int cancel)
{}

int w_restart_disk_io(struct drbd_work *w, int cancel)
{}

static int _drbd_may_sync_now(struct drbd_device *device)
{}

/**
 * drbd_pause_after() - Pause resync on all devices that may not resync now
 * @device:	DRBD device.
 *
 * Called from process context only (admin command and after_state_ch).
 */
static bool drbd_pause_after(struct drbd_device *device)
{}

/**
 * drbd_resume_next() - Resume resync on all devices that may resync now
 * @device:	DRBD device.
 *
 * Called from process context only (admin command and worker).
 */
static bool drbd_resume_next(struct drbd_device *device)
{}

void resume_next_sg(struct drbd_device *device)
{}

void suspend_other_sg(struct drbd_device *device)
{}

/* caller must lock_all_resources() */
enum drbd_ret_code drbd_resync_after_valid(struct drbd_device *device, int o_minor)
{}

/* caller must lock_all_resources() */
void drbd_resync_after_changed(struct drbd_device *device)
{}

void drbd_rs_controller_reset(struct drbd_peer_device *peer_device)
{}

void start_resync_timer_fn(struct timer_list *t)
{}

static void do_start_resync(struct drbd_device *device)
{}

static bool use_checksum_based_resync(struct drbd_connection *connection, struct drbd_device *device)
{}

/**
 * drbd_start_resync() - Start the resync process
 * @device:	DRBD device.
 * @side:	Either C_SYNC_SOURCE or C_SYNC_TARGET
 *
 * This function might bring you directly into one of the
 * C_PAUSED_SYNC_* states.
 */
void drbd_start_resync(struct drbd_device *device, enum drbd_conns side)
{}

static void update_on_disk_bitmap(struct drbd_peer_device *peer_device, bool resync_done)
{}

static void drbd_ldev_destroy(struct drbd_device *device)
{}

static void go_diskless(struct drbd_device *device)
{}

static int do_md_sync(struct drbd_device *device)
{}

/* only called from drbd_worker thread, no locking */
void __update_timing_details(
		struct drbd_thread_timing_details *tdp,
		unsigned int *cb_nr,
		void *cb,
		const char *fn, const unsigned int line)
{}

static void do_device_work(struct drbd_device *device, const unsigned long todo)
{}

#define DRBD_DEVICE_WORK_MASK

static unsigned long get_work_bits(unsigned long *flags)
{}

static void do_unqueued_work(struct drbd_connection *connection)
{}

static bool dequeue_work_batch(struct drbd_work_queue *queue, struct list_head *work_list)
{}

static void wait_for_work(struct drbd_connection *connection, struct list_head *work_list)
{}

int drbd_worker(struct drbd_thread *thi)
{}