xref: /OK3568_Linux_fs/kernel/fs/nilfs2/nilfs.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0+ */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * nilfs.h - NILFS local header file.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Written by Koji Sato and Ryusuke Konishi.
8*4882a593Smuzhiyun  */
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #ifndef _NILFS_H
11*4882a593Smuzhiyun #define _NILFS_H
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #include <linux/kernel.h>
14*4882a593Smuzhiyun #include <linux/buffer_head.h>
15*4882a593Smuzhiyun #include <linux/spinlock.h>
16*4882a593Smuzhiyun #include <linux/blkdev.h>
17*4882a593Smuzhiyun #include <linux/nilfs2_api.h>
18*4882a593Smuzhiyun #include <linux/nilfs2_ondisk.h>
19*4882a593Smuzhiyun #include "the_nilfs.h"
20*4882a593Smuzhiyun #include "bmap.h"
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun /**
23*4882a593Smuzhiyun  * struct nilfs_inode_info - nilfs inode data in memory
24*4882a593Smuzhiyun  * @i_flags: inode flags
25*4882a593Smuzhiyun  * @i_state: dynamic state flags
26*4882a593Smuzhiyun  * @i_bmap: pointer on i_bmap_data
27*4882a593Smuzhiyun  * @i_bmap_data: raw block mapping
28*4882a593Smuzhiyun  * @i_xattr: <TODO>
29*4882a593Smuzhiyun  * @i_dir_start_lookup: page index of last successful search
30*4882a593Smuzhiyun  * @i_cno: checkpoint number for GC inode
31*4882a593Smuzhiyun  * @i_assoc_inode: associated inode (B-tree node cache holder or back pointer)
32*4882a593Smuzhiyun  * @i_dirty: list for connecting dirty files
33*4882a593Smuzhiyun  * @xattr_sem: semaphore for extended attributes processing
34*4882a593Smuzhiyun  * @i_bh: buffer contains disk inode
35*4882a593Smuzhiyun  * @i_root: root object of the current filesystem tree
36*4882a593Smuzhiyun  * @vfs_inode: VFS inode object
37*4882a593Smuzhiyun  */
38*4882a593Smuzhiyun struct nilfs_inode_info {
39*4882a593Smuzhiyun 	__u32 i_flags;
40*4882a593Smuzhiyun 	unsigned long  i_state;		/* Dynamic state flags */
41*4882a593Smuzhiyun 	struct nilfs_bmap *i_bmap;
42*4882a593Smuzhiyun 	struct nilfs_bmap i_bmap_data;
43*4882a593Smuzhiyun 	__u64 i_xattr;	/* sector_t ??? */
44*4882a593Smuzhiyun 	__u32 i_dir_start_lookup;
45*4882a593Smuzhiyun 	__u64 i_cno;		/* check point number for GC inode */
46*4882a593Smuzhiyun 	struct inode *i_assoc_inode;
47*4882a593Smuzhiyun 	struct list_head i_dirty;	/* List for connecting dirty files */
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun #ifdef CONFIG_NILFS_XATTR
50*4882a593Smuzhiyun 	/*
51*4882a593Smuzhiyun 	 * Extended attributes can be read independently of the main file
52*4882a593Smuzhiyun 	 * data. Taking i_sem even when reading would cause contention
53*4882a593Smuzhiyun 	 * between readers of EAs and writers of regular file data, so
54*4882a593Smuzhiyun 	 * instead we synchronize on xattr_sem when reading or changing
55*4882a593Smuzhiyun 	 * EAs.
56*4882a593Smuzhiyun 	 */
57*4882a593Smuzhiyun 	struct rw_semaphore xattr_sem;
58*4882a593Smuzhiyun #endif
59*4882a593Smuzhiyun 	struct buffer_head *i_bh;	/*
60*4882a593Smuzhiyun 					 * i_bh contains a new or dirty
61*4882a593Smuzhiyun 					 * disk inode.
62*4882a593Smuzhiyun 					 */
63*4882a593Smuzhiyun 	struct nilfs_root *i_root;
64*4882a593Smuzhiyun 	struct inode vfs_inode;
65*4882a593Smuzhiyun };
66*4882a593Smuzhiyun 
NILFS_I(const struct inode * inode)67*4882a593Smuzhiyun static inline struct nilfs_inode_info *NILFS_I(const struct inode *inode)
68*4882a593Smuzhiyun {
69*4882a593Smuzhiyun 	return container_of(inode, struct nilfs_inode_info, vfs_inode);
70*4882a593Smuzhiyun }
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun static inline struct nilfs_inode_info *
NILFS_BMAP_I(const struct nilfs_bmap * bmap)73*4882a593Smuzhiyun NILFS_BMAP_I(const struct nilfs_bmap *bmap)
74*4882a593Smuzhiyun {
75*4882a593Smuzhiyun 	return container_of(bmap, struct nilfs_inode_info, i_bmap_data);
76*4882a593Smuzhiyun }
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun /*
79*4882a593Smuzhiyun  * Dynamic state flags of NILFS on-memory inode (i_state)
80*4882a593Smuzhiyun  */
81*4882a593Smuzhiyun enum {
82*4882a593Smuzhiyun 	NILFS_I_NEW = 0,		/* Inode is newly created */
83*4882a593Smuzhiyun 	NILFS_I_DIRTY,			/* The file is dirty */
84*4882a593Smuzhiyun 	NILFS_I_QUEUED,			/* inode is in dirty_files list */
85*4882a593Smuzhiyun 	NILFS_I_BUSY,			/*
86*4882a593Smuzhiyun 					 * Inode is grabbed by a segment
87*4882a593Smuzhiyun 					 * constructor
88*4882a593Smuzhiyun 					 */
89*4882a593Smuzhiyun 	NILFS_I_COLLECTED,		/* All dirty blocks are collected */
90*4882a593Smuzhiyun 	NILFS_I_UPDATED,		/* The file has been written back */
91*4882a593Smuzhiyun 	NILFS_I_INODE_SYNC,		/* dsync is not allowed for inode */
92*4882a593Smuzhiyun 	NILFS_I_BMAP,			/* has bmap and btnode_cache */
93*4882a593Smuzhiyun 	NILFS_I_GCINODE,		/* inode for GC, on memory only */
94*4882a593Smuzhiyun 	NILFS_I_BTNC,			/* inode for btree node cache */
95*4882a593Smuzhiyun 	NILFS_I_SHADOW,			/* inode for shadowed page cache */
96*4882a593Smuzhiyun };
97*4882a593Smuzhiyun 
98*4882a593Smuzhiyun /*
99*4882a593Smuzhiyun  * commit flags for nilfs_commit_super and nilfs_sync_super
100*4882a593Smuzhiyun  */
101*4882a593Smuzhiyun enum {
102*4882a593Smuzhiyun 	NILFS_SB_COMMIT = 0,	/* Commit a super block alternately */
103*4882a593Smuzhiyun 	NILFS_SB_COMMIT_ALL	/* Commit both super blocks */
104*4882a593Smuzhiyun };
105*4882a593Smuzhiyun 
106*4882a593Smuzhiyun /*
107*4882a593Smuzhiyun  * Macros to check inode numbers
108*4882a593Smuzhiyun  */
109*4882a593Smuzhiyun #define NILFS_MDT_INO_BITS						\
110*4882a593Smuzhiyun 	(BIT(NILFS_DAT_INO) | BIT(NILFS_CPFILE_INO) |			\
111*4882a593Smuzhiyun 	 BIT(NILFS_SUFILE_INO) | BIT(NILFS_IFILE_INO) |			\
112*4882a593Smuzhiyun 	 BIT(NILFS_ATIME_INO) | BIT(NILFS_SKETCH_INO))
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun #define NILFS_SYS_INO_BITS (BIT(NILFS_ROOT_INO) | NILFS_MDT_INO_BITS)
115*4882a593Smuzhiyun 
116*4882a593Smuzhiyun #define NILFS_FIRST_INO(sb) (((struct the_nilfs *)sb->s_fs_info)->ns_first_ino)
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun #define NILFS_MDT_INODE(sb, ino) \
119*4882a593Smuzhiyun 	((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & BIT(ino)))
120*4882a593Smuzhiyun #define NILFS_VALID_INODE(sb, ino) \
121*4882a593Smuzhiyun 	((ino) >= NILFS_FIRST_INO(sb) || (NILFS_SYS_INO_BITS & BIT(ino)))
122*4882a593Smuzhiyun 
123*4882a593Smuzhiyun /**
124*4882a593Smuzhiyun  * struct nilfs_transaction_info: context information for synchronization
125*4882a593Smuzhiyun  * @ti_magic: Magic number
126*4882a593Smuzhiyun  * @ti_save: Backup of journal_info field of task_struct
127*4882a593Smuzhiyun  * @ti_flags: Flags
128*4882a593Smuzhiyun  * @ti_count: Nest level
129*4882a593Smuzhiyun  */
130*4882a593Smuzhiyun struct nilfs_transaction_info {
131*4882a593Smuzhiyun 	u32			ti_magic;
132*4882a593Smuzhiyun 	void		       *ti_save;
133*4882a593Smuzhiyun 				/*
134*4882a593Smuzhiyun 				 * This should never be used.  If it happens,
135*4882a593Smuzhiyun 				 * one of other filesystems has a bug.
136*4882a593Smuzhiyun 				 */
137*4882a593Smuzhiyun 	unsigned short		ti_flags;
138*4882a593Smuzhiyun 	unsigned short		ti_count;
139*4882a593Smuzhiyun };
140*4882a593Smuzhiyun 
141*4882a593Smuzhiyun /* ti_magic */
142*4882a593Smuzhiyun #define NILFS_TI_MAGIC		0xd9e392fb
143*4882a593Smuzhiyun 
144*4882a593Smuzhiyun /* ti_flags */
145*4882a593Smuzhiyun #define NILFS_TI_DYNAMIC_ALLOC	0x0001  /* Allocated from slab */
146*4882a593Smuzhiyun #define NILFS_TI_SYNC		0x0002	/*
147*4882a593Smuzhiyun 					 * Force to construct segment at the
148*4882a593Smuzhiyun 					 * end of transaction.
149*4882a593Smuzhiyun 					 */
150*4882a593Smuzhiyun #define NILFS_TI_GC		0x0004	/* GC context */
151*4882a593Smuzhiyun #define NILFS_TI_COMMIT		0x0008	/* Change happened or not */
152*4882a593Smuzhiyun #define NILFS_TI_WRITER		0x0010	/* Constructor context */
153*4882a593Smuzhiyun 
154*4882a593Smuzhiyun 
155*4882a593Smuzhiyun int nilfs_transaction_begin(struct super_block *,
156*4882a593Smuzhiyun 			    struct nilfs_transaction_info *, int);
157*4882a593Smuzhiyun int nilfs_transaction_commit(struct super_block *);
158*4882a593Smuzhiyun void nilfs_transaction_abort(struct super_block *);
159*4882a593Smuzhiyun 
nilfs_set_transaction_flag(unsigned int flag)160*4882a593Smuzhiyun static inline void nilfs_set_transaction_flag(unsigned int flag)
161*4882a593Smuzhiyun {
162*4882a593Smuzhiyun 	struct nilfs_transaction_info *ti = current->journal_info;
163*4882a593Smuzhiyun 
164*4882a593Smuzhiyun 	ti->ti_flags |= flag;
165*4882a593Smuzhiyun }
166*4882a593Smuzhiyun 
nilfs_test_transaction_flag(unsigned int flag)167*4882a593Smuzhiyun static inline int nilfs_test_transaction_flag(unsigned int flag)
168*4882a593Smuzhiyun {
169*4882a593Smuzhiyun 	struct nilfs_transaction_info *ti = current->journal_info;
170*4882a593Smuzhiyun 
171*4882a593Smuzhiyun 	if (ti == NULL || ti->ti_magic != NILFS_TI_MAGIC)
172*4882a593Smuzhiyun 		return 0;
173*4882a593Smuzhiyun 	return !!(ti->ti_flags & flag);
174*4882a593Smuzhiyun }
175*4882a593Smuzhiyun 
nilfs_doing_gc(void)176*4882a593Smuzhiyun static inline int nilfs_doing_gc(void)
177*4882a593Smuzhiyun {
178*4882a593Smuzhiyun 	return nilfs_test_transaction_flag(NILFS_TI_GC);
179*4882a593Smuzhiyun }
180*4882a593Smuzhiyun 
nilfs_doing_construction(void)181*4882a593Smuzhiyun static inline int nilfs_doing_construction(void)
182*4882a593Smuzhiyun {
183*4882a593Smuzhiyun 	return nilfs_test_transaction_flag(NILFS_TI_WRITER);
184*4882a593Smuzhiyun }
185*4882a593Smuzhiyun 
186*4882a593Smuzhiyun /*
187*4882a593Smuzhiyun  * function prototype
188*4882a593Smuzhiyun  */
189*4882a593Smuzhiyun #ifdef CONFIG_NILFS_POSIX_ACL
190*4882a593Smuzhiyun #error "NILFS: not yet supported POSIX ACL"
191*4882a593Smuzhiyun extern int nilfs_acl_chmod(struct inode *);
192*4882a593Smuzhiyun extern int nilfs_init_acl(struct inode *, struct inode *);
193*4882a593Smuzhiyun #else
nilfs_acl_chmod(struct inode * inode)194*4882a593Smuzhiyun static inline int nilfs_acl_chmod(struct inode *inode)
195*4882a593Smuzhiyun {
196*4882a593Smuzhiyun 	return 0;
197*4882a593Smuzhiyun }
198*4882a593Smuzhiyun 
nilfs_init_acl(struct inode * inode,struct inode * dir)199*4882a593Smuzhiyun static inline int nilfs_init_acl(struct inode *inode, struct inode *dir)
200*4882a593Smuzhiyun {
201*4882a593Smuzhiyun 	if (S_ISLNK(inode->i_mode))
202*4882a593Smuzhiyun 		return 0;
203*4882a593Smuzhiyun 
204*4882a593Smuzhiyun 	inode->i_mode &= ~current_umask();
205*4882a593Smuzhiyun 	return 0;
206*4882a593Smuzhiyun }
207*4882a593Smuzhiyun #endif
208*4882a593Smuzhiyun 
209*4882a593Smuzhiyun #define NILFS_ATIME_DISABLE
210*4882a593Smuzhiyun 
211*4882a593Smuzhiyun /* Flags that should be inherited by new inodes from their parent. */
212*4882a593Smuzhiyun #define NILFS_FL_INHERITED						\
213*4882a593Smuzhiyun 	(FS_SECRM_FL | FS_UNRM_FL | FS_COMPR_FL | FS_SYNC_FL |		\
214*4882a593Smuzhiyun 	 FS_IMMUTABLE_FL | FS_APPEND_FL | FS_NODUMP_FL | FS_NOATIME_FL |\
215*4882a593Smuzhiyun 	 FS_COMPRBLK_FL | FS_NOCOMP_FL | FS_NOTAIL_FL | FS_DIRSYNC_FL)
216*4882a593Smuzhiyun 
217*4882a593Smuzhiyun /* Mask out flags that are inappropriate for the given type of inode. */
nilfs_mask_flags(umode_t mode,__u32 flags)218*4882a593Smuzhiyun static inline __u32 nilfs_mask_flags(umode_t mode, __u32 flags)
219*4882a593Smuzhiyun {
220*4882a593Smuzhiyun 	if (S_ISDIR(mode))
221*4882a593Smuzhiyun 		return flags;
222*4882a593Smuzhiyun 	else if (S_ISREG(mode))
223*4882a593Smuzhiyun 		return flags & ~(FS_DIRSYNC_FL | FS_TOPDIR_FL);
224*4882a593Smuzhiyun 	else
225*4882a593Smuzhiyun 		return flags & (FS_NODUMP_FL | FS_NOATIME_FL);
226*4882a593Smuzhiyun }
227*4882a593Smuzhiyun 
228*4882a593Smuzhiyun /* dir.c */
229*4882a593Smuzhiyun extern int nilfs_add_link(struct dentry *, struct inode *);
230*4882a593Smuzhiyun extern ino_t nilfs_inode_by_name(struct inode *, const struct qstr *);
231*4882a593Smuzhiyun extern int nilfs_make_empty(struct inode *, struct inode *);
232*4882a593Smuzhiyun extern struct nilfs_dir_entry *
233*4882a593Smuzhiyun nilfs_find_entry(struct inode *, const struct qstr *, struct page **);
234*4882a593Smuzhiyun extern int nilfs_delete_entry(struct nilfs_dir_entry *, struct page *);
235*4882a593Smuzhiyun extern int nilfs_empty_dir(struct inode *);
236*4882a593Smuzhiyun extern struct nilfs_dir_entry *nilfs_dotdot(struct inode *, struct page **);
237*4882a593Smuzhiyun extern void nilfs_set_link(struct inode *, struct nilfs_dir_entry *,
238*4882a593Smuzhiyun 			   struct page *, struct inode *);
239*4882a593Smuzhiyun 
240*4882a593Smuzhiyun /* file.c */
241*4882a593Smuzhiyun extern int nilfs_sync_file(struct file *, loff_t, loff_t, int);
242*4882a593Smuzhiyun 
243*4882a593Smuzhiyun /* ioctl.c */
244*4882a593Smuzhiyun long nilfs_ioctl(struct file *, unsigned int, unsigned long);
245*4882a593Smuzhiyun long nilfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
246*4882a593Smuzhiyun int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *, struct nilfs_argv *,
247*4882a593Smuzhiyun 				       void **);
248*4882a593Smuzhiyun 
249*4882a593Smuzhiyun /* inode.c */
250*4882a593Smuzhiyun void nilfs_inode_add_blocks(struct inode *inode, int n);
251*4882a593Smuzhiyun void nilfs_inode_sub_blocks(struct inode *inode, int n);
252*4882a593Smuzhiyun extern struct inode *nilfs_new_inode(struct inode *, umode_t);
253*4882a593Smuzhiyun extern int nilfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
254*4882a593Smuzhiyun extern void nilfs_set_inode_flags(struct inode *);
255*4882a593Smuzhiyun extern int nilfs_read_inode_common(struct inode *, struct nilfs_inode *);
256*4882a593Smuzhiyun extern void nilfs_write_inode_common(struct inode *, struct nilfs_inode *, int);
257*4882a593Smuzhiyun struct inode *nilfs_ilookup(struct super_block *sb, struct nilfs_root *root,
258*4882a593Smuzhiyun 			    unsigned long ino);
259*4882a593Smuzhiyun struct inode *nilfs_iget_locked(struct super_block *sb, struct nilfs_root *root,
260*4882a593Smuzhiyun 				unsigned long ino);
261*4882a593Smuzhiyun struct inode *nilfs_iget(struct super_block *sb, struct nilfs_root *root,
262*4882a593Smuzhiyun 			 unsigned long ino);
263*4882a593Smuzhiyun extern struct inode *nilfs_iget_for_gc(struct super_block *sb,
264*4882a593Smuzhiyun 				       unsigned long ino, __u64 cno);
265*4882a593Smuzhiyun int nilfs_attach_btree_node_cache(struct inode *inode);
266*4882a593Smuzhiyun void nilfs_detach_btree_node_cache(struct inode *inode);
267*4882a593Smuzhiyun struct inode *nilfs_iget_for_shadow(struct inode *inode);
268*4882a593Smuzhiyun extern void nilfs_update_inode(struct inode *, struct buffer_head *, int);
269*4882a593Smuzhiyun extern void nilfs_truncate(struct inode *);
270*4882a593Smuzhiyun extern void nilfs_evict_inode(struct inode *);
271*4882a593Smuzhiyun extern int nilfs_setattr(struct dentry *, struct iattr *);
272*4882a593Smuzhiyun extern void nilfs_write_failed(struct address_space *mapping, loff_t to);
273*4882a593Smuzhiyun int nilfs_permission(struct inode *inode, int mask);
274*4882a593Smuzhiyun int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh);
275*4882a593Smuzhiyun extern int nilfs_inode_dirty(struct inode *);
276*4882a593Smuzhiyun int nilfs_set_file_dirty(struct inode *inode, unsigned int nr_dirty);
277*4882a593Smuzhiyun extern int __nilfs_mark_inode_dirty(struct inode *, int);
278*4882a593Smuzhiyun extern void nilfs_dirty_inode(struct inode *, int flags);
279*4882a593Smuzhiyun int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
280*4882a593Smuzhiyun 		 __u64 start, __u64 len);
nilfs_mark_inode_dirty(struct inode * inode)281*4882a593Smuzhiyun static inline int nilfs_mark_inode_dirty(struct inode *inode)
282*4882a593Smuzhiyun {
283*4882a593Smuzhiyun 	return __nilfs_mark_inode_dirty(inode, I_DIRTY);
284*4882a593Smuzhiyun }
nilfs_mark_inode_dirty_sync(struct inode * inode)285*4882a593Smuzhiyun static inline int nilfs_mark_inode_dirty_sync(struct inode *inode)
286*4882a593Smuzhiyun {
287*4882a593Smuzhiyun 	return __nilfs_mark_inode_dirty(inode, I_DIRTY_SYNC);
288*4882a593Smuzhiyun }
289*4882a593Smuzhiyun 
290*4882a593Smuzhiyun /* super.c */
291*4882a593Smuzhiyun extern struct inode *nilfs_alloc_inode(struct super_block *);
292*4882a593Smuzhiyun 
293*4882a593Smuzhiyun __printf(2, 3)
294*4882a593Smuzhiyun void __nilfs_msg(struct super_block *sb, const char *fmt, ...);
295*4882a593Smuzhiyun extern __printf(3, 4)
296*4882a593Smuzhiyun void __nilfs_error(struct super_block *sb, const char *function,
297*4882a593Smuzhiyun 		   const char *fmt, ...);
298*4882a593Smuzhiyun 
299*4882a593Smuzhiyun #ifdef CONFIG_PRINTK
300*4882a593Smuzhiyun 
301*4882a593Smuzhiyun #define nilfs_msg(sb, level, fmt, ...)					\
302*4882a593Smuzhiyun 	__nilfs_msg(sb, level fmt, ##__VA_ARGS__)
303*4882a593Smuzhiyun #define nilfs_error(sb, fmt, ...)					\
304*4882a593Smuzhiyun 	__nilfs_error(sb, __func__, fmt, ##__VA_ARGS__)
305*4882a593Smuzhiyun 
306*4882a593Smuzhiyun #else
307*4882a593Smuzhiyun 
308*4882a593Smuzhiyun #define nilfs_msg(sb, level, fmt, ...)					\
309*4882a593Smuzhiyun 	do {								\
310*4882a593Smuzhiyun 		no_printk(level fmt, ##__VA_ARGS__);			\
311*4882a593Smuzhiyun 		(void)(sb);						\
312*4882a593Smuzhiyun 	} while (0)
313*4882a593Smuzhiyun #define nilfs_error(sb, fmt, ...)					\
314*4882a593Smuzhiyun 	do {								\
315*4882a593Smuzhiyun 		no_printk(fmt, ##__VA_ARGS__);				\
316*4882a593Smuzhiyun 		__nilfs_error(sb, "", " ");				\
317*4882a593Smuzhiyun 	} while (0)
318*4882a593Smuzhiyun 
319*4882a593Smuzhiyun #endif /* CONFIG_PRINTK */
320*4882a593Smuzhiyun 
321*4882a593Smuzhiyun #define nilfs_crit(sb, fmt, ...)					\
322*4882a593Smuzhiyun 	nilfs_msg(sb, KERN_CRIT, fmt, ##__VA_ARGS__)
323*4882a593Smuzhiyun #define nilfs_err(sb, fmt, ...)						\
324*4882a593Smuzhiyun 	nilfs_msg(sb, KERN_ERR, fmt, ##__VA_ARGS__)
325*4882a593Smuzhiyun #define nilfs_warn(sb, fmt, ...)					\
326*4882a593Smuzhiyun 	nilfs_msg(sb, KERN_WARNING, fmt, ##__VA_ARGS__)
327*4882a593Smuzhiyun #define nilfs_info(sb, fmt, ...)					\
328*4882a593Smuzhiyun 	nilfs_msg(sb, KERN_INFO, fmt, ##__VA_ARGS__)
329*4882a593Smuzhiyun 
330*4882a593Smuzhiyun extern struct nilfs_super_block *
331*4882a593Smuzhiyun nilfs_read_super_block(struct super_block *, u64, int, struct buffer_head **);
332*4882a593Smuzhiyun extern int nilfs_store_magic_and_option(struct super_block *,
333*4882a593Smuzhiyun 					struct nilfs_super_block *, char *);
334*4882a593Smuzhiyun extern int nilfs_check_feature_compatibility(struct super_block *,
335*4882a593Smuzhiyun 					     struct nilfs_super_block *);
336*4882a593Smuzhiyun extern void nilfs_set_log_cursor(struct nilfs_super_block *,
337*4882a593Smuzhiyun 				 struct the_nilfs *);
338*4882a593Smuzhiyun struct nilfs_super_block **nilfs_prepare_super(struct super_block *sb,
339*4882a593Smuzhiyun 					       int flip);
340*4882a593Smuzhiyun int nilfs_commit_super(struct super_block *sb, int flag);
341*4882a593Smuzhiyun int nilfs_cleanup_super(struct super_block *sb);
342*4882a593Smuzhiyun int nilfs_resize_fs(struct super_block *sb, __u64 newsize);
343*4882a593Smuzhiyun int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt,
344*4882a593Smuzhiyun 			    struct nilfs_root **root);
345*4882a593Smuzhiyun int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno);
346*4882a593Smuzhiyun 
347*4882a593Smuzhiyun /* gcinode.c */
348*4882a593Smuzhiyun int nilfs_gccache_submit_read_data(struct inode *, sector_t, sector_t, __u64,
349*4882a593Smuzhiyun 				   struct buffer_head **);
350*4882a593Smuzhiyun int nilfs_gccache_submit_read_node(struct inode *, sector_t, __u64,
351*4882a593Smuzhiyun 				   struct buffer_head **);
352*4882a593Smuzhiyun int nilfs_gccache_wait_and_mark_dirty(struct buffer_head *);
353*4882a593Smuzhiyun int nilfs_init_gcinode(struct inode *inode);
354*4882a593Smuzhiyun void nilfs_remove_all_gcinodes(struct the_nilfs *nilfs);
355*4882a593Smuzhiyun 
356*4882a593Smuzhiyun /* sysfs.c */
357*4882a593Smuzhiyun int __init nilfs_sysfs_init(void);
358*4882a593Smuzhiyun void nilfs_sysfs_exit(void);
359*4882a593Smuzhiyun int nilfs_sysfs_create_device_group(struct super_block *);
360*4882a593Smuzhiyun void nilfs_sysfs_delete_device_group(struct the_nilfs *);
361*4882a593Smuzhiyun int nilfs_sysfs_create_snapshot_group(struct nilfs_root *);
362*4882a593Smuzhiyun void nilfs_sysfs_delete_snapshot_group(struct nilfs_root *);
363*4882a593Smuzhiyun 
364*4882a593Smuzhiyun /*
365*4882a593Smuzhiyun  * Inodes and files operations
366*4882a593Smuzhiyun  */
367*4882a593Smuzhiyun extern const struct file_operations nilfs_dir_operations;
368*4882a593Smuzhiyun extern const struct inode_operations nilfs_file_inode_operations;
369*4882a593Smuzhiyun extern const struct file_operations nilfs_file_operations;
370*4882a593Smuzhiyun extern const struct address_space_operations nilfs_aops;
371*4882a593Smuzhiyun extern const struct inode_operations nilfs_dir_inode_operations;
372*4882a593Smuzhiyun extern const struct inode_operations nilfs_special_inode_operations;
373*4882a593Smuzhiyun extern const struct inode_operations nilfs_symlink_inode_operations;
374*4882a593Smuzhiyun 
375*4882a593Smuzhiyun /*
376*4882a593Smuzhiyun  * filesystem type
377*4882a593Smuzhiyun  */
378*4882a593Smuzhiyun extern struct file_system_type nilfs_fs_type;
379*4882a593Smuzhiyun 
380*4882a593Smuzhiyun 
381*4882a593Smuzhiyun #endif	/* _NILFS_H */
382