linux/drivers/block/drbd/drbd_actlog.c

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

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

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


 */

#include <linux/slab.h>
#include <linux/crc32c.h>
#include <linux/drbd.h>
#include <linux/drbd_limits.h>
#include "drbd_int.h"


enum al_transaction_types {};
/* all fields on disc in big endian */
struct __packed al_transaction_on_disk {};

void *drbd_md_get_buffer(struct drbd_device *device, const char *intent)
{}

void drbd_md_put_buffer(struct drbd_device *device)
{}

void wait_until_done_or_force_detached(struct drbd_device *device, struct drbd_backing_dev *bdev,
				     unsigned int *done)
{}

static int _drbd_md_sync_page_io(struct drbd_device *device,
				 struct drbd_backing_dev *bdev,
				 sector_t sector, enum req_op op)
{}

int drbd_md_sync_page_io(struct drbd_device *device, struct drbd_backing_dev *bdev,
			 sector_t sector, enum req_op op)
{}

static struct bm_extent *find_active_resync_extent(struct drbd_device *device, unsigned int enr)
{}

static struct lc_element *_al_get(struct drbd_device *device, unsigned int enr, bool nonblock)
{}

bool drbd_al_begin_io_fastpath(struct drbd_device *device, struct drbd_interval *i)
{}

bool drbd_al_begin_io_prepare(struct drbd_device *device, struct drbd_interval *i)
{}

#if (PAGE_SHIFT + 3) < (AL_EXTENT_SHIFT - BM_BLOCK_SHIFT)
/* Currently BM_BLOCK_SHIFT, BM_EXT_SHIFT and AL_EXTENT_SHIFT
 * are still coupled, or assume too much about their relation.
 * Code below will not work if this is violated.
 * Will be cleaned up with some followup patch.
 */
# error FIXME
#endif

static unsigned int al_extent_to_bm_page(unsigned int al_enr)
{}

static sector_t al_tr_number_to_on_disk_sector(struct drbd_device *device)
{}

static int __al_write_transaction(struct drbd_device *device, struct al_transaction_on_disk *buffer)
{}

static int al_write_transaction(struct drbd_device *device)
{}


void drbd_al_begin_io_commit(struct drbd_device *device)
{}

/*
 * @delegate:   delegate activity log I/O to the worker thread
 */
void drbd_al_begin_io(struct drbd_device *device, struct drbd_interval *i)
{}

int drbd_al_begin_io_nonblock(struct drbd_device *device, struct drbd_interval *i)
{}

void drbd_al_complete_io(struct drbd_device *device, struct drbd_interval *i)
{}

static int _try_lc_del(struct drbd_device *device, struct lc_element *al_ext)
{}

/**
 * drbd_al_shrink() - Removes all active extents form the activity log
 * @device:	DRBD device.
 *
 * Removes all active extents form the activity log, waiting until
 * the reference count of each entry dropped to 0 first, of course.
 *
 * You need to lock device->act_log with lc_try_lock() / lc_unlock()
 */
void drbd_al_shrink(struct drbd_device *device)
{}

int drbd_al_initialize(struct drbd_device *device, void *buffer)
{}

static const char *drbd_change_sync_fname[] =;

/* ATTENTION. The AL's extents are 4MB each, while the extents in the
 * resync LRU-cache are 16MB each.
 * The caller of this function has to hold an get_ldev() reference.
 *
 * Adjusts the caching members ->rs_left (success) or ->rs_failed (!success),
 * potentially pulling in (and recounting the corresponding bits)
 * this resync extent into the resync extent lru cache.
 *
 * Returns whether all bits have been cleared for this resync extent,
 * precisely: (rs_left <= rs_failed)
 *
 * TODO will be obsoleted once we have a caching lru of the on disk bitmap
 */
static bool update_rs_extent(struct drbd_device *device,
		unsigned int enr, int count,
		enum update_sync_bits_mode mode)
{}

void drbd_advance_rs_marks(struct drbd_peer_device *peer_device, unsigned long still_to_go)
{}

/* It is called lazy update, so don't do write-out too often. */
static bool lazy_bitmap_update_due(struct drbd_device *device)
{}

static void maybe_schedule_on_disk_bitmap_update(struct drbd_device *device, bool rs_done)
{}

static int update_sync_bits(struct drbd_device *device,
		unsigned long sbnr, unsigned long ebnr,
		enum update_sync_bits_mode mode)
{}

static bool plausible_request_size(int size)
{}

/* clear the bit corresponding to the piece of storage in question:
 * size byte of data starting from sector.  Only clear bits of the affected
 * one or more _aligned_ BM_BLOCK_SIZE blocks.
 *
 * called by worker on C_SYNC_TARGET and receiver on SyncSource.
 *
 */
int __drbd_change_sync(struct drbd_peer_device *peer_device, sector_t sector, int size,
		enum update_sync_bits_mode mode)
{}

static
struct bm_extent *_bme_get(struct drbd_device *device, unsigned int enr)
{}

static int _is_in_al(struct drbd_device *device, unsigned int enr)
{}

/**
 * drbd_rs_begin_io() - Gets an extent in the resync LRU cache and sets it to BME_LOCKED
 * @device:	DRBD device.
 * @sector:	The sector number.
 *
 * This functions sleeps on al_wait.
 *
 * Returns: %0 on success, -EINTR if interrupted.
 */
int drbd_rs_begin_io(struct drbd_device *device, sector_t sector)
{}

/**
 * drbd_try_rs_begin_io() - Gets an extent in the resync LRU cache, does not sleep
 * @peer_device: DRBD device.
 * @sector:	The sector number.
 *
 * Gets an extent in the resync LRU cache, sets it to BME_NO_WRITES, then
 * tries to set it to BME_LOCKED.
 *
 * Returns: %0 upon success, and -EAGAIN
 * if there is still application IO going on in this area.
 */
int drbd_try_rs_begin_io(struct drbd_peer_device *peer_device, sector_t sector)
{}

void drbd_rs_complete_io(struct drbd_device *device, sector_t sector)
{}

/**
 * drbd_rs_cancel_all() - Removes all extents from the resync LRU (even BME_LOCKED)
 * @device:	DRBD device.
 */
void drbd_rs_cancel_all(struct drbd_device *device)
{}

/**
 * drbd_rs_del_all() - Gracefully remove all extents from the resync LRU
 * @device:	DRBD device.
 *
 * Returns: %0 upon success, -EAGAIN if at least one reference count was
 * not zero.
 */
int drbd_rs_del_all(struct drbd_device *device)
{}