linux/fs/nilfs2/inode.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * NILFS inode operations.
 *
 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
 *
 * Written by Ryusuke Konishi.
 *
 */

#include <linux/buffer_head.h>
#include <linux/gfp.h>
#include <linux/mpage.h>
#include <linux/pagemap.h>
#include <linux/writeback.h>
#include <linux/uio.h>
#include <linux/fiemap.h>
#include "nilfs.h"
#include "btnode.h"
#include "segment.h"
#include "page.h"
#include "mdt.h"
#include "cpfile.h"
#include "ifile.h"

/**
 * struct nilfs_iget_args - arguments used during comparison between inodes
 * @ino: inode number
 * @cno: checkpoint number
 * @root: pointer on NILFS root object (mounted checkpoint)
 * @for_gc: inode for GC flag
 * @for_btnc: inode for B-tree node cache flag
 * @for_shadow: inode for shadowed page cache flag
 */
struct nilfs_iget_args {};

static int nilfs_iget_test(struct inode *inode, void *opaque);

void nilfs_inode_add_blocks(struct inode *inode, int n)
{}

void nilfs_inode_sub_blocks(struct inode *inode, int n)
{}

/**
 * nilfs_get_block() - get a file block on the filesystem (callback function)
 * @inode: inode struct of the target file
 * @blkoff: file block number
 * @bh_result: buffer head to be mapped on
 * @create: indicate whether allocating the block or not when it has not
 *      been allocated yet.
 *
 * This function does not issue actual read request of the specified data
 * block. It is done by VFS.
 */
int nilfs_get_block(struct inode *inode, sector_t blkoff,
		    struct buffer_head *bh_result, int create)
{}

/**
 * nilfs_read_folio() - implement read_folio() method of nilfs_aops {}
 * address_space_operations.
 * @file: file struct of the file to be read
 * @folio: the folio to be read
 */
static int nilfs_read_folio(struct file *file, struct folio *folio)
{}

static void nilfs_readahead(struct readahead_control *rac)
{}

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

static int nilfs_writepage(struct page *page, struct writeback_control *wbc)
{}

static bool nilfs_dirty_folio(struct address_space *mapping,
		struct folio *folio)
{}

void nilfs_write_failed(struct address_space *mapping, loff_t to)
{}

static int nilfs_write_begin(struct file *file, struct address_space *mapping,
			     loff_t pos, unsigned len,
			     struct page **pagep, void **fsdata)

{}

static int nilfs_write_end(struct file *file, struct address_space *mapping,
			   loff_t pos, unsigned len, unsigned copied,
			   struct page *page, void *fsdata)
{}

static ssize_t
nilfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
{}

const struct address_space_operations nilfs_aops =;

static int nilfs_insert_inode_locked(struct inode *inode,
				     struct nilfs_root *root,
				     unsigned long ino)
{}

struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
{}

void nilfs_set_inode_flags(struct inode *inode)
{}

int nilfs_read_inode_common(struct inode *inode,
			    struct nilfs_inode *raw_inode)
{}

static int __nilfs_read_inode(struct super_block *sb,
			      struct nilfs_root *root, unsigned long ino,
			      struct inode *inode)
{}

static int nilfs_iget_test(struct inode *inode, void *opaque)
{}

static int nilfs_iget_set(struct inode *inode, void *opaque)
{}

struct inode *nilfs_ilookup(struct super_block *sb, struct nilfs_root *root,
			    unsigned long ino)
{}

struct inode *nilfs_iget_locked(struct super_block *sb, struct nilfs_root *root,
				unsigned long ino)
{}

struct inode *nilfs_iget(struct super_block *sb, struct nilfs_root *root,
			 unsigned long ino)
{}

struct inode *nilfs_iget_for_gc(struct super_block *sb, unsigned long ino,
				__u64 cno)
{}

/**
 * nilfs_attach_btree_node_cache - attach a B-tree node cache to the inode
 * @inode: inode object
 *
 * nilfs_attach_btree_node_cache() attaches a B-tree node cache to @inode,
 * or does nothing if the inode already has it.  This function allocates
 * an additional inode to maintain page cache of B-tree nodes one-on-one.
 *
 * Return Value: On success, 0 is returned. On errors, one of the following
 * negative error code is returned.
 *
 * %-ENOMEM - Insufficient memory available.
 */
int nilfs_attach_btree_node_cache(struct inode *inode)
{}

/**
 * nilfs_detach_btree_node_cache - detach the B-tree node cache from the inode
 * @inode: inode object
 *
 * nilfs_detach_btree_node_cache() detaches the B-tree node cache and its
 * holder inode bound to @inode, or does nothing if @inode doesn't have it.
 */
void nilfs_detach_btree_node_cache(struct inode *inode)
{}

/**
 * nilfs_iget_for_shadow - obtain inode for shadow mapping
 * @inode: inode object that uses shadow mapping
 *
 * nilfs_iget_for_shadow() allocates a pair of inodes that holds page
 * caches for shadow mapping.  The page cache for data pages is set up
 * in one inode and the one for b-tree node pages is set up in the
 * other inode, which is attached to the former inode.
 *
 * Return Value: On success, a pointer to the inode for data pages is
 * returned. On errors, one of the following negative error code is returned
 * in a pointer type.
 *
 * %-ENOMEM - Insufficient memory available.
 */
struct inode *nilfs_iget_for_shadow(struct inode *inode)
{}

/**
 * nilfs_write_inode_common - export common inode information to on-disk inode
 * @inode:     inode object
 * @raw_inode: on-disk inode
 *
 * This function writes standard information from the on-memory inode @inode
 * to @raw_inode on ifile, cpfile or a super root block.  Since inode bmap
 * data is not exported, nilfs_bmap_write() must be called separately during
 * log writing.
 */
void nilfs_write_inode_common(struct inode *inode,
			      struct nilfs_inode *raw_inode)
{}

void nilfs_update_inode(struct inode *inode, struct buffer_head *ibh, int flags)
{}

#define NILFS_MAX_TRUNCATE_BLOCKS

static void nilfs_truncate_bmap(struct nilfs_inode_info *ii,
				unsigned long from)
{}

void nilfs_truncate(struct inode *inode)
{}

static void nilfs_clear_inode(struct inode *inode)
{}

void nilfs_evict_inode(struct inode *inode)
{}

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

int nilfs_permission(struct mnt_idmap *idmap, struct inode *inode,
		     int mask)
{}

int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh)
{}

int nilfs_inode_dirty(struct inode *inode)
{}

int nilfs_set_file_dirty(struct inode *inode, unsigned int nr_dirty)
{}

int __nilfs_mark_inode_dirty(struct inode *inode, int flags)
{}

/**
 * nilfs_dirty_inode - reflect changes on given inode to an inode block.
 * @inode: inode of the file to be registered.
 * @flags: flags to determine the dirty state of the inode
 *
 * nilfs_dirty_inode() loads a inode block containing the specified
 * @inode and copies data from a nilfs_inode to a corresponding inode
 * entry in the inode block. This operation is excluded from the segment
 * construction. This function can be called both as a single operation
 * and as a part of indivisible file operations.
 */
void nilfs_dirty_inode(struct inode *inode, int flags)
{}

int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
		 __u64 start, __u64 len)
{}