Lines Matching refs:index

24  * each directory page maintains a sorted entry index table
25 * which stores the start slot index of sorted entries
104 s16 index;
172 static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
190 * Reads a page of a directory's index table.
232 * index and pointer to its entry.
236 static struct dir_table_slot *find_index(struct inode *ip, u32 index,
246 if (index < 2) {
248 jfs_warn("find_entry called with index = %d", index);
254 if (index >= jfs_ip->next_index) {
255 jfs_warn("find_entry called with index >= next_index");
264 slot = &jfs_ip->i_dirtable[index - 2];
266 offset = (index - 2) * sizeof(struct dir_table_slot);
292 u32 index)
301 if (llck->index >= llck->maxcnt)
303 lv = &llck->lv[llck->index];
309 lv->offset = ((index - 2) & 511) >> 1;
311 llck->index++;
317 * Adds an entry to the directory index table. This is used to provide
318 * each directory entry with a persistent index in which to resume
328 u32 index;
345 index = jfs_ip->next_index++;
347 if (index <= MAX_INLINE_DIRTABLE_ENTRY) {
349 * i_size reflects size of index table, or 8 bytes per entry.
351 ip->i_size = (loff_t) (index - 1) << 3;
356 dirtab_slot = &jfs_ip->i_dirtable[index-2];
363 return index;
365 if (index == (MAX_INLINE_DIRTABLE_ENTRY + 1)) {
414 ASSERT(llck->index == 0);
419 llck->index++;
432 offset = (index - 2) * sizeof(struct dir_table_slot);
458 lock_index(tid, ip, mp, index);
469 return index;
481 * Marks an entry to the directory index table as free.
483 static void free_index(tid_t tid, struct inode *ip, u32 index, u32 next)
489 dirtab_slot = find_index(ip, index, &mp, &lblock);
499 lock_index(tid, ip, mp, index);
509 * Changes an entry in the directory index table
511 static void modify_index(tid_t tid, struct inode *ip, u32 index, s64 bn,
516 dirtab_slot = find_index(ip, index, mp, lblock);
525 lock_index(tid, ip, *mp, index);
536 static int read_index(struct inode *ip, u32 index,
543 slot = find_index(ip, index, &mp, &lblock);
576 int base, index, lim;
615 * greater than K so that the returned index is the position of
634 index = base + (lim >> 1);
636 if (stbl[index] < 0) {
644 ciCompare(&ciKey, p, stbl[index],
649 cmp = dtCompare(&ciKey, p, stbl[index]);
662 ((struct ldtentry *) & p->slot[stbl[index]])->inumber);
699 btsp->index = index;
713 base = index + 1;
721 * base is the smallest index with key (Kj) greater than
722 * search key (K) and may be zero or (maxindex + 1) index.
748 btsp->index = base;
761 index = base ? base - 1 : base;
779 /* push (bn, index) of the parent page/entry */
780 BT_PUSH(btstack, bn, index);
783 pxd = (pxd_t *) & p->slot[stbl[index]];
819 dtpage_t *p; /* base B+-tree index page */
821 int index;
832 * dtSearch() returns (leaf page pinned, index at which to insert).
833 * n.b. dtSearch() may return index of (maxindex + 1) of
836 DT_GETSEARCH(ip, btstack->top, bn, mp, p, index);
864 split.index = index;
883 ASSERT(dtlck->index == 0);
889 dtlck->index++;
891 dtInsertEntry(p, index, name, &data, &dtlck);
895 if (dtlck->index >= dtlck->maxcnt)
897 lv = & dtlck->lv[dtlck->index];
898 n = index >> L2DTSLOTSIZE;
902 dtlck->index++;
935 int skip; /* index of entry of insertion */
1067 * new index page(s) to cover page split(s)
1104 * of (bn of parent page, index of child page entry in parent page)
1139 * The new key entry goes ONE AFTER the index of parent entry,
1142 skip = parent->index + 1;
1228 split->index = skip; /* index at insert */
1260 ASSERT(dtlck->index == 0);
1266 dtlck->index++;
1276 dtlck->index++;
1394 ASSERT(sdtlck->index == 0);
1398 sdtlck->index++;
1439 if (nextbn == 0 && split->index == sp->header.nextindex) {
1441 rlv = & rdtlck->lv[rdtlck->index];
1444 rdtlck->index++;
1484 lv = & dtlck->lv[dtlck->index];
1487 dtlck->index++;
1497 skip = split->index;
1553 rlv = & rdtlck->lv[rdtlck->index];
1556 rdtlck->index++;
1572 * Update directory index table for entries now in right page
1581 modify_index(tid, ip, le32_to_cpu(ldtentry->index),
1589 * the skipped index was on the left page,
1596 if (sdtlck->index >= sdtlck->maxcnt)
1598 slv = & sdtlck->lv[sdtlck->index];
1603 sdtlck->index++;
1606 * the skipped index was on the right page,
1609 /* adjust the skip index to reflect the new position */
1693 pxdlock->index = 1;
1696 * Update directory index table to reflect new page address
1707 le32_to_cpu(ldtentry->index),
1752 dtlck->index++;
1767 dtlck->index++;
1814 dtInsertEntry(sp, split->index, split->key, split->data, &dtlck);
1834 lv = & dtlck->lv[dtlck->index];
1839 dtlck->index++;
1939 ASSERT(dtlck->index == 0);
1943 dtlck->index++;
1986 * Update directory index table for entries now in right page
1996 modify_index(tid, ip, le32_to_cpu(ldtentry->index),
2004 * (skip index in the new right page will not change)
2006 dtInsertEntry(rp, split->index, split->key, split->data, &dtlck);
2025 ASSERT(dtlck->index == 0);
2029 dtlck->index++;
2082 int index;
2097 * dtSearch() returns (leaf page pinned, index at which to delete).
2103 DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
2106 * We need to find put the index of the next entry into the
2107 * directory index table in order to resume a readdir from this
2112 ldtentry = (struct ldtentry *) & p->slot[stbl[index]];
2113 table_index = le32_to_cpu(ldtentry->index);
2114 if (index == (p->header.nextindex - 1)) {
2133 le32_to_cpu(ldtentry->index);
2139 (struct ldtentry *) & p->slot[stbl[index + 1]];
2140 next_index = le32_to_cpu(ldtentry->index);
2165 * Do not assume that dtlck->index will be zero. During a
2171 if (dtlck->index >= dtlck->maxcnt)
2173 lv = & dtlck->lv[dtlck->index];
2176 dtlck->index++;
2180 if (dtlck->index >= dtlck->maxcnt)
2182 lv = & dtlck->lv[dtlck->index];
2183 i = index >> L2DTSLOTSIZE;
2188 dtlck->index++;
2192 dtDeleteEntry(p, index, &dtlck);
2195 * Update directory index table for entries moved in stbl
2197 if (DO_INDEX(ip) && index < p->header.nextindex) {
2202 for (i = index; i < p->header.nextindex; i++) {
2206 le32_to_cpu(ldtentry->index),
2236 int index, nextindex;
2275 pxdlock->index = 1;
2308 index = parent->index;
2351 pxdlock->index = 1;
2387 if (dtlck->index >= dtlck->maxcnt)
2389 lv = & dtlck->lv[dtlck->index];
2392 dtlck->index++;
2396 if (dtlck->index < dtlck->maxcnt)
2402 i = index >> L2DTSLOTSIZE;
2407 dtlck->index++;
2411 dtDeleteEntry(p, index, &dtlck);
2414 if (index == 0 &&
2472 if (dtlck->index >= dtlck->maxcnt)
2474 lv = & dtlck->lv[dtlck->index];
2477 dtlck->index++;
2501 if (dtlck->index >= dtlck->maxcnt)
2503 lv = & dtlck->lv[dtlck->index];
2506 dtlck->index++;
2576 ASSERT(dtlck->index == 0);
2580 dtlck->index++;
2609 * function: Fix dtree page in which one or more entries has an invalid index.
2611 * Called from jfs_readdir when bad index is detected.
2618 uint index;
2648 index = le32_to_cpu(d->index);
2649 if ((index < 2) || (index >= JFS_IP(inode)->next_index)) {
2650 d->index = cpu_to_le32(add_index(tid, inode, bn, i));
2651 if (dtlck->index >= dtlck->maxcnt)
2653 lv = &dtlck->lv[dtlck->index];
2656 dtlck->index++;
2697 * return: offset = (pn, index) of start entry
2708 s16 index;
2714 int index;
2729 static int unique_pos = 2; /* If we can't fix broken index */
2736 * persistent index is stored in directory entries.
2782 index = dirtab_slot.slot;
2789 jfs_err("jfs_readdir: bad index table");
2821 DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
2827 * pn = 0; index = 1: First entry "."
2828 * pn = 0; index = 2: Second entry ".."
2830 * pn = index = -1: No more entries
2838 dtoffset->index = 2;
2843 if (dtoffset->index == 2) {
2851 dtoffset->index = 0;
2866 /* get start leaf page and index */
2867 DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
2891 for (i = index; i < p->header.nextindex; i++) {
2897 index = i;
2908 jfs_dirent->position = le32_to_cpu(d->index);
2910 * d->index should always be valid, but it
2912 * directory index for the lost+found
2923 * index to i will cause the
2928 index = i;
2934 * We add 1 to the index because we may
2958 "JFS:Dtree error: ino = %ld, bn=%lld, index = %d\n",
2976 dtoffset->index++;
2985 index = 0;
2986 /* update offset (pn:index) for new page */
2989 dtoffset->index = 0;
3067 btsp->index = 0;
3082 /* push (bn, index) of the parent page/entry */
3102 * function: get the page of the specified offset (pn:index)
3106 * note: if index > nextindex of the target leaf page,
3115 s16 index;
3121 int index;
3134 DT_GETSEARCH(ip, btstack->top, bn, mp, p, index);
3136 /* get the start offset (pn:index) */
3138 index = dtoffset->index;
3143 if (index < p->header.nextindex)
3153 dtoffset->index = index = 0;
3242 if (index >= p->header.nextindex) {
3261 dtoffset->index = 0;
3268 btsp->index = dtoffset->index;
3288 { /* entry slot index */
3302 * (? if/when dtSearch() narrows down to 1st entry (index = 0),
3307 * if (e->index == 0 && h->prevpg == P_INVALID && !(h->flags & BT_LEAF))
3363 int si, /* entry slot index */
3381 * (? if/when dtSearch() narrows down to 1st entry (index = 0),
3386 * if (e->index == 0 && h->prevpg == P_INVALID && !(h->flags & BT_LEAF))
3536 static void dtGetKey(dtpage_t * p, int i, /* entry index */
3598 * return: entry slot index
3600 static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
3627 if (dtlck->index >= dtlck->maxcnt)
3630 lv = & dtlck->lv[dtlck->index];
3644 lh->index = cpu_to_le32(add_index(data->leaf.tid,
3646 bn, index));
3678 dtlck->index++;
3681 if (dtlck->index < dtlck->maxcnt)
3703 dtlck->index++;
3721 if (index < nextindex) {
3722 memmove(stbl + index + 1, stbl + index, nextindex - index);
3732 for (n = index + 1; n <= nextindex; n++) {
3735 le32_to_cpu(lh->index), bn, n,
3743 stbl[index] = hsi;
3745 /* advance next available entry index of stbl */
3762 int ssi, next; /* src slot index */
3763 int di; /* dst entry index */
3764 int dsi; /* dst slot index */
3782 dlv = & ddtlck->lv[ddtlck->index];
3786 slv = & sdtlck->lv[sdtlck->index];
3802 sdtlck->index++;
3805 if (sdtlck->index < sdtlck->maxcnt)
3832 dlh->index = slh->index; /* little-endian */
3874 sdtlck->index++;
3877 if (sdtlck->index < sdtlck->maxcnt)
3929 sdtlck->index++;
3933 ddtlck->index++;
3961 int fsi; /* free entry slot index */
3969 /* get free entry slot index */
3974 if (dtlck->index >= dtlck->maxcnt)
3976 lv = & dtlck->lv[dtlck->index];
3998 dtlck->index++;
4001 if (dtlck->index < dtlck->maxcnt)
4023 dtlck->index++;
4056 int tsi; /* truncate entry slot index */
4064 /* get free entry slot index */
4069 if (dtlck->index >= dtlck->maxcnt)
4071 lv = & dtlck->lv[dtlck->index];
4093 dtlck->index++;
4096 if (dtlck->index < dtlck->maxcnt)
4118 dtlck->index++;
4135 int m, /* max slot index */
4138 int fsi; /* free entry slot index */
4145 /* get free entry slot index */
4149 if (dtlck->index >= dtlck->maxcnt)
4151 lv = & dtlck->lv[dtlck->index];
4167 dtlck->index++;
4170 if (dtlck->index < dtlck->maxcnt)
4190 dtlck->index++;
4221 int index;
4227 int entry_si; /* entry slot index */
4233 * dtSearch() returns (leaf page pinned, index at which to modify).
4239 DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
4248 /* get slot index of the entry */
4250 entry_si = stbl[index];
4253 ASSERT(dtlck->index == 0);
4257 dtlck->index++;