~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/jfs/jfs_btree.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/jfs/jfs_btree.h (Version linux-6.12-rc7) and /fs/jfs/jfs_btree.h (Version linux-5.9.16)


  1 /* SPDX-License-Identifier: GPL-2.0-or-later *      1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*                                                  2 /*
  3  *   Copyright (C) International Business Mach      3  *   Copyright (C) International Business Machines Corp., 2000-2004
  4  */                                                 4  */
  5 #ifndef _H_JFS_BTREE                                5 #ifndef _H_JFS_BTREE
  6 #define _H_JFS_BTREE                                6 #define _H_JFS_BTREE
  7                                                     7 
  8 /*                                                  8 /*
  9  *      jfs_btree.h: B+-tree                        9  *      jfs_btree.h: B+-tree
 10  *                                                 10  *
 11  * JFS B+-tree (dtree and xtree) common defini     11  * JFS B+-tree (dtree and xtree) common definitions
 12  */                                                12  */
 13                                                    13 
 14 /*                                                 14 /*
 15  *      basic btree page - btpage                  15  *      basic btree page - btpage
 16  *                                                 16  *
 17 struct btpage {                                    17 struct btpage {
 18         s64 next;               right sibling      18         s64 next;               right sibling bn
 19         s64 prev;               left sibling b     19         s64 prev;               left sibling bn
 20                                                    20 
 21         u8 flag;                                   21         u8 flag;
 22         u8 rsrvd[7];            type specific      22         u8 rsrvd[7];            type specific
 23         s64 self;               self address       23         s64 self;               self address
 24                                                    24 
 25         u8 entry[4064];                            25         u8 entry[4064];
 26 };                                                 26 };                                              */
 27                                                    27 
 28 /* btpaget_t flag */                               28 /* btpaget_t flag */
 29 #define BT_TYPE         0x07    /* B+-tree ind     29 #define BT_TYPE         0x07    /* B+-tree index */
 30 #define BT_ROOT         0x01    /* root page *     30 #define BT_ROOT         0x01    /* root page */
 31 #define BT_LEAF         0x02    /* leaf page *     31 #define BT_LEAF         0x02    /* leaf page */
 32 #define BT_INTERNAL     0x04    /* internal pa     32 #define BT_INTERNAL     0x04    /* internal page */
 33 #define BT_RIGHTMOST    0x10    /* rightmost p     33 #define BT_RIGHTMOST    0x10    /* rightmost page */
 34 #define BT_LEFTMOST     0x20    /* leftmost pa     34 #define BT_LEFTMOST     0x20    /* leftmost page */
 35 #define BT_SWAPPED      0x80    /* used by fsc     35 #define BT_SWAPPED      0x80    /* used by fsck for endian swapping */
 36                                                    36 
 37 /* btorder (in inode) */                           37 /* btorder (in inode) */
 38 #define BT_RANDOM               0x0000             38 #define BT_RANDOM               0x0000
 39 #define BT_SEQUENTIAL           0x0001             39 #define BT_SEQUENTIAL           0x0001
 40 #define BT_LOOKUP               0x0010             40 #define BT_LOOKUP               0x0010
 41 #define BT_INSERT               0x0020             41 #define BT_INSERT               0x0020
 42 #define BT_DELETE               0x0040             42 #define BT_DELETE               0x0040
 43                                                    43 
 44 /*                                                 44 /*
 45  *      btree page buffer cache access             45  *      btree page buffer cache access
 46  */                                                46  */
 47 #define BT_IS_ROOT(MP) (((MP)->xflag & COMMIT_     47 #define BT_IS_ROOT(MP) (((MP)->xflag & COMMIT_PAGE) == 0)
 48                                                    48 
 49 /* get page from buffer page */                    49 /* get page from buffer page */
 50 #define BT_PAGE(IP, MP, TYPE, ROOT)\               50 #define BT_PAGE(IP, MP, TYPE, ROOT)\
 51         (BT_IS_ROOT(MP) ? (TYPE *)&JFS_IP(IP)-     51         (BT_IS_ROOT(MP) ? (TYPE *)&JFS_IP(IP)->ROOT : (TYPE *)(MP)->data)
 52                                                    52 
 53 /* get the page buffer and the page for specif     53 /* get the page buffer and the page for specified block address */
 54 #define BT_GETPAGE(IP, BN, MP, TYPE, SIZE, P,      54 #define BT_GETPAGE(IP, BN, MP, TYPE, SIZE, P, RC, ROOT)\
 55 {\                                                 55 {\
 56         if ((BN) == 0)\                            56         if ((BN) == 0)\
 57         {\                                         57         {\
 58                 MP = (struct metapage *)&JFS_I     58                 MP = (struct metapage *)&JFS_IP(IP)->bxflag;\
 59                 P = (TYPE *)&JFS_IP(IP)->ROOT;     59                 P = (TYPE *)&JFS_IP(IP)->ROOT;\
 60                 RC = 0;\                           60                 RC = 0;\
 61         }\                                         61         }\
 62         else\                                      62         else\
 63         {\                                         63         {\
 64                 MP = read_metapage((IP), BN, S     64                 MP = read_metapage((IP), BN, SIZE, 1);\
 65                 if (MP) {\                         65                 if (MP) {\
 66                         RC = 0;\                   66                         RC = 0;\
 67                         P = (MP)->data;\           67                         P = (MP)->data;\
 68                 } else {\                          68                 } else {\
 69                         P = NULL;\                 69                         P = NULL;\
 70                         jfs_err("bread failed!     70                         jfs_err("bread failed!");\
 71                         RC = -EIO;\                71                         RC = -EIO;\
 72                 }\                                 72                 }\
 73         }\                                         73         }\
 74 }                                                  74 }
 75                                                    75 
 76 #define BT_MARK_DIRTY(MP, IP)\                     76 #define BT_MARK_DIRTY(MP, IP)\
 77 {\                                                 77 {\
 78         if (BT_IS_ROOT(MP))\                       78         if (BT_IS_ROOT(MP))\
 79                 mark_inode_dirty(IP);\             79                 mark_inode_dirty(IP);\
 80         else\                                      80         else\
 81                 mark_metapage_dirty(MP);\          81                 mark_metapage_dirty(MP);\
 82 }                                                  82 }
 83                                                    83 
 84 /* put the page buffer */                          84 /* put the page buffer */
 85 #define BT_PUTPAGE(MP)\                            85 #define BT_PUTPAGE(MP)\
 86 {\                                                 86 {\
 87         if (! BT_IS_ROOT(MP)) \                    87         if (! BT_IS_ROOT(MP)) \
 88                 release_metapage(MP); \            88                 release_metapage(MP); \
 89 }                                                  89 }
 90                                                    90 
 91                                                    91 
 92 /*                                                 92 /*
 93  *      btree traversal stack                      93  *      btree traversal stack
 94  *                                                 94  *
 95  * record the path traversed during the search     95  * record the path traversed during the search;
 96  * top frame record the leaf page/entry select     96  * top frame record the leaf page/entry selected.
 97  */                                                97  */
 98 struct btframe {        /* stack frame */          98 struct btframe {        /* stack frame */
 99         s64 bn;                 /* 8: */           99         s64 bn;                 /* 8: */
100         s16 index;              /* 2: */          100         s16 index;              /* 2: */
101         s16 lastindex;          /* 2: unused *    101         s16 lastindex;          /* 2: unused */
102         struct metapage *mp;    /* 4/8: */        102         struct metapage *mp;    /* 4/8: */
103 };                              /* (16/24) */     103 };                              /* (16/24) */
104                                                   104 
105 struct btstack {                                  105 struct btstack {
106         struct btframe *top;                      106         struct btframe *top;
107         int nsplit;                               107         int nsplit;
108         struct btframe stack[MAXTREEHEIGHT];      108         struct btframe stack[MAXTREEHEIGHT];
109 };                                                109 };
110                                                   110 
111 #define BT_CLR(btstack)\                          111 #define BT_CLR(btstack)\
112         (btstack)->top = (btstack)->stack         112         (btstack)->top = (btstack)->stack
113                                                   113 
114 #define BT_STACK_FULL(btstack)\                   114 #define BT_STACK_FULL(btstack)\
115         ( (btstack)->top == &((btstack)->stack    115         ( (btstack)->top == &((btstack)->stack[MAXTREEHEIGHT-1]))
116                                                   116 
117 #define BT_PUSH(BTSTACK, BN, INDEX)\              117 #define BT_PUSH(BTSTACK, BN, INDEX)\
118 {\                                                118 {\
119         assert(!BT_STACK_FULL(BTSTACK));\         119         assert(!BT_STACK_FULL(BTSTACK));\
120         (BTSTACK)->top->bn = BN;\                 120         (BTSTACK)->top->bn = BN;\
121         (BTSTACK)->top->index = INDEX;\           121         (BTSTACK)->top->index = INDEX;\
122         ++(BTSTACK)->top;\                        122         ++(BTSTACK)->top;\
123 }                                                 123 }
124                                                   124 
125 #define BT_POP(btstack)\                          125 #define BT_POP(btstack)\
126         ( (btstack)->top == (btstack)->stack ?    126         ( (btstack)->top == (btstack)->stack ? NULL : --(btstack)->top )
127                                                   127 
128 #define BT_STACK(btstack)\                        128 #define BT_STACK(btstack)\
129         ( (btstack)->top == (btstack)->stack ?    129         ( (btstack)->top == (btstack)->stack ? NULL : (btstack)->top )
130                                                   130 
131 static inline void BT_STACK_DUMP(struct btstac    131 static inline void BT_STACK_DUMP(struct btstack *btstack)
132 {                                                 132 {
133         int i;                                    133         int i;
134         printk("btstack dump:\n");                134         printk("btstack dump:\n");
135         for (i = 0; i < MAXTREEHEIGHT; i++)       135         for (i = 0; i < MAXTREEHEIGHT; i++)
136                 printk(KERN_ERR "bn = %Lx, ind    136                 printk(KERN_ERR "bn = %Lx, index = %d\n",
137                        (long long)btstack->sta    137                        (long long)btstack->stack[i].bn,
138                        btstack->stack[i].index    138                        btstack->stack[i].index);
139 }                                                 139 }
140                                                   140 
141 /* retrieve search results */                     141 /* retrieve search results */
142 #define BT_GETSEARCH(IP, LEAF, BN, MP, TYPE, P    142 #define BT_GETSEARCH(IP, LEAF, BN, MP, TYPE, P, INDEX, ROOT)\
143 {\                                                143 {\
144         BN = (LEAF)->bn;\                         144         BN = (LEAF)->bn;\
145         MP = (LEAF)->mp;\                         145         MP = (LEAF)->mp;\
146         if (BN)\                                  146         if (BN)\
147                 P = (TYPE *)MP->data;\            147                 P = (TYPE *)MP->data;\
148         else\                                     148         else\
149                 P = (TYPE *)&JFS_IP(IP)->ROOT;    149                 P = (TYPE *)&JFS_IP(IP)->ROOT;\
150         INDEX = (LEAF)->index;\                   150         INDEX = (LEAF)->index;\
151 }                                                 151 }
152                                                   152 
153 /* put the page buffer of search */               153 /* put the page buffer of search */
154 #define BT_PUTSEARCH(BTSTACK)\                    154 #define BT_PUTSEARCH(BTSTACK)\
155 {\                                                155 {\
156         if (! BT_IS_ROOT((BTSTACK)->top->mp))\    156         if (! BT_IS_ROOT((BTSTACK)->top->mp))\
157                 release_metapage((BTSTACK)->to    157                 release_metapage((BTSTACK)->top->mp);\
158 }                                                 158 }
159 #endif                          /* _H_JFS_BTRE    159 #endif                          /* _H_JFS_BTREE */
160                                                   160 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php