Lines Matching refs:chain
206 * ext2_get_branch - read the chain of indirect blocks leading to data
208 * @depth: depth of the chain (1 - direct pointer, etc.)
210 * @chain: place to store the result
215 * (incomplete one) otherwise. Upon the return chain[i].key contains
216 * the number of (i+1)-th block in the chain (as it is stored in memory,
217 * i.e. little-endian 32-bit), chain[i].p contains the address of that
219 * for i>0) and chain[i].bh points to the buffer_head of i-th indirect
221 * numbers of the chain, addresses they were taken from (and where we can
222 * verify that chain did not change) and buffer_heads hosting these
229 * or when it notices that chain had been changed while it was reading
232 * the whole chain, all way to the data (returns %NULL, *err == 0).
237 Indirect chain[4],
241 Indirect *p = chain;
246 add_chain (chain, NULL, EXT2_I(inode)->i_data + *offsets);
254 if (!verify_chain(chain, p))
325 * @partial: pointer to the last triple within a chain
353 * @branch: chain of indirect blocks
449 * ext2_alloc_branch - allocate and set up a chain of blocks.
451 * @indirect_blks: depth of the chain (number of blocks to allocate)
455 * @branch: place to store the chain in.
458 * links them into chain and (if we are synchronous) writes them to disk.
460 * inode. It stores the information about that chain in the branch[], in
462 * we had read the existing part of chain and partial points to the last
465 * place chain is disconnected - *branch->p is still zero (we did not
471 * ext2_alloc_block() (normally -ENOSPC). Otherwise we set the chain
516 * End of chain, update the last new metablock of
517 * the chain to point to the new allocated
555 * chain to new block and return 0.
627 Indirect chain[4];
644 partial = ext2_get_branch(inode, depth, offsets, chain, &err);
647 first_block = le32_to_cpu(chain[depth - 1].key);
653 if (!verify_chain(chain, chain + depth - 1)) {
662 partial = chain + depth - 1;
665 blk = le32_to_cpu(*(chain[depth-1].p + count));
682 * the chain(ext2_get_branch() returns -EAGAIN err), or
683 * if the chain has been changed after we grab the semaphore,
685 * another get_block allocated this branch) re-grab the chain to see if
689 * at this point, we will have the current copy of the chain when we
692 if (err == -EAGAIN || !verify_chain(chain, partial)) {
693 while (partial > chain) {
697 partial = ext2_get_branch(inode, depth, offsets, chain, &err);
720 indirect_blks = (chain + depth) - partial - 1;
731 offsets + (partial - chain), partial);
744 le32_to_cpu(chain[depth-1].key),
752 le32_to_cpu(chain[depth-1].key), count,
768 partial = chain + depth - 1; /* the whole chain */
770 while (partial > chain) {
775 *bno = le32_to_cpu(chain[depth-1].key);
1015 * @chain: place to store the pointers to partial indirect blocks
1032 * truncated blocks - in @chain[].bh and pointers to their last elements
1033 * that should not be removed - in @chain[].p. Return value is the pointer
1034 * to last filled element of @chain.
1039 * (@chain[i].p+1 .. end of @chain[i].bh->b_data)
1040 * c) free the subtrees growing from the inode past the @chain[0].p
1047 Indirect chain[4],
1056 partial = ext2_get_branch(inode, k, offsets, chain, &err);
1058 partial = chain + k-1;
1068 for (p=partial; p>chain && all_zeroes((__le32*)p->bh->b_data,p->p); p--)
1076 if (p == chain + k - 1 && p > chain) {
1185 Indirect chain[4];
1214 partial = ext2_find_shared(inode, n, offsets, chain, &nr);
1217 if (partial == chain)
1221 ext2_free_branches(inode, &nr, &nr+1, (chain+n-1) - partial);
1224 while (partial > chain) {
1228 (chain+n-1) - partial);