linux/fs/zonefs/file.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Simple file system for zoned block devices exposing zones as files.
 *
 * Copyright (C) 2022 Western Digital Corporation or its affiliates.
 */
#include <linux/module.h>
#include <linux/pagemap.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/parser.h>
#include <linux/uio.h>
#include <linux/mman.h>
#include <linux/sched/mm.h>
#include <linux/task_io_accounting_ops.h>

#include "zonefs.h"

#include "trace.h"

static int zonefs_read_iomap_begin(struct inode *inode, loff_t offset,
				   loff_t length, unsigned int flags,
				   struct iomap *iomap, struct iomap *srcmap)
{}

static const struct iomap_ops zonefs_read_iomap_ops =;

static int zonefs_write_iomap_begin(struct inode *inode, loff_t offset,
				    loff_t length, unsigned int flags,
				    struct iomap *iomap, struct iomap *srcmap)
{}

static const struct iomap_ops zonefs_write_iomap_ops =;

static int zonefs_read_folio(struct file *unused, struct folio *folio)
{}

static void zonefs_readahead(struct readahead_control *rac)
{}

/*
 * Map blocks for page writeback. This is used only on conventional zone files,
 * which implies that the page range can only be within the fixed inode size.
 */
static int zonefs_write_map_blocks(struct iomap_writepage_ctx *wpc,
				   struct inode *inode, loff_t offset,
				   unsigned int len)
{}

static const struct iomap_writeback_ops zonefs_writeback_ops =;

static int zonefs_writepages(struct address_space *mapping,
			     struct writeback_control *wbc)
{}

static int zonefs_swap_activate(struct swap_info_struct *sis,
				struct file *swap_file, sector_t *span)
{}

const struct address_space_operations zonefs_file_aops =;

int zonefs_file_truncate(struct inode *inode, loff_t isize)
{}

static int zonefs_file_fsync(struct file *file, loff_t start, loff_t end,
			     int datasync)
{}

static vm_fault_t zonefs_filemap_page_mkwrite(struct vm_fault *vmf)
{}

static const struct vm_operations_struct zonefs_file_vm_ops =;

static int zonefs_file_mmap(struct file *file, struct vm_area_struct *vma)
{}

static loff_t zonefs_file_llseek(struct file *file, loff_t offset, int whence)
{}

static int zonefs_file_write_dio_end_io(struct kiocb *iocb, ssize_t size,
					int error, unsigned int flags)
{}

static const struct iomap_dio_ops zonefs_write_dio_ops =;

/*
 * Do not exceed the LFS limits nor the file zone size. If pos is under the
 * limit it becomes a short access. If it exceeds the limit, return -EFBIG.
 */
static loff_t zonefs_write_check_limits(struct file *file, loff_t pos,
					loff_t count)
{}

static ssize_t zonefs_write_checks(struct kiocb *iocb, struct iov_iter *from)
{}

/*
 * Handle direct writes. For sequential zone files, this is the only possible
 * write path. For these files, check that the user is issuing writes
 * sequentially from the end of the file. This code assumes that the block layer
 * delivers write requests to the device in sequential order. This is always the
 * case if a block IO scheduler implementing the ELEVATOR_F_ZBD_SEQ_WRITE
 * elevator feature is being used (e.g. mq-deadline). The block layer always
 * automatically select such an elevator for zoned block devices during the
 * device initialization.
 */
static ssize_t zonefs_file_dio_write(struct kiocb *iocb, struct iov_iter *from)
{}

static ssize_t zonefs_file_buffered_write(struct kiocb *iocb,
					  struct iov_iter *from)
{}

static ssize_t zonefs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
{}

static int zonefs_file_read_dio_end_io(struct kiocb *iocb, ssize_t size,
				       int error, unsigned int flags)
{}

static const struct iomap_dio_ops zonefs_read_dio_ops =;

static ssize_t zonefs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
{}

static ssize_t zonefs_file_splice_read(struct file *in, loff_t *ppos,
				       struct pipe_inode_info *pipe,
				       size_t len, unsigned int flags)
{}

/*
 * Write open accounting is done only for sequential files.
 */
static inline bool zonefs_seq_file_need_wro(struct inode *inode,
					    struct file *file)
{}

static int zonefs_seq_file_write_open(struct inode *inode)
{}

static int zonefs_file_open(struct inode *inode, struct file *file)
{}

static void zonefs_seq_file_write_close(struct inode *inode)
{}

static int zonefs_file_release(struct inode *inode, struct file *file)
{}

const struct file_operations zonefs_file_operations =;