Lines Matching +full:partition +full:-
1 // SPDX-License-Identifier: GPL-2.0-only
3 * partition.c
6 * Partition handling routines for the OSTA-UDF(tm) filesystem.
9 * (C) 1998-2001 Ben Fennema
26 uint16_t partition, uint32_t offset) in udf_get_pblock() argument
30 if (partition >= sbi->s_partitions) { in udf_get_pblock()
31 udf_debug("block=%u, partition=%u, offset=%u: invalid partition\n", in udf_get_pblock()
32 block, partition, offset); in udf_get_pblock()
35 map = &sbi->s_partmaps[partition]; in udf_get_pblock()
36 if (map->s_partition_func) in udf_get_pblock()
37 return map->s_partition_func(sb, block, partition, offset); in udf_get_pblock()
39 return map->s_partition_root + block + offset; in udf_get_pblock()
43 uint16_t partition, uint32_t offset) in udf_get_pblock_virt15() argument
52 struct udf_inode_info *iinfo = UDF_I(sbi->s_vat_inode); in udf_get_pblock_virt15()
55 map = &sbi->s_partmaps[partition]; in udf_get_pblock_virt15()
56 vdata = &map->s_type_specific.s_virtual; in udf_get_pblock_virt15()
58 if (block > vdata->s_num_entries) { in udf_get_pblock_virt15()
60 block, vdata->s_num_entries); in udf_get_pblock_virt15()
64 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { in udf_get_pblock_virt15()
65 loc = le32_to_cpu(((__le32 *)(iinfo->i_data + in udf_get_pblock_virt15()
66 vdata->s_start_offset))[block]); in udf_get_pblock_virt15()
69 index = (sb->s_blocksize - vdata->s_start_offset) / sizeof(uint32_t); in udf_get_pblock_virt15()
71 block -= index; in udf_get_pblock_virt15()
72 newblock = 1 + (block / (sb->s_blocksize / sizeof(uint32_t))); in udf_get_pblock_virt15()
73 index = block % (sb->s_blocksize / sizeof(uint32_t)); in udf_get_pblock_virt15()
76 index = vdata->s_start_offset / sizeof(uint32_t) + block; in udf_get_pblock_virt15()
79 bh = udf_bread(sbi->s_vat_inode, newblock, 0, &err); in udf_get_pblock_virt15()
82 sb, block, partition); in udf_get_pblock_virt15()
86 loc = le32_to_cpu(((__le32 *)bh->b_data)[index]); in udf_get_pblock_virt15()
91 if (iinfo->i_location.partitionReferenceNum == partition) { in udf_get_pblock_virt15()
97 iinfo->i_location.partitionReferenceNum, in udf_get_pblock_virt15()
102 uint16_t partition, uint32_t offset) in udf_get_pblock_virt20() argument
104 return udf_get_pblock_virt15(sb, block, partition, offset); in udf_get_pblock_virt20()
108 uint16_t partition, uint32_t offset) in udf_get_pblock_spar15() argument
117 map = &sbi->s_partmaps[partition]; in udf_get_pblock_spar15()
118 sdata = &map->s_type_specific.s_sparing; in udf_get_pblock_spar15()
119 packet = (block + offset) & ~(sdata->s_packet_len - 1); in udf_get_pblock_spar15()
122 if (sdata->s_spar_map[i] != NULL) { in udf_get_pblock_spar15()
124 sdata->s_spar_map[i]->b_data; in udf_get_pblock_spar15()
130 for (i = 0; i < le16_to_cpu(st->reallocationTableLen); i++) { in udf_get_pblock_spar15()
131 struct sparingEntry *entry = &st->mapEntry[i]; in udf_get_pblock_spar15()
132 u32 origLoc = le32_to_cpu(entry->origLocation); in udf_get_pblock_spar15()
136 return le32_to_cpu(entry->mappedLocation) + in udf_get_pblock_spar15()
138 (sdata->s_packet_len - 1)); in udf_get_pblock_spar15()
144 return map->s_partition_root + block + offset; in udf_get_pblock_spar15()
159 mutex_lock(&sbi->s_alloc_mutex); in udf_relocate_blocks()
160 for (i = 0; i < sbi->s_partitions; i++) { in udf_relocate_blocks()
161 struct udf_part_map *map = &sbi->s_partmaps[i]; in udf_relocate_blocks()
162 if (old_block > map->s_partition_root && in udf_relocate_blocks()
163 old_block < map->s_partition_root + map->s_partition_len) { in udf_relocate_blocks()
164 sdata = &map->s_type_specific.s_sparing; in udf_relocate_blocks()
165 packet = (old_block - map->s_partition_root) & in udf_relocate_blocks()
166 ~(sdata->s_packet_len - 1); in udf_relocate_blocks()
169 if (sdata->s_spar_map[j] != NULL) { in udf_relocate_blocks()
171 sdata->s_spar_map[j]->b_data; in udf_relocate_blocks()
181 le16_to_cpu(st->reallocationTableLen); in udf_relocate_blocks()
183 struct sparingEntry *entry = &st->mapEntry[k]; in udf_relocate_blocks()
184 u32 origLoc = le32_to_cpu(entry->origLocation); in udf_relocate_blocks()
189 bh = sdata->s_spar_map[j]; in udf_relocate_blocks()
194 bh->b_data; in udf_relocate_blocks()
195 entry->origLocation = in udf_relocate_blocks()
205 entry->mappedLocation) + in udf_relocate_blocks()
206 ((old_block - in udf_relocate_blocks()
207 map->s_partition_root) & in udf_relocate_blocks()
208 (sdata->s_packet_len - 1)); in udf_relocate_blocks()
213 entry->mappedLocation) + in udf_relocate_blocks()
214 ((old_block - in udf_relocate_blocks()
215 map->s_partition_root) & in udf_relocate_blocks()
216 (sdata->s_packet_len - 1)); in udf_relocate_blocks()
224 struct sparingEntry *entry = &st->mapEntry[l]; in udf_relocate_blocks()
225 u32 origLoc = le32_to_cpu(entry->origLocation); in udf_relocate_blocks()
231 bh = sdata->s_spar_map[j]; in udf_relocate_blocks()
235 st = (struct sparingTable *)bh->b_data; in udf_relocate_blocks()
236 mapEntry = st->mapEntry[l]; in udf_relocate_blocks()
239 memmove(&st->mapEntry[k + 1], in udf_relocate_blocks()
240 &st->mapEntry[k], in udf_relocate_blocks()
241 (l - k) * in udf_relocate_blocks()
243 st->mapEntry[k] = mapEntry; in udf_relocate_blocks()
252 st->mapEntry[k].mappedLocation) + in udf_relocate_blocks()
253 ((old_block - map->s_partition_root) & in udf_relocate_blocks()
254 (sdata->s_packet_len - 1)); in udf_relocate_blocks()
264 if (i == sbi->s_partitions) { in udf_relocate_blocks()
271 mutex_unlock(&sbi->s_alloc_mutex); in udf_relocate_blocks()
276 uint16_t partition, uint32_t offset) in udf_try_read_meta() argument
278 struct super_block *sb = inode->i_sb; in udf_try_read_meta()
292 map = &UDF_SB(sb)->s_partmaps[partition]; in udf_try_read_meta()
293 /* map to sparable/physical partition desc */ in udf_try_read_meta()
295 map->s_type_specific.s_metadata.s_phys_partition_ref, in udf_try_read_meta()
304 uint16_t partition, uint32_t offset) in udf_get_pblock_meta25() argument
314 map = &sbi->s_partmaps[partition]; in udf_get_pblock_meta25()
315 mdata = &map->s_type_specific.s_metadata; in udf_get_pblock_meta25()
316 inode = mdata->s_metadata_fe ? : mdata->s_mirror_fe; in udf_get_pblock_meta25()
321 retblk = udf_try_read_meta(inode, block, partition, offset); in udf_get_pblock_meta25()
322 if (retblk == 0xFFFFFFFF && mdata->s_metadata_fe) { in udf_get_pblock_meta25()
324 if (!(mdata->s_flags & MF_MIRROR_FE_LOADED)) { in udf_get_pblock_meta25()
325 mdata->s_mirror_fe = udf_find_metadata_inode_efe(sb, in udf_get_pblock_meta25()
326 mdata->s_mirror_file_loc, in udf_get_pblock_meta25()
327 mdata->s_phys_partition_ref); in udf_get_pblock_meta25()
328 if (IS_ERR(mdata->s_mirror_fe)) in udf_get_pblock_meta25()
329 mdata->s_mirror_fe = NULL; in udf_get_pblock_meta25()
330 mdata->s_flags |= MF_MIRROR_FE_LOADED; in udf_get_pblock_meta25()
333 inode = mdata->s_mirror_fe; in udf_get_pblock_meta25()
336 retblk = udf_try_read_meta(inode, block, partition, offset); in udf_get_pblock_meta25()