indirect.c (498495dba268b20e8eadd7fe93c140c68b6cc9d2) indirect.c (2ee3ee06a8fd792765fa3267ddf928997797eec5)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/ext4/indirect.c
4 *
5 * from
6 *
7 * linux/fs/ext4/inode.c
8 *

--- 547 unchanged lines hidden (view full) ---

556 goto got_it;
557 }
558
559 /* Next simple case - plain lookup failed */
560 if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) {
561 unsigned epb = inode->i_sb->s_blocksize / sizeof(u32);
562 int i;
563
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/ext4/indirect.c
4 *
5 * from
6 *
7 * linux/fs/ext4/inode.c
8 *

--- 547 unchanged lines hidden (view full) ---

556 goto got_it;
557 }
558
559 /* Next simple case - plain lookup failed */
560 if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) {
561 unsigned epb = inode->i_sb->s_blocksize / sizeof(u32);
562 int i;
563
564 /* Count number blocks in a subtree under 'partial' */
565 count = 1;
566 for (i = 0; partial + i != chain + depth - 1; i++)
567 count *= epb;
564 /*
565 * Count number blocks in a subtree under 'partial'. At each
566 * level we count number of complete empty subtrees beyond
567 * current offset and then descend into the subtree only
568 * partially beyond current offset.
569 */
570 count = 0;
571 for (i = partial - chain + 1; i < depth; i++)
572 count = count * epb + (epb - offsets[i] - 1);
573 count++;
568 /* Fill in size of a hole we found */
569 map->m_pblk = 0;
570 map->m_len = min_t(unsigned int, map->m_len, count);
571 goto cleanup;
572 }
573
574 /* Failed read of indirect block */
575 if (err == -EIO)

--- 875 unchanged lines hidden ---
574 /* Fill in size of a hole we found */
575 map->m_pblk = 0;
576 map->m_len = min_t(unsigned int, map->m_len, count);
577 goto cleanup;
578 }
579
580 /* Failed read of indirect block */
581 if (err == -EIO)

--- 875 unchanged lines hidden ---