• Home
  • Raw
  • Download

Lines Matching refs:df

25 static int incfs_scan_metadata_chain(struct data_file *df);
220 struct data_file *df) in handle_mapped_file() argument
229 file_id_str = file_id_to_str(df->df_id); in handle_mapped_file()
265 result->df_mapped_offset = df->df_metadata_off; in handle_mapped_file()
274 struct data_file *df = NULL; in incfs_open_data_file() local
291 df = kzalloc(sizeof(*df), GFP_NOFS); in incfs_open_data_file()
292 if (!df) { in incfs_open_data_file()
297 mutex_init(&df->df_enable_verity); in incfs_open_data_file()
299 df->df_backing_file_context = bfc; in incfs_open_data_file()
300 df->df_mount_info = mi; in incfs_open_data_file()
301 for (i = 0; i < ARRAY_SIZE(df->df_segments); i++) in incfs_open_data_file()
302 data_file_segment_init(&df->df_segments[i]); in incfs_open_data_file()
304 error = incfs_read_file_header(bfc, &df->df_metadata_off, &df->df_id, in incfs_open_data_file()
305 &size, &df->df_header_flags); in incfs_open_data_file()
310 df->df_size = size; in incfs_open_data_file()
312 df->df_data_block_count = get_blocks_count_for_size(size); in incfs_open_data_file()
314 if (df->df_header_flags & INCFS_FILE_MAPPED) { in incfs_open_data_file()
315 struct data_file *mapped_df = handle_mapped_file(mi, df); in incfs_open_data_file()
317 incfs_free_data_file(df); in incfs_open_data_file()
321 md_records = incfs_scan_metadata_chain(df); in incfs_open_data_file()
328 if (df) in incfs_open_data_file()
329 df->df_backing_file_context = NULL; in incfs_open_data_file()
330 incfs_free_data_file(df); in incfs_open_data_file()
333 return df; in incfs_open_data_file()
336 void incfs_free_data_file(struct data_file *df) in incfs_free_data_file() argument
340 if (!df) in incfs_free_data_file()
343 data_blocks_written = atomic_read(&df->df_data_blocks_written); in incfs_free_data_file()
344 hash_blocks_written = atomic_read(&df->df_hash_blocks_written); in incfs_free_data_file()
346 if (data_blocks_written != df->df_initial_data_blocks_written || in incfs_free_data_file()
347 hash_blocks_written != df->df_initial_hash_blocks_written) { in incfs_free_data_file()
348 struct backing_file_context *bfc = df->df_backing_file_context; in incfs_free_data_file()
353 df->df_backing_file_context, in incfs_free_data_file()
354 df->df_status_offset, in incfs_free_data_file()
365 incfs_free_mtree(df->df_hash_tree); in incfs_free_data_file()
366 incfs_free_bfc(df->df_backing_file_context); in incfs_free_data_file()
367 kfree(df->df_signature); in incfs_free_data_file()
368 kfree(df->df_verity_file_digest.data); in incfs_free_data_file()
369 kfree(df->df_verity_signature); in incfs_free_data_file()
370 mutex_destroy(&df->df_enable_verity); in incfs_free_data_file()
371 kfree(df); in incfs_free_data_file()
379 struct data_file *df = NULL; in make_inode_ready_for_data_ops() local
385 df = incfs_open_data_file(mi, backing_file); in make_inode_ready_for_data_ops()
387 if (IS_ERR(df)) in make_inode_ready_for_data_ops()
388 err = PTR_ERR(df); in make_inode_ready_for_data_ops()
390 node->n_file = df; in make_inode_ready_for_data_ops()
670 struct data_file *df = get_incfs_data_file(f); in validate_hash_tree() local
688 tree = smp_load_acquire(&df->df_hash_tree); in validate_hash_tree()
689 sig = df->df_signature; in validate_hash_tree()
708 file_pages = DIV_ROUND_UP(df->df_size, INCFS_DATA_FILE_BLOCK_SIZE); in validate_hash_tree()
786 static struct data_file_segment *get_file_segment(struct data_file *df, in get_file_segment() argument
789 int seg_idx = block_index % ARRAY_SIZE(df->df_segments); in get_file_segment()
791 return &df->df_segments[seg_idx]; in get_file_segment()
814 static int get_data_file_block(struct data_file *df, int index, in get_data_file_block() argument
822 if (!df || !res_block) in get_data_file_block()
825 blockmap_off = df->df_blockmap_off; in get_data_file_block()
826 bfc = df->df_backing_file_context; in get_data_file_block()
862 int incfs_get_filled_blocks(struct data_file *df, in incfs_get_filled_blocks() argument
872 arg->end_index ? arg->end_index : df->df_total_block_count; in incfs_get_filled_blocks()
881 if (end_index > df->df_total_block_count) in incfs_get_filled_blocks()
882 end_index = df->df_total_block_count; in incfs_get_filled_blocks()
883 arg->total_blocks_out = df->df_total_block_count; in incfs_get_filled_blocks()
884 arg->data_blocks_out = df->df_data_block_count; in incfs_get_filled_blocks()
886 if (atomic_read(&df->df_data_blocks_written) == in incfs_get_filled_blocks()
887 df->df_data_block_count) { in incfs_get_filled_blocks()
922 df->df_backing_file_context, bme, in incfs_get_filled_blocks()
924 df->df_blockmap_off); in incfs_get_filled_blocks()
941 if (arg->index_out >= df->df_data_block_count) in incfs_get_filled_blocks()
988 if (fd->fd_get_block_pos == df->df_total_block_count + 1) { in incfs_get_filled_blocks()
990 atomic_read(&df->df_data_blocks_written)) in incfs_get_filled_blocks()
991 atomic_set(&df->df_data_blocks_written, in incfs_get_filled_blocks()
995 atomic_read(&df->df_hash_blocks_written)) in incfs_get_filled_blocks()
996 atomic_set(&df->df_hash_blocks_written, in incfs_get_filled_blocks()
1018 static struct pending_read *add_pending_read(struct data_file *df, in add_pending_read() argument
1025 segment = get_file_segment(df, block_index); in add_pending_read()
1026 mi = df->df_mount_info; in add_pending_read()
1032 result->file_id = df->df_id; in add_pending_read()
1061 static void remove_pending_read(struct data_file *df, struct pending_read *read) in remove_pending_read() argument
1065 if (!df || !read) { in remove_pending_read()
1066 WARN_ON(!df); in remove_pending_read()
1071 mi = df->df_mount_info; in remove_pending_read()
1106 static int wait_for_data_block(struct data_file *df, int block_index, in wait_for_data_block() argument
1120 if (!df || !res_block) in wait_for_data_block()
1123 if (block_index < 0 || block_index >= df->df_data_block_count) in wait_for_data_block()
1126 if (df->df_blockmap_off <= 0 || !df->df_mount_info) in wait_for_data_block()
1129 mi = df->df_mount_info; in wait_for_data_block()
1130 segment = get_file_segment(df, block_index); in wait_for_data_block()
1137 error = get_data_file_block(df, block_index, &block); in wait_for_data_block()
1155 read = add_pending_read(df, block_index); in wait_for_data_block()
1159 log_block_read(mi, &df->df_id, block_index); in wait_for_data_block()
1177 remove_pending_read(df, read); in wait_for_data_block()
1181 log_block_read(mi, &df->df_id, block_index); in wait_for_data_block()
1207 error = get_data_file_block(df, block_index, &block); in wait_for_data_block()
1241 struct mount_info *mi, struct data_file *df) in incfs_update_sysfs_error() argument
1252 mi->mi_le_file_id = df->df_id; in incfs_update_sysfs_error()
1273 struct data_file *df = get_incfs_data_file(f); in incfs_read_data_file_block() local
1275 if (!dst.data || !df || !tmp.data) in incfs_read_data_file_block()
1281 mi = df->df_mount_info; in incfs_read_data_file_block()
1282 bfc = df->df_backing_file_context; in incfs_read_data_file_block()
1284 result = wait_for_data_block(df, index, &block, timeouts, in incfs_read_data_file_block()
1325 log_block_read(mi, &df->df_id, index); in incfs_read_data_file_block()
1335 incfs_update_sysfs_error(f, index, result, mi, df); in incfs_read_data_file_block()
1341 struct data_file *df, size_t offset) in incfs_read_merkle_tree_blocks() argument
1347 if (!dst.data || !df) in incfs_read_merkle_tree_blocks()
1350 sig = df->df_signature; in incfs_read_merkle_tree_blocks()
1351 bfc = df->df_backing_file_context; in incfs_read_merkle_tree_blocks()
1362 int incfs_process_new_data_block(struct data_file *df, in incfs_process_new_data_block() argument
1373 if (!df || !block) in incfs_process_new_data_block()
1376 bfc = df->df_backing_file_context; in incfs_process_new_data_block()
1377 mi = df->df_mount_info; in incfs_process_new_data_block()
1379 if (block->block_index >= df->df_data_block_count) in incfs_process_new_data_block()
1382 segment = get_file_segment(df, block->block_index); in incfs_process_new_data_block()
1397 error = get_data_file_block(df, block->block_index, &existing_block); in incfs_process_new_data_block()
1412 error = get_data_file_block(df, block->block_index, &existing_block); in incfs_process_new_data_block()
1425 df->df_blockmap_off, flags); in incfs_process_new_data_block()
1429 if (atomic_inc_return(&df->df_data_blocks_written) in incfs_process_new_data_block()
1430 >= df->df_data_block_count) in incfs_process_new_data_block()
1446 int incfs_read_file_signature(struct data_file *df, struct mem_range dst) in incfs_read_file_signature() argument
1448 struct backing_file_context *bfc = df->df_backing_file_context; in incfs_read_file_signature()
1455 sig = df->df_signature; in incfs_read_file_signature()
1473 int incfs_process_new_hash_block(struct data_file *df, in incfs_process_new_hash_block() argument
1484 if (!df || !block) in incfs_process_new_hash_block()
1490 bfc = df->df_backing_file_context; in incfs_process_new_hash_block()
1491 mi = df->df_mount_info; in incfs_process_new_hash_block()
1493 if (!df) in incfs_process_new_hash_block()
1496 hash_tree = df->df_hash_tree; in incfs_process_new_hash_block()
1497 sig = df->df_signature; in incfs_process_new_hash_block()
1513 hash_area_base, df->df_blockmap_off, df->df_size); in incfs_process_new_hash_block()
1517 atomic_inc(&df->df_hash_blocks_written); in incfs_process_new_hash_block()
1525 struct data_file *df = handler->context; in process_blockmap_md() local
1530 if (!df) in process_blockmap_md()
1533 if (df->df_data_block_count > block_count) in process_blockmap_md()
1536 df->df_total_block_count = block_count; in process_blockmap_md()
1537 df->df_blockmap_off = base_off; in process_blockmap_md()
1544 struct data_file *df = handler->context; in process_file_signature_md() local
1555 if (!df || !df->df_backing_file_context || in process_file_signature_md()
1556 !df->df_backing_file_context->bc_file) { in process_file_signature_md()
1572 read = incfs_kread(df->df_backing_file_context, buf, in process_file_signature_md()
1585 df->df_data_block_count); in process_file_signature_md()
1604 df->df_hash_tree = hash_tree; in process_file_signature_md()
1606 df->df_signature = signature; in process_file_signature_md()
1619 struct data_file *df = handler->context; in process_status_md() local
1621 df->df_initial_data_blocks_written = in process_status_md()
1623 atomic_set(&df->df_data_blocks_written, in process_status_md()
1624 df->df_initial_data_blocks_written); in process_status_md()
1626 df->df_initial_hash_blocks_written = in process_status_md()
1628 atomic_set(&df->df_hash_blocks_written, in process_status_md()
1629 df->df_initial_hash_blocks_written); in process_status_md()
1631 df->df_status_offset = handler->md_record_offset; in process_status_md()
1639 struct data_file *df = handler->context; in process_file_verity_signature_md() local
1642 if (!df) in process_file_verity_signature_md()
1656 df->df_verity_signature = verity_signature; in process_file_verity_signature_md()
1660 static int incfs_scan_metadata_chain(struct data_file *df) in incfs_scan_metadata_chain() argument
1669 if (!df || !df->df_backing_file_context) in incfs_scan_metadata_chain()
1672 bfc = df->df_backing_file_context; in incfs_scan_metadata_chain()
1678 handler->md_record_offset = df->df_metadata_off; in incfs_scan_metadata_chain()
1679 handler->context = df; in incfs_scan_metadata_chain()
1702 nondata_block_count = df->df_total_block_count - in incfs_scan_metadata_chain()
1703 df->df_data_block_count; in incfs_scan_metadata_chain()
1704 if (df->df_hash_tree) { in incfs_scan_metadata_chain()
1706 df->df_hash_tree->hash_tree_area_size); in incfs_scan_metadata_chain()