/* SPDX-License-Identifier: GPL-2.0+ */ /* * NILFS local header file. * * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. * * Written by Koji Sato and Ryusuke Konishi.
*/
/** * struct nilfs_inode_info - nilfs inode data in memory * @i_flags: inode flags * @i_type: inode type (combination of flags that inidicate usage) * @i_state: dynamic state flags * @i_bmap: pointer on i_bmap_data * @i_bmap_data: raw block mapping * @i_xattr: <TODO> * @i_dir_start_lookup: page index of last successful search * @i_cno: checkpoint number for GC inode * @i_assoc_inode: associated inode (B-tree node cache holder or back pointer) * @i_dirty: list for connecting dirty files * @xattr_sem: semaphore for extended attributes processing * @i_bh: buffer contains disk inode * @i_root: root object of the current filesystem tree * @vfs_inode: VFS inode object
*/ struct nilfs_inode_info {
__u32 i_flags; unsignedint i_type; unsignedlong i_state; /* Dynamic state flags */ struct nilfs_bmap *i_bmap; struct nilfs_bmap i_bmap_data;
__u64 i_xattr; /* sector_t ??? */
__u32 i_dir_start_lookup;
__u64 i_cno; /* check point number for GC inode */ struct inode *i_assoc_inode; struct list_head i_dirty; /* List for connecting dirty files */
#ifdef CONFIG_NILFS_XATTR /* * Extended attributes can be read independently of the main file * data. Taking i_sem even when reading would cause contention * between readers of EAs and writers of regular file data, so * instead we synchronize on xattr_sem when reading or changing * EAs.
*/ struct rw_semaphore xattr_sem; #endif struct buffer_head *i_bh; /* * i_bh contains a new or dirty * disk inode.
*/ struct nilfs_root *i_root; struct inode vfs_inode;
};
/* * Dynamic state flags of NILFS on-memory inode (i_state)
*/ enum {
NILFS_I_NEW = 0, /* Inode is newly created */
NILFS_I_DIRTY, /* The file is dirty */
NILFS_I_QUEUED, /* inode is in dirty_files list */
NILFS_I_BUSY, /* * Inode is grabbed by a segment * constructor
*/
NILFS_I_COLLECTED, /* All dirty blocks are collected */
NILFS_I_UPDATED, /* The file has been written back */
NILFS_I_INODE_SYNC, /* dsync is not allowed for inode */
NILFS_I_BMAP, /* has bmap and btnode_cache */
};
/* * Flags to identify the usage of on-memory inodes (i_type)
*/ enum {
NILFS_I_TYPE_NORMAL = 0,
NILFS_I_TYPE_GC = 0x0001, /* For data caching during GC */
NILFS_I_TYPE_BTNC = 0x0002, /* For btree node cache */
NILFS_I_TYPE_SHADOW = 0x0004, /* For shadowed page cache */
};
/* * commit flags for nilfs_commit_super and nilfs_sync_super
*/ enum {
NILFS_SB_COMMIT = 0, /* Commit a super block alternately */
NILFS_SB_COMMIT_ALL /* Commit both super blocks */
};
/** * define NILFS_MAX_VOLUME_NAME - maximum number of characters (bytes) in a * file system volume name * * Defined by the size of the volume name field in the on-disk superblocks. * This volume name does not include the terminating NULL byte if the string * length matches the field size, so use (NILFS_MAX_VOLUME_NAME + 1) for the * size of the buffer that requires a NULL byte termination.
*/ #define NILFS_MAX_VOLUME_NAME \
sizeof_field(struct nilfs_super_block, s_volume_name)
/** * struct nilfs_transaction_info: context information for synchronization * @ti_magic: Magic number * @ti_save: Backup of journal_info field of task_struct * @ti_flags: Flags * @ti_count: Nest level
*/ struct nilfs_transaction_info {
u32 ti_magic; void *ti_save; /* * This should never be used. If it happens, * one of other filesystems has a bug.
*/ unsignedshort ti_flags; unsignedshort ti_count;
};
/* ti_magic */ #define NILFS_TI_MAGIC 0xd9e392fb
/* ti_flags */ #define NILFS_TI_DYNAMIC_ALLOC 0x0001 /* Allocated from slab */ #define NILFS_TI_SYNC 0x0002 /* * Force to construct segment at the * end of transaction.
*/ #define NILFS_TI_GC 0x0004 /* GC context */ #define NILFS_TI_COMMIT 0x0008 /* Change happened or not */ #define NILFS_TI_WRITER 0x0010 /* Constructor context */
int nilfs_transaction_begin(struct super_block *, struct nilfs_transaction_info *, int); int nilfs_transaction_commit(struct super_block *); void nilfs_transaction_abort(struct super_block *);
/* Flags that should be inherited by new inodes from their parent. */ #define NILFS_FL_INHERITED \
(FS_SECRM_FL | FS_UNRM_FL | FS_COMPR_FL | FS_SYNC_FL | \
FS_IMMUTABLE_FL | FS_APPEND_FL | FS_NODUMP_FL | FS_NOATIME_FL |\
FS_COMPRBLK_FL | FS_NOCOMP_FL | FS_NOTAIL_FL | FS_DIRSYNC_FL)
/* Mask out flags that are inappropriate for the given type of inode. */ staticinline __u32 nilfs_mask_flags(umode_t mode, __u32 flags)
{ if (S_ISDIR(mode)) return flags; elseif (S_ISREG(mode)) return flags & ~(FS_DIRSYNC_FL | FS_TOPDIR_FL); else return flags & (FS_NODUMP_FL | FS_NOATIME_FL);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.