Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *   Copyright (C) International Business Machines Corp., 2000-2002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #ifndef	_H_JFS_IMAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #define _H_JFS_IMAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include "jfs_txnmgr.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *	jfs_imap.h: disk inode manager
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define	EXTSPERIAG	128	/* number of disk inode extent per iag	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define IMAPBLKNO	0	/* lblkno of dinomap within inode map	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define SMAPSZ		4	/* number of words per summary map	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define	EXTSPERSUM	32	/* number of extents per summary map entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define	L2EXTSPERSUM	5	/* l2 number of extents per summary map */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define	PGSPERIEXT	4	/* number of 4K pages per dinode extent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define	MAXIAGS		((1<<20)-1)	/* maximum number of iags	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define	MAXAG		128	/* maximum number of allocation groups	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define AMAPSIZE	512	/* bytes in the IAG allocation maps */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define SMAPSIZE	16	/* bytes in the IAG summary maps */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) /* convert inode number to iag number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define	INOTOIAG(ino)	((ino) >> L2INOSPERIAG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) /* convert iag number to logical block number of the iag page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define IAGTOLBLK(iagno,l2nbperpg)	(((iagno) + 1) << (l2nbperpg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) /* get the starting block number of the 4K page of an inode extent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * that contains ino.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define INOPBLK(pxd,ino,l2nbperpg)	(addressPXD((pxd)) +		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	((((ino) & (INOSPEREXT-1)) >> L2INOSPERPAGE) << (l2nbperpg)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  *	inode allocation map:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * inode allocation map consists of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * . the inode map control page and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * . inode allocation group pages (per 4096 inodes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * which are addressed by standard JFS xtree.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  *	inode allocation group page (per 4096 inodes of an AG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) struct iag {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	__le64 agstart;		/* 8: starting block of ag		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	__le32 iagnum;		/* 4: inode allocation group number	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	__le32 inofreefwd;	/* 4: ag inode free list forward	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	__le32 inofreeback;	/* 4: ag inode free list back		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	__le32 extfreefwd;	/* 4: ag inode extent free list forward	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	__le32 extfreeback;	/* 4: ag inode extent free list back	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	__le32 iagfree;		/* 4: iag free list			*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	/* summary map: 1 bit per inode extent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	__le32 inosmap[SMAPSZ];	/* 16: sum map of mapwords w/ free inodes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 				 *	note: this indicates free and backed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 				 *	inodes, if the extent is not backed the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 				 *	value will be 1.  if the extent is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 				 *	backed but all inodes are being used the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 				 *	value will be 1.  if the extent is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 				 *	backed but at least one of the inodes is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 				 *	free the value will be 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 				 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	__le32 extsmap[SMAPSZ];	/* 16: sum map of mapwords w/ free extents */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	__le32 nfreeinos;	/* 4: number of free inodes		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	__le32 nfreeexts;	/* 4: number of free extents		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	/* (72) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	u8 pad[1976];		/* 1976: pad to 2048 bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	/* allocation bit map: 1 bit per inode (0 - free, 1 - allocated) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	__le32 wmap[EXTSPERIAG];	/* 512: working allocation map */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	__le32 pmap[EXTSPERIAG];	/* 512: persistent allocation map */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	pxd_t inoext[EXTSPERIAG];	/* 1024: inode extent addresses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) };				/* (4096) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  *	per AG control information (in inode map control page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) struct iagctl_disk {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	__le32 inofree;		/* 4: free inode list anchor		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	__le32 extfree;		/* 4: free extent list anchor		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	__le32 numinos;		/* 4: number of backed inodes		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	__le32 numfree;		/* 4: number of free inodes		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) };				/* (16) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) struct iagctl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	int inofree;		/* free inode list anchor		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	int extfree;		/* free extent list anchor		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	int numinos;		/* number of backed inodes		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	int numfree;		/* number of free inodes		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  *	per fileset/aggregate inode map control page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) struct dinomap_disk {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	__le32 in_freeiag;	/* 4: free iag list anchor	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	__le32 in_nextiag;	/* 4: next free iag number	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	__le32 in_numinos;	/* 4: num of backed inodes	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	__le32 in_numfree;	/* 4: num of free backed inodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	__le32 in_nbperiext;	/* 4: num of blocks per inode extent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	__le32 in_l2nbperiext;	/* 4: l2 of in_nbperiext	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	__le32 in_diskblock;	/* 4: for standalone test driver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	__le32 in_maxag;	/* 4: for standalone test driver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	u8 pad[2016];		/* 2016: pad to 2048		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	struct iagctl_disk in_agctl[MAXAG]; /* 2048: AG control information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) };				/* (4096) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct dinomap {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	int in_freeiag;		/* free iag list anchor		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	int in_nextiag;		/* next free iag number		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	int in_numinos;		/* num of backed inodes		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	int in_numfree;		/* num of free backed inodes	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	int in_nbperiext;	/* num of blocks per inode extent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	int in_l2nbperiext;	/* l2 of in_nbperiext		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	int in_diskblock;	/* for standalone test driver	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	int in_maxag;		/* for standalone test driver	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	struct iagctl in_agctl[MAXAG];	/* AG control information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  *	In-core inode map control page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) struct inomap {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	struct dinomap im_imap;		/* 4096: inode allocation control */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	struct inode *im_ipimap;	/* 4: ptr to inode for imap	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	struct mutex im_freelock;	/* 4: iag free list lock	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	struct mutex im_aglock[MAXAG];	/* 512: per AG locks		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	u32 *im_DBGdimap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	atomic_t im_numinos;	/* num of backed inodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	atomic_t im_numfree;	/* num of free backed inodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #define	im_freeiag	im_imap.in_freeiag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #define	im_nextiag	im_imap.in_nextiag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #define	im_agctl	im_imap.in_agctl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #define	im_nbperiext	im_imap.in_nbperiext
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #define	im_l2nbperiext	im_imap.in_l2nbperiext
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) /* for standalone testdriver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #define	im_diskblock	im_imap.in_diskblock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #define	im_maxag	im_imap.in_maxag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) extern int diFree(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) extern int diAlloc(struct inode *, bool, struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) extern int diSync(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /* external references */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) extern int diUpdatePMap(struct inode *ipimap, unsigned long inum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 			bool is_free, struct tblock * tblk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) extern int diExtendFS(struct inode *ipimap, struct inode *ipbmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) extern int diMount(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) extern int diUnmount(struct inode *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) extern int diRead(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) extern struct inode *diReadSpecial(struct super_block *, ino_t, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) extern void diWriteSpecial(struct inode *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) extern void diFreeSpecial(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) extern int diWrite(tid_t tid, struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) #endif				/* _H_JFS_IMAP */