indirect.c (14e77332e74603efab8347c89d3cda447c3b97c9) indirect.c (26d75a16af285a70863ba6a81f85d81e7e65da50)
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 *

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

143 */
144static Indirect *ext4_get_branch(struct inode *inode, int depth,
145 ext4_lblk_t *offsets,
146 Indirect chain[4], int *err)
147{
148 struct super_block *sb = inode->i_sb;
149 Indirect *p = chain;
150 struct buffer_head *bh;
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 *

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

143 */
144static Indirect *ext4_get_branch(struct inode *inode, int depth,
145 ext4_lblk_t *offsets,
146 Indirect chain[4], int *err)
147{
148 struct super_block *sb = inode->i_sb;
149 Indirect *p = chain;
150 struct buffer_head *bh;
151 unsigned int key;
151 int ret = -EIO;
152
153 *err = 0;
154 /* i_data is not going away, no lock needed */
155 add_chain(chain, NULL, EXT4_I(inode)->i_data + *offsets);
156 if (!p->key)
157 goto no_block;
158 while (--depth) {
152 int ret = -EIO;
153
154 *err = 0;
155 /* i_data is not going away, no lock needed */
156 add_chain(chain, NULL, EXT4_I(inode)->i_data + *offsets);
157 if (!p->key)
158 goto no_block;
159 while (--depth) {
159 bh = sb_getblk(sb, le32_to_cpu(p->key));
160 key = le32_to_cpu(p->key);
161 if (key > ext4_blocks_count(EXT4_SB(sb)->s_es)) {
162 /* the block was out of range */
163 ret = -EFSCORRUPTED;
164 goto failure;
165 }
166 bh = sb_getblk(sb, key);
160 if (unlikely(!bh)) {
161 ret = -ENOMEM;
162 goto failure;
163 }
164
165 if (!bh_uptodate_or_lock(bh)) {
166 if (ext4_read_bh(bh, 0, NULL) < 0) {
167 put_bh(bh);

--- 1299 unchanged lines hidden ---
167 if (unlikely(!bh)) {
168 ret = -ENOMEM;
169 goto failure;
170 }
171
172 if (!bh_uptodate_or_lock(bh)) {
173 if (ext4_read_bh(bh, 0, NULL) < 0) {
174 put_bh(bh);

--- 1299 unchanged lines hidden ---