linux/fs/iomap/iter.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2010 Red Hat, Inc.
 * Copyright (c) 2016-2021 Christoph Hellwig.
 */
#include <linux/fs.h>
#include <linux/iomap.h>
#include "trace.h"

/*
 * Advance to the next range we need to map.
 *
 * If the iomap is marked IOMAP_F_STALE, it means the existing map was not fully
 * processed - it was aborted because the extent the iomap spanned may have been
 * changed during the operation. In this case, the iteration behaviour is to
 * remap the unprocessed range of the iter, and that means we may need to remap
 * even when we've made no progress (i.e. iter->processed = 0). Hence the
 * "finished iterating" case needs to distinguish between
 * (processed = 0) meaning we are done and (processed = 0 && stale) meaning we
 * need to remap the entire remaining range.
 */
static inline int iomap_iter_advance(struct iomap_iter *iter)
{}

static inline void iomap_iter_done(struct iomap_iter *iter)
{}

/**
 * iomap_iter - iterate over a ranges in a file
 * @iter: iteration structue
 * @ops: iomap ops provided by the file system
 *
 * Iterate over filesystem-provided space mappings for the provided file range.
 *
 * This function handles cleanup of resources acquired for iteration when the
 * filesystem indicates there are no more space mappings, which means that this
 * function must be called in a loop that continues as long it returns a
 * positive value.  If 0 or a negative value is returned, the caller must not
 * return to the loop body.  Within a loop body, there are two ways to break out
 * of the loop body:  leave @iter.processed unchanged, or set it to a negative
 * errno.
 */
int iomap_iter(struct iomap_iter *iter, const struct iomap_ops *ops)
{}