extents.c (c4cf5f61982e35348f522464010445efcc0aeb60) | extents.c (0caaefbaf2a429c256c7469cb603ca8918e96fb0) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com 4 * Written by Alex Tomas <alex@clusterfs.com> 5 * 6 * Architecture independence: 7 * Copyright (c) 2005, Bull S.A. 8 * Written by Pierre Peiffer <pierre.peiffer@bull.net> --- 811 unchanged lines hidden (view full) --- 820{ 821 struct ext4_extent_header *eh; 822 823 eh = ext_inode_hdr(inode); 824 eh->eh_depth = 0; 825 eh->eh_entries = 0; 826 eh->eh_magic = EXT4_EXT_MAGIC; 827 eh->eh_max = cpu_to_le16(ext4_ext_space_root(inode, 0)); | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com 4 * Written by Alex Tomas <alex@clusterfs.com> 5 * 6 * Architecture independence: 7 * Copyright (c) 2005, Bull S.A. 8 * Written by Pierre Peiffer <pierre.peiffer@bull.net> --- 811 unchanged lines hidden (view full) --- 820{ 821 struct ext4_extent_header *eh; 822 823 eh = ext_inode_hdr(inode); 824 eh->eh_depth = 0; 825 eh->eh_entries = 0; 826 eh->eh_magic = EXT4_EXT_MAGIC; 827 eh->eh_max = cpu_to_le16(ext4_ext_space_root(inode, 0)); |
828 eh->eh_generation = 0; |
|
828 ext4_mark_inode_dirty(handle, inode); 829} 830 831struct ext4_ext_path * 832ext4_find_extent(struct inode *inode, ext4_lblk_t block, 833 struct ext4_ext_path **orig_path, int flags) 834{ 835 struct ext4_extent_header *eh; --- 249 unchanged lines hidden (view full) --- 1085 if (err) 1086 goto cleanup; 1087 1088 neh = ext_block_hdr(bh); 1089 neh->eh_entries = 0; 1090 neh->eh_max = cpu_to_le16(ext4_ext_space_block(inode, 0)); 1091 neh->eh_magic = EXT4_EXT_MAGIC; 1092 neh->eh_depth = 0; | 829 ext4_mark_inode_dirty(handle, inode); 830} 831 832struct ext4_ext_path * 833ext4_find_extent(struct inode *inode, ext4_lblk_t block, 834 struct ext4_ext_path **orig_path, int flags) 835{ 836 struct ext4_extent_header *eh; --- 249 unchanged lines hidden (view full) --- 1086 if (err) 1087 goto cleanup; 1088 1089 neh = ext_block_hdr(bh); 1090 neh->eh_entries = 0; 1091 neh->eh_max = cpu_to_le16(ext4_ext_space_block(inode, 0)); 1092 neh->eh_magic = EXT4_EXT_MAGIC; 1093 neh->eh_depth = 0; |
1094 neh->eh_generation = 0; |
|
1093 1094 /* move remainder of path[depth] to the new leaf */ 1095 if (unlikely(path[depth].p_hdr->eh_entries != 1096 path[depth].p_hdr->eh_max)) { 1097 EXT4_ERROR_INODE(inode, "eh_entries %d != eh_max %d!", 1098 path[depth].p_hdr->eh_entries, 1099 path[depth].p_hdr->eh_max); 1100 err = -EFSCORRUPTED; --- 61 unchanged lines hidden (view full) --- 1162 if (err) 1163 goto cleanup; 1164 1165 neh = ext_block_hdr(bh); 1166 neh->eh_entries = cpu_to_le16(1); 1167 neh->eh_magic = EXT4_EXT_MAGIC; 1168 neh->eh_max = cpu_to_le16(ext4_ext_space_block_idx(inode, 0)); 1169 neh->eh_depth = cpu_to_le16(depth - i); | 1095 1096 /* move remainder of path[depth] to the new leaf */ 1097 if (unlikely(path[depth].p_hdr->eh_entries != 1098 path[depth].p_hdr->eh_max)) { 1099 EXT4_ERROR_INODE(inode, "eh_entries %d != eh_max %d!", 1100 path[depth].p_hdr->eh_entries, 1101 path[depth].p_hdr->eh_max); 1102 err = -EFSCORRUPTED; --- 61 unchanged lines hidden (view full) --- 1164 if (err) 1165 goto cleanup; 1166 1167 neh = ext_block_hdr(bh); 1168 neh->eh_entries = cpu_to_le16(1); 1169 neh->eh_magic = EXT4_EXT_MAGIC; 1170 neh->eh_max = cpu_to_le16(ext4_ext_space_block_idx(inode, 0)); 1171 neh->eh_depth = cpu_to_le16(depth - i); |
1172 neh->eh_generation = 0; |
|
1170 fidx = EXT_FIRST_INDEX(neh); 1171 fidx->ei_block = border; 1172 ext4_idx_store_pblock(fidx, oldblock); 1173 1174 ext_debug(inode, "int.index at %d (block %llu): %u -> %llu\n", 1175 i, newblock, le32_to_cpu(border), oldblock); 1176 1177 /* move remainder of path[i] to the new index block */ --- 123 unchanged lines hidden (view full) --- 1301 * so calculate e_max right way */ 1302 if (ext_depth(inode)) 1303 neh->eh_max = cpu_to_le16(ext4_ext_space_block_idx(inode, 0)); 1304 else 1305 neh->eh_max = cpu_to_le16(ext4_ext_space_block(inode, 0)); 1306 neh->eh_magic = EXT4_EXT_MAGIC; 1307 ext4_extent_block_csum_set(inode, neh); 1308 set_buffer_uptodate(bh); | 1173 fidx = EXT_FIRST_INDEX(neh); 1174 fidx->ei_block = border; 1175 ext4_idx_store_pblock(fidx, oldblock); 1176 1177 ext_debug(inode, "int.index at %d (block %llu): %u -> %llu\n", 1178 i, newblock, le32_to_cpu(border), oldblock); 1179 1180 /* move remainder of path[i] to the new index block */ --- 123 unchanged lines hidden (view full) --- 1304 * so calculate e_max right way */ 1305 if (ext_depth(inode)) 1306 neh->eh_max = cpu_to_le16(ext4_ext_space_block_idx(inode, 0)); 1307 else 1308 neh->eh_max = cpu_to_le16(ext4_ext_space_block(inode, 0)); 1309 neh->eh_magic = EXT4_EXT_MAGIC; 1310 ext4_extent_block_csum_set(inode, neh); 1311 set_buffer_uptodate(bh); |
1312 set_buffer_verified(bh); |
|
1309 unlock_buffer(bh); 1310 1311 err = ext4_handle_dirty_metadata(handle, inode, bh); 1312 if (err) 1313 goto out; 1314 1315 /* Update top-level index: num,max,pointer */ 1316 neh = ext_inode_hdr(inode); --- 4748 unchanged lines hidden --- | 1313 unlock_buffer(bh); 1314 1315 err = ext4_handle_dirty_metadata(handle, inode, bh); 1316 if (err) 1317 goto out; 1318 1319 /* Update top-level index: num,max,pointer */ 1320 neh = ext_inode_hdr(inode); --- 4748 unchanged lines hidden --- |