nilfs2: introduce xafile API implementation
Subsystems (2)
RFC PATCH 5/15 nilfs2: introduce xafile API implementation
From: Vyacheslav Dubeyko <[email protected]>
Subject: [RFC][PATCH 05/15] nilfs2: introduce xafile API implementation
This patch adds implementation of xafile base functionality.
Signed-off-by Vyacheslav Dubeyko <[email protected]>
CC Ryusuke Konishi <[email protected]>
--- fs/nilfs2/nilfs.h | 28 +---- fs/nilfs2/the_nilfs.h | 4 + fs/nilfs2/xafile.c | 249 +++++++++++++++++++++++++++++++++++++++++++++ fs/nilfs2/xafile.h | 13 +++ include/linux/nilfs2_fs.h | 17 +++- 5 files changed, 282 insertions(+), 29 deletions(-)
fs/nilfs2/nilfs.h +4 -24
@@ -38,12 +38,12 @@* @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_btnode_cache: cached pages of b-tree nodes * @i_dirty: list for connecting dirty files * @xattr_sem: semaphore for extended attributes processing +* @i_xattr: xanode number * @i_bh: buffer contains disk inode * @i_root: root object of the current filesystem tree * @vfs_inode: VFS inode object
@@ -53,13 +53,11 @@ struct nilfs_inode_info {unsigned long 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 address_space i_btnode_cache;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
@@ -68,7 +66,9 @@ struct nilfs_inode_info {* EAs. */ struct rw_semaphore xattr_sem; -#endif +#define NILFS_INVALID_XANODE ((__u64)(0)) +__u64 i_xattr; +struct buffer_head *i_bh;/* i_bh contains a new or dirty disk inode */ struct nilfs_root *i_root;
@@ -196,26 +196,6 @@ static inline int nilfs_doing_construction(void)return nilfs_test_transaction_flag (NILFS_TI_WRITER ); } -/* -* function prototype -*/ -#ifdef CONFIG_NILFS_POSIX_ACL -#error "NILFS: not yet supported POSIX ACL" -extern int nilfs_acl_chmod (struct inode *); -extern int nilfs_init_acl (struct inode *,struct inode *); -#else -static inline int nilfs_acl_chmod (struct inode *inode) -{ -return 0 ; -} - -static inline int nilfs_init_acl (struct inode *inode,struct inode *dir) -{ - inode->i_mode &= ~current_umask (); -return 0 ; -} -#endif -#define NILFS_ATIME_DISABLE /* Flags that should be inherited by new inodes from their parent. */
fs/nilfs2/the_nilfs.h +4 -0
@@ -40,6 +40,7 @@ enum {THE_NILFS_DISCONTINUED ,/* 'next' pointer chain has broken */ THE_NILFS_GC_RUNNING ,/* gc process is running */ THE_NILFS_SB_DIRTY ,/* super block is dirty */ + THE_NILFS_HAS_XAFILE, /* volume contains xafile */ };/**
@@ -73,6 +74,7 @@ enum {* @ns_dat: DAT file inode * @ns_cpfile: checkpoint file inode * @ns_sufile: segusage file inode +* @ns_xafile: extended attributes file inode * @ns_cptree: rb-tree of all mounted checkpoints (nilfs_root) * @ns_cptree_lock: lock protecting @ns_cptree * @ns_dirty_files: list of dirty files
@@ -153,6 +155,7 @@ struct the_nilfs {struct inode *ns_dat;struct inode *ns_cpfile;struct inode *ns_sufile; +struct inode *ns_xafile;/* Checkpoint tree */ struct rb_root ns_cptree;
@@ -208,6 +211,7 @@ THE_NILFS_FNS(INIT, init) THE_NILFS_FNS(DISCONTINUED, discontinued) THE_NILFS_FNS(GC_RUNNING, gc_running) THE_NILFS_FNS(SB_DIRTY, sb_dirty) +THE_NILFS_FNS (HAS_XAFILE , has_xafile)/* * Mount option operations
fs/nilfs2/xafile.c +249 -0
258 lines not on this page · raw message
fs/nilfs2/xafile.h +13 -0
@@ -417,4 +417,17 @@ NILFS_XANODE_LAST_ENTRY(union nilfs_xanode_header *hdr)#define NILFS_XATTR_VALUE (entry, key) \ ((char *)(entry) + NILFS_XANODE_NAME_HASH(key)->name_len) +/* Xafile API */ +ssize_t nilfs_xafile_listxattr (struct dentry *dentry,char *buf,size_t size); +ssize_t nilfs_xafile_getxattr (struct inode *inode, +int name_index,const char *name, +void *value,size_t size); +int nilfs_xafile_setxattr (struct inode *inode, +int name_index,const char *name, +const void *value,size_t size,int flags); +int nilfs_xafile_delete_inode (struct inode *inode); + +int nilfs_xafile_read (struct super_block *sb,struct nilfs_inode *raw_inode, +struct inode **inodep); +#endif /* _NILFS_XAFILE_H */
include/linux/nilfs2_fs.h +12 -5
@@ -59,7 +59,7 @@* @i_links_count: links count * @i_flags: file flags * @i_bmap: block mapping -* @i_xattr: extended attributes +* @i_xattr: xanode number (index of xafile's node) * @i_generation: file generation (for NFS) * @i_pad: padding */
@@ -91,6 +91,7 @@ struct nilfs_inode {* @sr_dat: DAT file inode * @sr_cpfile: checkpoint file inode * @sr_sufile: segment usage file inode +* @sr_xafile: extended attributes file inode */ struct nilfs_super_root {__le32 sr_sum;
@@ -100,6 +101,7 @@ struct nilfs_super_root {struct nilfs_inode sr_dat;struct nilfs_inode sr_cpfile;struct nilfs_inode sr_sufile; +struct nilfs_inode sr_xafile; };#define NILFS_SR_MDT_OFFSET (inode_size, i) \
@@ -108,7 +110,8 @@ struct nilfs_super_root {#define NILFS_SR_DAT_OFFSET (inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0)#define NILFS_SR_CPFILE_OFFSET (inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1)#define NILFS_SR_SUFILE_OFFSET (inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2) -#define NILFS_SR_BYTES (inode_size) NILFS_SR_MDT_OFFSET(inode_size, 3) +#define NILFS_SR_XAFILE_OFFSET (inode_size) NILFS_SR_MDT_OFFSET(inode_size, 3) +#define NILFS_SR_BYTES (inode_size) NILFS_SR_MDT_OFFSET(inode_size, 4)/* * Maximal mount counts
@@ -219,9 +222,12 @@ struct nilfs_super_block {* doesn't know about, it should refuse to mount the filesystem. */ #define NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT 0x00000001ULL +#define NILFS_FEATURE_COMPAT_RO_XAFILE 0x00000002ULL#define NILFS_FEATURE_COMPAT_SUPP 0ULL -#define NILFS_FEATURE_COMPAT_RO_SUPP NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT +#define NILFS_FEATURE_COMPAT_RO_SUPP \ + (NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT | \ + NILFS_FEATURE_COMPAT_RO_XAFILE)#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL/*
@@ -239,7 +245,7 @@ struct nilfs_super_block {#define NILFS_SUFILE_INO 5/* segment usage file */ #define NILFS_IFILE_INO 6/* ifile */ #define NILFS_ATIME_INO 7/* Atime file (reserved) */ -#define NILFS_XATTR_INO 8/* Xattribute file (reserved) */ +#define NILFS_XATTR_INO 8/* Xattribute file */ #define NILFS_SKETCH_INO 10/* Sketch file */ #define NILFS_USER_INO 11/* Fisrt user's file inode number */
@@ -258,7 +264,8 @@ struct nilfs_super_block {* garbage collector doesn't keep any past versions of these files. */ #define NILFS_ROOT_METADATA_FILE (ino) \ - ((ino) >= NILFS_DAT_INO && (ino) <= NILFS_SUFILE_INO) + (((ino) >= NILFS_DAT_INO && (ino) <= NILFS_SUFILE_INO) || \ + (ino) == NILFS_XATTR_INO)/* * bytes offset of secondary super block
Signature · 8 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html