Lines Matching defs: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
453 * ext2_alloc_branch - allocate and set up a chain of blocks.
455 * @indirect_blks: depth of the chain (number of blocks to allocate)
459 * @branch: place to store the chain in.
462 * links them into chain and (if we are synchronous) writes them to disk.
464 * inode. It stores the information about that chain in the branch[], in
466 * we had read the existing part of chain and partial points to the last
469 * place chain is disconnected - *branch->p is still zero (we did not
475 * ext2_alloc_block() (normally -ENOSPC). Otherwise we set the chain
520 * End of chain, update the last new metablock of
521 * the chain to point to the new allocated
559 * chain to new block and return 0.
631 Indirect chain[4];
648 partial = ext2_get_branch(inode, depth, offsets, chain, &err);
651 first_block = le32_to_cpu(chain[depth - 1].key);
657 if (!verify_chain(chain, chain + depth - 1)) {
666 partial = chain + depth - 1;
669 blk = le32_to_cpu(*(chain[depth-1].p + count));
686 * the chain(ext2_get_branch() returns -EAGAIN err), or
687 * if the chain has been changed after we grab the semaphore,
689 * another get_block allocated this branch) re-grab the chain to see if
693 * at this point, we will have the current copy of the chain when we
696 if (err == -EAGAIN || !verify_chain(chain, partial)) {
697 while (partial > chain) {
701 partial = ext2_get_branch(inode, depth, offsets, chain, &err);
724 indirect_blks = (chain + depth) - partial - 1;
735 offsets + (partial - chain), partial);
748 le32_to_cpu(chain[depth-1].key),
756 le32_to_cpu(chain[depth-1].key), count,
772 partial = chain + depth - 1; /* the whole chain */
774 while (partial > chain) {
779 *bno = le32_to_cpu(chain[depth-1].key);
999 * @chain: place to store the pointers to partial indirect blocks
1016 * truncated blocks - in @chain[].bh and pointers to their last elements
1017 * that should not be removed - in @chain[].p. Return value is the pointer
1018 * to last filled element of @chain.
1023 * (@chain[i].p+1 .. end of @chain[i].bh->b_data)
1024 * c) free the subtrees growing from the inode past the @chain[0].p
1031 Indirect chain[4],
1040 partial = ext2_get_branch(inode, k, offsets, chain, &err);
1042 partial = chain + k-1;
1052 for (p=partial; p>chain && all_zeroes((__le32*)p->bh->b_data,p->p); p--)
1060 if (p == chain + k - 1 && p > chain) {
1169 Indirect chain[4];
1198 partial = ext2_find_shared(inode, n, offsets, chain, &nr);
1201 if (partial == chain)
1205 ext2_free_branches(inode, &nr, &nr+1, (chain+n-1) - partial);
1208 while (partial > chain) {
1212 (chain+n-1) - partial);