xref: /OK3568_Linux_fs/kernel/fs/affs/affs.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifdef pr_fmt
3*4882a593Smuzhiyun #undef pr_fmt
4*4882a593Smuzhiyun #endif
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #include <linux/types.h>
9*4882a593Smuzhiyun #include <linux/fs.h>
10*4882a593Smuzhiyun #include <linux/buffer_head.h>
11*4882a593Smuzhiyun #include "amigaffs.h"
12*4882a593Smuzhiyun #include <linux/mutex.h>
13*4882a593Smuzhiyun #include <linux/workqueue.h>
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun /* Ugly macros make the code more pretty. */
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun #define GET_END_PTR(st,p,sz)		 ((st *)((char *)(p)+((sz)-sizeof(st))))
18*4882a593Smuzhiyun #define AFFS_GET_HASHENTRY(data,hashkey) be32_to_cpu(((struct dir_front *)data)->hashtable[hashkey])
19*4882a593Smuzhiyun #define AFFS_BLOCK(sb, bh, blk)		(AFFS_HEAD(bh)->table[AFFS_SB(sb)->s_hashsize-1-(blk)])
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun #define AFFS_HEAD(bh)		((struct affs_head *)(bh)->b_data)
22*4882a593Smuzhiyun #define AFFS_TAIL(sb, bh)	((struct affs_tail *)((bh)->b_data+(sb)->s_blocksize-sizeof(struct affs_tail)))
23*4882a593Smuzhiyun #define AFFS_ROOT_HEAD(bh)	((struct affs_root_head *)(bh)->b_data)
24*4882a593Smuzhiyun #define AFFS_ROOT_TAIL(sb, bh)	((struct affs_root_tail *)((bh)->b_data+(sb)->s_blocksize-sizeof(struct affs_root_tail)))
25*4882a593Smuzhiyun #define AFFS_DATA_HEAD(bh)	((struct affs_data_head *)(bh)->b_data)
26*4882a593Smuzhiyun #define AFFS_DATA(bh)		(((struct affs_data_head *)(bh)->b_data)->data)
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun #define AFFS_CACHE_SIZE		PAGE_SIZE
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #define AFFS_LC_SIZE		(AFFS_CACHE_SIZE/sizeof(u32)/2)
31*4882a593Smuzhiyun #define AFFS_AC_SIZE		(AFFS_CACHE_SIZE/sizeof(struct affs_ext_key)/2)
32*4882a593Smuzhiyun #define AFFS_AC_MASK		(AFFS_AC_SIZE-1)
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun #define AFFSNAMEMAX 30U
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun struct affs_ext_key {
37*4882a593Smuzhiyun 	u32	ext;				/* idx of the extended block */
38*4882a593Smuzhiyun 	u32	key;				/* block number */
39*4882a593Smuzhiyun };
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun /*
42*4882a593Smuzhiyun  * affs fs inode data in memory
43*4882a593Smuzhiyun  */
44*4882a593Smuzhiyun struct affs_inode_info {
45*4882a593Smuzhiyun 	atomic_t i_opencnt;
46*4882a593Smuzhiyun 	struct mutex i_link_lock;		/* Protects internal inode access. */
47*4882a593Smuzhiyun 	struct mutex i_ext_lock;		/* Protects internal inode access. */
48*4882a593Smuzhiyun #define i_hash_lock i_ext_lock
49*4882a593Smuzhiyun 	u32	 i_blkcnt;			/* block count */
50*4882a593Smuzhiyun 	u32	 i_extcnt;			/* extended block count */
51*4882a593Smuzhiyun 	u32	*i_lc;				/* linear cache of extended blocks */
52*4882a593Smuzhiyun 	u32	 i_lc_size;
53*4882a593Smuzhiyun 	u32	 i_lc_shift;
54*4882a593Smuzhiyun 	u32	 i_lc_mask;
55*4882a593Smuzhiyun 	struct affs_ext_key *i_ac;		/* associative cache of extended blocks */
56*4882a593Smuzhiyun 	u32	 i_ext_last;			/* last accessed extended block */
57*4882a593Smuzhiyun 	struct buffer_head *i_ext_bh;		/* bh of last extended block */
58*4882a593Smuzhiyun 	loff_t	 mmu_private;
59*4882a593Smuzhiyun 	u32	 i_protect;			/* unused attribute bits */
60*4882a593Smuzhiyun 	u32	 i_lastalloc;			/* last allocated block */
61*4882a593Smuzhiyun 	int	 i_pa_cnt;			/* number of preallocated blocks */
62*4882a593Smuzhiyun 	struct inode vfs_inode;
63*4882a593Smuzhiyun };
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun /* short cut to get to the affs specific inode data */
AFFS_I(struct inode * inode)66*4882a593Smuzhiyun static inline struct affs_inode_info *AFFS_I(struct inode *inode)
67*4882a593Smuzhiyun {
68*4882a593Smuzhiyun 	return container_of(inode, struct affs_inode_info, vfs_inode);
69*4882a593Smuzhiyun }
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun /*
72*4882a593Smuzhiyun  * super-block data in memory
73*4882a593Smuzhiyun  *
74*4882a593Smuzhiyun  * Block numbers are adjusted for their actual size
75*4882a593Smuzhiyun  *
76*4882a593Smuzhiyun  */
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun struct affs_bm_info {
79*4882a593Smuzhiyun 	u32 bm_key;			/* Disk block number */
80*4882a593Smuzhiyun 	u32 bm_free;			/* Free blocks in here */
81*4882a593Smuzhiyun };
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun struct affs_sb_info {
84*4882a593Smuzhiyun 	int s_partition_size;		/* Partition size in blocks. */
85*4882a593Smuzhiyun 	int s_reserved;			/* Number of reserved blocks. */
86*4882a593Smuzhiyun 	//u32 s_blksize;			/* Initial device blksize */
87*4882a593Smuzhiyun 	u32 s_data_blksize;		/* size of the data block w/o header */
88*4882a593Smuzhiyun 	u32 s_root_block;		/* FFS root block number. */
89*4882a593Smuzhiyun 	int s_hashsize;			/* Size of hash table. */
90*4882a593Smuzhiyun 	unsigned long s_flags;		/* See below. */
91*4882a593Smuzhiyun 	kuid_t s_uid;			/* uid to override */
92*4882a593Smuzhiyun 	kgid_t s_gid;			/* gid to override */
93*4882a593Smuzhiyun 	umode_t s_mode;			/* mode to override */
94*4882a593Smuzhiyun 	struct buffer_head *s_root_bh;	/* Cached root block. */
95*4882a593Smuzhiyun 	struct mutex s_bmlock;		/* Protects bitmap access. */
96*4882a593Smuzhiyun 	struct affs_bm_info *s_bitmap;	/* Bitmap infos. */
97*4882a593Smuzhiyun 	u32 s_bmap_count;		/* # of bitmap blocks. */
98*4882a593Smuzhiyun 	u32 s_bmap_bits;		/* # of bits in one bitmap blocks */
99*4882a593Smuzhiyun 	u32 s_last_bmap;
100*4882a593Smuzhiyun 	struct buffer_head *s_bmap_bh;
101*4882a593Smuzhiyun 	char *s_prefix;			/* Prefix for volumes and assigns. */
102*4882a593Smuzhiyun 	char s_volume[32];		/* Volume prefix for absolute symlinks. */
103*4882a593Smuzhiyun 	spinlock_t symlink_lock;	/* protects the previous two */
104*4882a593Smuzhiyun 	struct super_block *sb;		/* the VFS superblock object */
105*4882a593Smuzhiyun 	int work_queued;		/* non-zero delayed work is queued */
106*4882a593Smuzhiyun 	struct delayed_work sb_work;	/* superblock flush delayed work */
107*4882a593Smuzhiyun 	spinlock_t work_lock;		/* protects sb_work and work_queued */
108*4882a593Smuzhiyun };
109*4882a593Smuzhiyun 
110*4882a593Smuzhiyun #define AFFS_MOUNT_SF_INTL		0x0001 /* International filesystem. */
111*4882a593Smuzhiyun #define AFFS_MOUNT_SF_BM_VALID		0x0002 /* Bitmap is valid. */
112*4882a593Smuzhiyun #define AFFS_MOUNT_SF_IMMUTABLE		0x0004 /* Protection bits cannot be changed */
113*4882a593Smuzhiyun #define AFFS_MOUNT_SF_QUIET		0x0008 /* chmod errors will be not reported */
114*4882a593Smuzhiyun #define AFFS_MOUNT_SF_SETUID		0x0010 /* Ignore Amiga uid */
115*4882a593Smuzhiyun #define AFFS_MOUNT_SF_SETGID		0x0020 /* Ignore Amiga gid */
116*4882a593Smuzhiyun #define AFFS_MOUNT_SF_SETMODE		0x0040 /* Ignore Amiga protection bits */
117*4882a593Smuzhiyun #define AFFS_MOUNT_SF_MUFS		0x0100 /* Use MUFS uid/gid mapping */
118*4882a593Smuzhiyun #define AFFS_MOUNT_SF_OFS		0x0200 /* Old filesystem */
119*4882a593Smuzhiyun #define AFFS_MOUNT_SF_PREFIX		0x0400 /* Buffer for prefix is allocated */
120*4882a593Smuzhiyun #define AFFS_MOUNT_SF_VERBOSE		0x0800 /* Talk about fs when mounting */
121*4882a593Smuzhiyun #define AFFS_MOUNT_SF_NO_TRUNCATE	0x1000 /* Don't truncate filenames */
122*4882a593Smuzhiyun 
123*4882a593Smuzhiyun #define affs_clear_opt(o, opt)    (o &= ~AFFS_MOUNT_##opt)
124*4882a593Smuzhiyun #define affs_set_opt(o, opt)      (o |= AFFS_MOUNT_##opt)
125*4882a593Smuzhiyun #define affs_test_opt(o, opt)     ((o) & AFFS_MOUNT_##opt)
126*4882a593Smuzhiyun 
127*4882a593Smuzhiyun /* short cut to get to the affs specific sb data */
AFFS_SB(struct super_block * sb)128*4882a593Smuzhiyun static inline struct affs_sb_info *AFFS_SB(struct super_block *sb)
129*4882a593Smuzhiyun {
130*4882a593Smuzhiyun 	return sb->s_fs_info;
131*4882a593Smuzhiyun }
132*4882a593Smuzhiyun 
133*4882a593Smuzhiyun void affs_mark_sb_dirty(struct super_block *sb);
134*4882a593Smuzhiyun 
135*4882a593Smuzhiyun /* amigaffs.c */
136*4882a593Smuzhiyun 
137*4882a593Smuzhiyun extern int	affs_insert_hash(struct inode *inode, struct buffer_head *bh);
138*4882a593Smuzhiyun extern int	affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh);
139*4882a593Smuzhiyun extern int	affs_remove_header(struct dentry *dentry);
140*4882a593Smuzhiyun extern u32	affs_checksum_block(struct super_block *sb, struct buffer_head *bh);
141*4882a593Smuzhiyun extern void	affs_fix_checksum(struct super_block *sb, struct buffer_head *bh);
142*4882a593Smuzhiyun extern void	affs_secs_to_datestamp(time64_t secs, struct affs_date *ds);
143*4882a593Smuzhiyun extern umode_t	affs_prot_to_mode(u32 prot);
144*4882a593Smuzhiyun extern void	affs_mode_to_prot(struct inode *inode);
145*4882a593Smuzhiyun __printf(3, 4)
146*4882a593Smuzhiyun extern void	affs_error(struct super_block *sb, const char *function,
147*4882a593Smuzhiyun 			   const char *fmt, ...);
148*4882a593Smuzhiyun __printf(3, 4)
149*4882a593Smuzhiyun extern void	affs_warning(struct super_block *sb, const char *function,
150*4882a593Smuzhiyun 			     const char *fmt, ...);
151*4882a593Smuzhiyun extern bool	affs_nofilenametruncate(const struct dentry *dentry);
152*4882a593Smuzhiyun extern int	affs_check_name(const unsigned char *name, int len,
153*4882a593Smuzhiyun 				bool notruncate);
154*4882a593Smuzhiyun extern int	affs_copy_name(unsigned char *bstr, struct dentry *dentry);
155*4882a593Smuzhiyun 
156*4882a593Smuzhiyun /* bitmap. c */
157*4882a593Smuzhiyun 
158*4882a593Smuzhiyun extern u32	affs_count_free_blocks(struct super_block *s);
159*4882a593Smuzhiyun extern void	affs_free_block(struct super_block *sb, u32 block);
160*4882a593Smuzhiyun extern u32	affs_alloc_block(struct inode *inode, u32 goal);
161*4882a593Smuzhiyun extern int	affs_init_bitmap(struct super_block *sb, int *flags);
162*4882a593Smuzhiyun extern void	affs_free_bitmap(struct super_block *sb);
163*4882a593Smuzhiyun 
164*4882a593Smuzhiyun /* namei.c */
165*4882a593Smuzhiyun 
166*4882a593Smuzhiyun extern const struct export_operations affs_export_ops;
167*4882a593Smuzhiyun extern int	affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len);
168*4882a593Smuzhiyun extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int);
169*4882a593Smuzhiyun extern int	affs_unlink(struct inode *dir, struct dentry *dentry);
170*4882a593Smuzhiyun extern int	affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool);
171*4882a593Smuzhiyun extern int	affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
172*4882a593Smuzhiyun extern int	affs_rmdir(struct inode *dir, struct dentry *dentry);
173*4882a593Smuzhiyun extern int	affs_link(struct dentry *olddentry, struct inode *dir,
174*4882a593Smuzhiyun 			  struct dentry *dentry);
175*4882a593Smuzhiyun extern int	affs_symlink(struct inode *dir, struct dentry *dentry,
176*4882a593Smuzhiyun 			     const char *symname);
177*4882a593Smuzhiyun extern int	affs_rename2(struct inode *old_dir, struct dentry *old_dentry,
178*4882a593Smuzhiyun 			    struct inode *new_dir, struct dentry *new_dentry,
179*4882a593Smuzhiyun 			    unsigned int flags);
180*4882a593Smuzhiyun 
181*4882a593Smuzhiyun /* inode.c */
182*4882a593Smuzhiyun 
183*4882a593Smuzhiyun extern struct inode		*affs_new_inode(struct inode *dir);
184*4882a593Smuzhiyun extern int			 affs_notify_change(struct dentry *dentry, struct iattr *attr);
185*4882a593Smuzhiyun extern void			 affs_evict_inode(struct inode *inode);
186*4882a593Smuzhiyun extern struct inode		*affs_iget(struct super_block *sb,
187*4882a593Smuzhiyun 					unsigned long ino);
188*4882a593Smuzhiyun extern int			 affs_write_inode(struct inode *inode,
189*4882a593Smuzhiyun 					struct writeback_control *wbc);
190*4882a593Smuzhiyun extern int			 affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s32 type);
191*4882a593Smuzhiyun 
192*4882a593Smuzhiyun /* file.c */
193*4882a593Smuzhiyun 
194*4882a593Smuzhiyun void		affs_free_prealloc(struct inode *inode);
195*4882a593Smuzhiyun extern void	affs_truncate(struct inode *);
196*4882a593Smuzhiyun int		affs_file_fsync(struct file *, loff_t, loff_t, int);
197*4882a593Smuzhiyun 
198*4882a593Smuzhiyun /* dir.c */
199*4882a593Smuzhiyun 
200*4882a593Smuzhiyun extern void   affs_dir_truncate(struct inode *);
201*4882a593Smuzhiyun 
202*4882a593Smuzhiyun /* jump tables */
203*4882a593Smuzhiyun 
204*4882a593Smuzhiyun extern const struct inode_operations	 affs_file_inode_operations;
205*4882a593Smuzhiyun extern const struct inode_operations	 affs_dir_inode_operations;
206*4882a593Smuzhiyun extern const struct inode_operations   affs_symlink_inode_operations;
207*4882a593Smuzhiyun extern const struct file_operations	 affs_file_operations;
208*4882a593Smuzhiyun extern const struct file_operations	 affs_file_operations_ofs;
209*4882a593Smuzhiyun extern const struct file_operations	 affs_dir_operations;
210*4882a593Smuzhiyun extern const struct address_space_operations	 affs_symlink_aops;
211*4882a593Smuzhiyun extern const struct address_space_operations	 affs_aops;
212*4882a593Smuzhiyun extern const struct address_space_operations	 affs_aops_ofs;
213*4882a593Smuzhiyun 
214*4882a593Smuzhiyun extern const struct dentry_operations	 affs_dentry_operations;
215*4882a593Smuzhiyun extern const struct dentry_operations	 affs_intl_dentry_operations;
216*4882a593Smuzhiyun 
affs_validblock(struct super_block * sb,int block)217*4882a593Smuzhiyun static inline bool affs_validblock(struct super_block *sb, int block)
218*4882a593Smuzhiyun {
219*4882a593Smuzhiyun 	return(block >= AFFS_SB(sb)->s_reserved &&
220*4882a593Smuzhiyun 	       block < AFFS_SB(sb)->s_partition_size);
221*4882a593Smuzhiyun }
222*4882a593Smuzhiyun 
223*4882a593Smuzhiyun static inline void
affs_set_blocksize(struct super_block * sb,int size)224*4882a593Smuzhiyun affs_set_blocksize(struct super_block *sb, int size)
225*4882a593Smuzhiyun {
226*4882a593Smuzhiyun 	sb_set_blocksize(sb, size);
227*4882a593Smuzhiyun }
228*4882a593Smuzhiyun static inline struct buffer_head *
affs_bread(struct super_block * sb,int block)229*4882a593Smuzhiyun affs_bread(struct super_block *sb, int block)
230*4882a593Smuzhiyun {
231*4882a593Smuzhiyun 	pr_debug("%s: %d\n", __func__, block);
232*4882a593Smuzhiyun 	if (affs_validblock(sb, block))
233*4882a593Smuzhiyun 		return sb_bread(sb, block);
234*4882a593Smuzhiyun 	return NULL;
235*4882a593Smuzhiyun }
236*4882a593Smuzhiyun static inline struct buffer_head *
affs_getblk(struct super_block * sb,int block)237*4882a593Smuzhiyun affs_getblk(struct super_block *sb, int block)
238*4882a593Smuzhiyun {
239*4882a593Smuzhiyun 	pr_debug("%s: %d\n", __func__, block);
240*4882a593Smuzhiyun 	if (affs_validblock(sb, block))
241*4882a593Smuzhiyun 		return sb_getblk(sb, block);
242*4882a593Smuzhiyun 	return NULL;
243*4882a593Smuzhiyun }
244*4882a593Smuzhiyun static inline struct buffer_head *
affs_getzeroblk(struct super_block * sb,int block)245*4882a593Smuzhiyun affs_getzeroblk(struct super_block *sb, int block)
246*4882a593Smuzhiyun {
247*4882a593Smuzhiyun 	struct buffer_head *bh;
248*4882a593Smuzhiyun 	pr_debug("%s: %d\n", __func__, block);
249*4882a593Smuzhiyun 	if (affs_validblock(sb, block)) {
250*4882a593Smuzhiyun 		bh = sb_getblk(sb, block);
251*4882a593Smuzhiyun 		lock_buffer(bh);
252*4882a593Smuzhiyun 		memset(bh->b_data, 0 , sb->s_blocksize);
253*4882a593Smuzhiyun 		set_buffer_uptodate(bh);
254*4882a593Smuzhiyun 		unlock_buffer(bh);
255*4882a593Smuzhiyun 		return bh;
256*4882a593Smuzhiyun 	}
257*4882a593Smuzhiyun 	return NULL;
258*4882a593Smuzhiyun }
259*4882a593Smuzhiyun static inline struct buffer_head *
affs_getemptyblk(struct super_block * sb,int block)260*4882a593Smuzhiyun affs_getemptyblk(struct super_block *sb, int block)
261*4882a593Smuzhiyun {
262*4882a593Smuzhiyun 	struct buffer_head *bh;
263*4882a593Smuzhiyun 	pr_debug("%s: %d\n", __func__, block);
264*4882a593Smuzhiyun 	if (affs_validblock(sb, block)) {
265*4882a593Smuzhiyun 		bh = sb_getblk(sb, block);
266*4882a593Smuzhiyun 		wait_on_buffer(bh);
267*4882a593Smuzhiyun 		set_buffer_uptodate(bh);
268*4882a593Smuzhiyun 		return bh;
269*4882a593Smuzhiyun 	}
270*4882a593Smuzhiyun 	return NULL;
271*4882a593Smuzhiyun }
272*4882a593Smuzhiyun static inline void
affs_brelse(struct buffer_head * bh)273*4882a593Smuzhiyun affs_brelse(struct buffer_head *bh)
274*4882a593Smuzhiyun {
275*4882a593Smuzhiyun 	if (bh)
276*4882a593Smuzhiyun 		pr_debug("%s: %lld\n", __func__, (long long) bh->b_blocknr);
277*4882a593Smuzhiyun 	brelse(bh);
278*4882a593Smuzhiyun }
279*4882a593Smuzhiyun 
280*4882a593Smuzhiyun static inline void
affs_adjust_checksum(struct buffer_head * bh,u32 val)281*4882a593Smuzhiyun affs_adjust_checksum(struct buffer_head *bh, u32 val)
282*4882a593Smuzhiyun {
283*4882a593Smuzhiyun 	u32 tmp = be32_to_cpu(((__be32 *)bh->b_data)[5]);
284*4882a593Smuzhiyun 	((__be32 *)bh->b_data)[5] = cpu_to_be32(tmp - val);
285*4882a593Smuzhiyun }
286*4882a593Smuzhiyun static inline void
affs_adjust_bitmapchecksum(struct buffer_head * bh,u32 val)287*4882a593Smuzhiyun affs_adjust_bitmapchecksum(struct buffer_head *bh, u32 val)
288*4882a593Smuzhiyun {
289*4882a593Smuzhiyun 	u32 tmp = be32_to_cpu(((__be32 *)bh->b_data)[0]);
290*4882a593Smuzhiyun 	((__be32 *)bh->b_data)[0] = cpu_to_be32(tmp - val);
291*4882a593Smuzhiyun }
292*4882a593Smuzhiyun 
293*4882a593Smuzhiyun static inline void
affs_lock_link(struct inode * inode)294*4882a593Smuzhiyun affs_lock_link(struct inode *inode)
295*4882a593Smuzhiyun {
296*4882a593Smuzhiyun 	mutex_lock(&AFFS_I(inode)->i_link_lock);
297*4882a593Smuzhiyun }
298*4882a593Smuzhiyun static inline void
affs_unlock_link(struct inode * inode)299*4882a593Smuzhiyun affs_unlock_link(struct inode *inode)
300*4882a593Smuzhiyun {
301*4882a593Smuzhiyun 	mutex_unlock(&AFFS_I(inode)->i_link_lock);
302*4882a593Smuzhiyun }
303*4882a593Smuzhiyun static inline void
affs_lock_dir(struct inode * inode)304*4882a593Smuzhiyun affs_lock_dir(struct inode *inode)
305*4882a593Smuzhiyun {
306*4882a593Smuzhiyun 	mutex_lock_nested(&AFFS_I(inode)->i_hash_lock, SINGLE_DEPTH_NESTING);
307*4882a593Smuzhiyun }
308*4882a593Smuzhiyun static inline void
affs_unlock_dir(struct inode * inode)309*4882a593Smuzhiyun affs_unlock_dir(struct inode *inode)
310*4882a593Smuzhiyun {
311*4882a593Smuzhiyun 	mutex_unlock(&AFFS_I(inode)->i_hash_lock);
312*4882a593Smuzhiyun }
313*4882a593Smuzhiyun static inline void
affs_lock_ext(struct inode * inode)314*4882a593Smuzhiyun affs_lock_ext(struct inode *inode)
315*4882a593Smuzhiyun {
316*4882a593Smuzhiyun 	mutex_lock(&AFFS_I(inode)->i_ext_lock);
317*4882a593Smuzhiyun }
318*4882a593Smuzhiyun static inline void
affs_unlock_ext(struct inode * inode)319*4882a593Smuzhiyun affs_unlock_ext(struct inode *inode)
320*4882a593Smuzhiyun {
321*4882a593Smuzhiyun 	mutex_unlock(&AFFS_I(inode)->i_ext_lock);
322*4882a593Smuzhiyun }
323