linux/fs/zonefs/super.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Simple file system for zoned block devices exposing zones as files.
 *
 * Copyright (C) 2019 Western Digital Corporation or its affiliates.
 */
#include <linux/module.h>
#include <linux/pagemap.h>
#include <linux/magic.h>
#include <linux/iomap.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/statfs.h>
#include <linux/writeback.h>
#include <linux/quotaops.h>
#include <linux/seq_file.h>
#include <linux/uio.h>
#include <linux/mman.h>
#include <linux/sched/mm.h>
#include <linux/crc32.h>
#include <linux/task_io_accounting_ops.h>
#include <linux/fs_parser.h>
#include <linux/fs_context.h>

#include "zonefs.h"

#define CREATE_TRACE_POINTS
#include "trace.h"

/*
 * Get the name of a zone group directory.
 */
static const char *zonefs_zgroup_name(enum zonefs_ztype ztype)
{}

/*
 * Manage the active zone count.
 */
static void zonefs_account_active(struct super_block *sb,
				  struct zonefs_zone *z)
{}

/*
 * Manage the active zone count. Called with zi->i_truncate_mutex held.
 */
void zonefs_inode_account_active(struct inode *inode)
{}

/*
 * Execute a zone management operation.
 */
static int zonefs_zone_mgmt(struct super_block *sb,
			    struct zonefs_zone *z, enum req_op op)
{}

int zonefs_inode_zone_mgmt(struct inode *inode, enum req_op op)
{}

void zonefs_i_size_write(struct inode *inode, loff_t isize)
{}

void zonefs_update_stats(struct inode *inode, loff_t new_isize)
{}

/*
 * Check a zone condition. Return the amount of written (and still readable)
 * data in the zone.
 */
static loff_t zonefs_check_zone_condition(struct super_block *sb,
					  struct zonefs_zone *z,
					  struct blk_zone *zone)
{}

/*
 * Check a zone condition and adjust its inode access permissions for
 * offline and readonly zones.
 */
static void zonefs_inode_update_mode(struct inode *inode)
{}

static int zonefs_io_error_cb(struct blk_zone *zone, unsigned int idx,
			      void *data)
{}

static void zonefs_handle_io_error(struct inode *inode, struct blk_zone *zone,
				   bool write)
{}

/*
 * When an file IO error occurs, check the file zone to see if there is a change
 * in the zone condition (e.g. offline or read-only). For a failed write to a
 * sequential zone, the zone write pointer position must also be checked to
 * eventually correct the file size and zonefs inode write pointer offset
 * (which can be out of sync with the drive due to partial write failures).
 */
void __zonefs_io_error(struct inode *inode, bool write)
{}

static struct kmem_cache *zonefs_inode_cachep;

static struct inode *zonefs_alloc_inode(struct super_block *sb)
{}

static void zonefs_free_inode(struct inode *inode)
{}

/*
 * File system stat.
 */
static int zonefs_statfs(struct dentry *dentry, struct kstatfs *buf)
{}

enum {};

struct zonefs_context {};

static const struct constant_table zonefs_param_errors[] =;

static const struct fs_parameter_spec zonefs_param_spec[] =;

static int zonefs_parse_param(struct fs_context *fc, struct fs_parameter *param)
{}

static int zonefs_show_options(struct seq_file *seq, struct dentry *root)
{}

static int zonefs_inode_setattr(struct mnt_idmap *idmap,
				struct dentry *dentry, struct iattr *iattr)
{}

static const struct inode_operations zonefs_file_inode_operations =;

static long zonefs_fname_to_fno(const struct qstr *fname)
{}

static struct inode *zonefs_get_file_inode(struct inode *dir,
					   struct dentry *dentry)
{}

static struct inode *zonefs_get_zgroup_inode(struct super_block *sb,
					     enum zonefs_ztype ztype)
{}


static struct inode *zonefs_get_dir_inode(struct inode *dir,
					  struct dentry *dentry)
{}

static struct dentry *zonefs_lookup(struct inode *dir, struct dentry *dentry,
				    unsigned int flags)
{}

static int zonefs_readdir_root(struct file *file, struct dir_context *ctx)
{}

static int zonefs_readdir_zgroup(struct file *file,
				 struct dir_context *ctx)
{}

static int zonefs_readdir(struct file *file, struct dir_context *ctx)
{}

const struct inode_operations zonefs_dir_inode_operations =;

const struct file_operations zonefs_dir_operations =;

struct zonefs_zone_data {};

static int zonefs_get_zone_info_cb(struct blk_zone *zone, unsigned int idx,
				   void *data)
{}

static int zonefs_get_zone_info(struct zonefs_zone_data *zd)
{}

static inline void zonefs_free_zone_info(struct zonefs_zone_data *zd)
{}

/*
 * Create a zone group and populate it with zone files.
 */
static int zonefs_init_zgroup(struct super_block *sb,
			      struct zonefs_zone_data *zd,
			      enum zonefs_ztype ztype)
{}

static void zonefs_free_zgroups(struct super_block *sb)
{}

/*
 * Create a zone group and populate it with zone files.
 */
static int zonefs_init_zgroups(struct super_block *sb)
{}

/*
 * Read super block information from the device.
 */
static int zonefs_read_super(struct super_block *sb)
{}

static const struct super_operations zonefs_sops =;

static int zonefs_get_zgroup_inodes(struct super_block *sb)
{}

static void zonefs_release_zgroup_inodes(struct super_block *sb)
{}

/*
 * Check that the device is zoned. If it is, get the list of zones and create
 * sub-directories and files according to the device zone configuration and
 * format options.
 */
static int zonefs_fill_super(struct super_block *sb, struct fs_context *fc)
{}

static void zonefs_kill_super(struct super_block *sb)
{}

static void zonefs_free_fc(struct fs_context *fc)
{}

static int zonefs_get_tree(struct fs_context *fc)
{}

static int zonefs_reconfigure(struct fs_context *fc)
{}

static const struct fs_context_operations zonefs_context_ops =;

/*
 * Set up the filesystem mount context.
 */
static int zonefs_init_fs_context(struct fs_context *fc)
{}

/*
 * File system definition and registration.
 */
static struct file_system_type zonefs_type =;

static int __init zonefs_init_inodecache(void)
{}

static void zonefs_destroy_inodecache(void)
{}

static int __init zonefs_init(void)
{}

static void __exit zonefs_exit(void)
{}

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS_FS();
module_init();
module_exit(zonefs_exit);