linux/fs/ext4/mballoc.h

// SPDX-License-Identifier: GPL-2.0
/*
 *  fs/ext4/mballoc.h
 *
 *  Written by: Alex Tomas <[email protected]>
 *
 */
#ifndef _EXT4_MBALLOC_H
#define _EXT4_MBALLOC_H

#include <linux/time.h>
#include <linux/fs.h>
#include <linux/namei.h>
#include <linux/quotaops.h>
#include <linux/buffer_head.h>
#include <linux/module.h>
#include <linux/swap.h>
#include <linux/proc_fs.h>
#include <linux/pagemap.h>
#include <linux/seq_file.h>
#include <linux/blkdev.h>
#include <linux/mutex.h>
#include "ext4_jbd2.h"
#include "ext4.h"

/*
 * mb_debug() dynamic printk msgs could be used to debug mballoc code.
 */
#ifdef CONFIG_EXT4_DEBUG
#define mb_debug(sb, fmt, ...)
#else
#define mb_debug
#endif

#define EXT4_MB_HISTORY_ALLOC
#define EXT4_MB_HISTORY_PREALLOC

/*
 * How long mballoc can look for a best extent (in found extents)
 */
#define MB_DEFAULT_MAX_TO_SCAN

/*
 * How long mballoc must look for a best extent
 */
#define MB_DEFAULT_MIN_TO_SCAN

/*
 * with 's_mb_stats' allocator will collect stats that will be
 * shown at umount. The collecting costs though!
 */
#define MB_DEFAULT_STATS

/*
 * files smaller than MB_DEFAULT_STREAM_THRESHOLD are served
 * by the stream allocator, which purpose is to pack requests
 * as close each to other as possible to produce smooth I/O traffic
 * We use locality group prealloc space for stream request.
 * We can tune the same via /proc/fs/ext4/<partition>/stream_req
 */
#define MB_DEFAULT_STREAM_THRESHOLD

/*
 * for which requests use 2^N search using buddies
 */
#define MB_DEFAULT_ORDER2_REQS

/*
 * default group prealloc size 512 blocks
 */
#define MB_DEFAULT_GROUP_PREALLOC

/*
 * Number of groups to search linearly before performing group scanning
 * optimization.
 */
#define MB_DEFAULT_LINEAR_LIMIT

/*
 * Minimum number of groups that should be present in the file system to perform
 * group scanning optimizations.
 */
#define MB_DEFAULT_LINEAR_SCAN_THRESHOLD

/*
 * The maximum order upto which CR_BEST_AVAIL_LEN can trim a particular
 * allocation request. Example, if we have an order 7 request and max trim order
 * of 3, we can trim this request upto order 4.
 */
#define MB_DEFAULT_BEST_AVAIL_TRIM_ORDER

/*
 * Number of valid buddy orders
 */
#define MB_NUM_ORDERS(sb)

struct ext4_free_data {};

struct ext4_prealloc_space {};

enum {};

struct ext4_free_extent {};

/*
 * Locality group:
 *   we try to group all related changes together
 *   so that writeback can flush/allocate them together as well
 *   Size of lg_prealloc_list hash is determined by MB_DEFAULT_GROUP_PREALLOC
 *   (512). We store prealloc space into the hash based on the pa_free blocks
 *   order value.ie, fls(pa_free)-1;
 */
#define PREALLOC_TB_SIZE
struct ext4_locality_group {};

struct ext4_allocation_context {};

#define AC_STATUS_CONTINUE
#define AC_STATUS_FOUND
#define AC_STATUS_BREAK

struct ext4_buddy {};

static inline ext4_fsblk_t ext4_grp_offs_to_block(struct super_block *sb,
					struct ext4_free_extent *fex)
{}

static inline loff_t extent_logical_end(struct ext4_sb_info *sbi,
					struct ext4_free_extent *fex)
{}

static inline loff_t pa_logical_end(struct ext4_sb_info *sbi,
				    struct ext4_prealloc_space *pa)
{}

ext4_mballoc_query_range_fn;

int
ext4_mballoc_query_range(
	struct super_block		*sb,
	ext4_group_t			agno,
	ext4_grpblk_t			start,
	ext4_grpblk_t			end,
	ext4_mballoc_query_range_fn	formatter,
	void				*priv);

#endif