• Home
  • Raw
  • Download

Lines Matching refs:exfat

33 	struct exfat *exfat = iter->exfat;  in write_block()  local
38 device_offset = exfat_c2o(exfat, desc->p_clus) + desc->offset; in write_block()
42 if (exfat_write(exfat->blk_dev->dev_fd, in write_block()
57 struct exfat *exfat = iter->exfat; in read_ahead_first_blocks() local
61 clus_count = iter->parent->size / exfat->clus_size; in read_ahead_first_blocks()
66 size = exfat->clus_size; in read_ahead_first_blocks()
72 return posix_fadvise(exfat->blk_dev->dev_fd, in read_ahead_first_blocks()
73 exfat_c2o(exfat, iter->parent->first_clus), size, in read_ahead_first_blocks()
88 struct exfat *exfat = iter->exfat; in read_ahead_next_blocks() local
94 clus_count = iter->parent->size / exfat->clus_size; in read_ahead_next_blocks()
99 ret = exfat_get_inode_next_clus(exfat, iter->parent, in read_ahead_next_blocks()
107 device_offset = exfat_c2o(exfat, ra_p_clus); in read_ahead_next_blocks()
109 exfat->clus_size : iter->ra_partial_size; in read_ahead_next_blocks()
110 ret = posix_fadvise(exfat->blk_dev->dev_fd, in read_ahead_next_blocks()
119 exfat->clus_size) { in read_ahead_next_blocks()
120 device_offset = exfat_c2o(exfat, p_clus) + in read_ahead_next_blocks()
122 ret = posix_fadvise(exfat->blk_dev->dev_fd, in read_ahead_next_blocks()
139 struct exfat *exfat = iter->exfat; in read_ahead_next_dir_blocks() local
144 if (list_empty(&exfat->dir_list)) in read_ahead_next_dir_blocks()
147 current = exfat->dir_list.next; in read_ahead_next_dir_blocks()
149 current->next != &exfat->dir_list) { in read_ahead_next_dir_blocks()
152 offset = exfat_c2o(exfat, next_inode->first_clus); in read_ahead_next_dir_blocks()
153 return posix_fadvise(exfat->blk_dev->dev_fd, offset, in read_ahead_next_dir_blocks()
166 struct exfat *exfat = iter->exfat; in read_block() local
187 exfat->clus_size) { in read_block()
191 ret = exfat_get_inode_next_clus(exfat, iter->parent, in read_block()
201 device_offset = exfat_c2o(exfat, desc->p_clus) + desc->offset; in read_block()
202 ret = exfat_read(exfat->blk_dev->dev_fd, desc->buffer, in read_block()
213 (block * iter->read_size) / exfat->clus_size, in read_block()
214 (block * iter->read_size) % exfat->clus_size, in read_block()
221 int exfat_de_iter_init(struct exfat_de_iter *iter, struct exfat *exfat, in exfat_de_iter_init() argument
224 iter->exfat = exfat; in exfat_de_iter_init()
226 iter->write_size = exfat->sect_size; in exfat_de_iter_init()
227 iter->read_size = exfat->clus_size <= 4*KB ? exfat->clus_size : 4*KB; in exfat_de_iter_init()
228 if (exfat->clus_size <= 32 * KB) in exfat_de_iter_init()
229 iter->ra_partial_size = MAX(4 * KB, exfat->clus_size / 2); in exfat_de_iter_init()
231 iter->ra_partial_size = exfat->clus_size / 4; in exfat_de_iter_init()
336 return exfat_c2o(iter->exfat, bd->p_clus) + bd->offset + in exfat_de_iter_device_offset()
351 int exfat_lookup_dentry_set(struct exfat *exfat, struct exfat_inode *parent, in exfat_lookup_dentry_set() argument
362 bd = exfat_alloc_buffer(2, exfat->clus_size, exfat->sect_size); in exfat_lookup_dentry_set()
366 retval = exfat_de_iter_init(&de_iter, exfat, parent, bd); in exfat_lookup_dentry_set()
487 int exfat_lookup_file(struct exfat *exfat, struct exfat_inode *parent, in exfat_lookup_file() argument
501 retval = exfat_lookup_dentry_set(exfat, parent, filter_out); in exfat_lookup_file()
539 uint16_t exfat_calc_name_hash(struct exfat *exfat, in exfat_calc_name_hash() argument
547 ch = exfat->upcase_table[le16_to_cpu(name[i])]; in exfat_calc_name_hash()
573 int exfat_build_file_dentry_set(struct exfat *exfat, const char *name, in exfat_build_file_dentry_set() argument
620 cpu_to_le16(exfat_calc_name_hash(exfat, utf16_name, name_len)); in exfat_build_file_dentry_set()
637 int exfat_update_file_dentry_set(struct exfat *exfat, in exfat_update_file_dentry_set() argument
660 exfat_calc_name_hash(exfat, utf16_name, name_len); in exfat_update_file_dentry_set()
670 dset[1].dentry.stream.valid_size = cpu_to_le64(ccount * exfat->clus_size); in exfat_update_file_dentry_set()
671 dset[1].dentry.stream.size = cpu_to_le64(ccount * exfat->clus_size); in exfat_update_file_dentry_set()
680 static int find_free_cluster(struct exfat *exfat, in find_free_cluster() argument
683 clus_t end = le32_to_cpu(exfat->bs->bsx.clu_count) + in find_free_cluster()
686 if (!exfat_heap_clus(exfat, start)) in find_free_cluster()
690 if (exfat_bitmap_find_zero(exfat, exfat->alloc_bitmap, in find_free_cluster()
693 if (!exfat_bitmap_get(exfat->disk_bitmap, *new_clu)) in find_free_cluster()
701 if (exfat_bitmap_find_zero(exfat, exfat->alloc_bitmap, in find_free_cluster()
704 if (!exfat_bitmap_get(exfat->disk_bitmap, *new_clu)) in find_free_cluster()
714 static int exfat_map_cluster(struct exfat *exfat, struct exfat_inode *inode, in exfat_map_cluster() argument
719 if (!exfat_heap_clus(exfat, inode->first_clus)) in exfat_map_cluster()
726 last_count = DIV_ROUND_UP(inode->size, exfat->clus_size); in exfat_map_cluster()
728 last_count = file_off / exfat->clus_size + 1; in exfat_map_cluster()
731 if (count * exfat->clus_size > inode->size) in exfat_map_cluster()
739 if (exfat_get_inode_next_clus(exfat, inode, clu, &next)) in exfat_map_cluster()
742 if (!exfat_heap_clus(exfat, clu)) in exfat_map_cluster()
751 static int exfat_write_dentry_set(struct exfat *exfat, in exfat_write_dentry_set() argument
759 if (exfat_o2c(exfat, dev_off, &clus, &clus_off)) in exfat_write_dentry_set()
763 first_half_len = MIN(dent_len, exfat->clus_size - clus_off); in exfat_write_dentry_set()
770 if (exfat_get_next_clus(exfat, clus, &next_clus)) in exfat_write_dentry_set()
772 if (!exfat_heap_clus(exfat, next_clus)) in exfat_write_dentry_set()
774 sec_half_off = exfat_c2o(exfat, next_clus); in exfat_write_dentry_set()
777 if (exfat_write(exfat->blk_dev->dev_fd, dset, first_half_len, in exfat_write_dentry_set()
783 if (exfat_write(exfat->blk_dev->dev_fd, dset, sec_half_len, in exfat_write_dentry_set()
797 static int exfat_alloc_cluster(struct exfat *exfat, struct exfat_inode *inode, in exfat_alloc_cluster() argument
802 bool need_dset = inode != exfat->root; in exfat_alloc_cluster()
807 err = find_free_cluster(exfat, exfat->start_clu, new_clu); in exfat_alloc_cluster()
809 exfat->start_clu = EXFAT_FIRST_CLUSTER; in exfat_alloc_cluster()
813 exfat->start_clu = *new_clu; in exfat_alloc_cluster()
815 if (exfat_set_fat(exfat, *new_clu, EXFAT_EOF_CLUSTER)) in exfat_alloc_cluster()
819 if (exfat_write(exfat->blk_dev->dev_fd, exfat->zero_cluster, in exfat_alloc_cluster()
820 exfat->clus_size, exfat_c2o(exfat, *new_clu)) != in exfat_alloc_cluster()
821 (ssize_t)exfat->clus_size) { in exfat_alloc_cluster()
827 err = exfat_map_cluster(exfat, inode, EOF, &last_clu); in exfat_alloc_cluster()
833 if (exfat_set_fat(exfat, last_clu, *new_clu)) in exfat_alloc_cluster()
837 err = exfat_update_file_dentry_set(exfat, in exfat_alloc_cluster()
842 exfat->clus_size) + 1); in exfat_alloc_cluster()
848 err = exfat_update_file_dentry_set(exfat, in exfat_alloc_cluster()
857 if (need_dset && exfat_write_dentry_set(exfat, inode->dentry_set, in exfat_alloc_cluster()
862 exfat_bitmap_set(exfat->alloc_bitmap, *new_clu); in exfat_alloc_cluster()
865 inode->size += exfat->clus_size; in exfat_alloc_cluster()
869 int exfat_add_dentry_set(struct exfat *exfat, struct exfat_dentry_loc *loc, in exfat_add_dentry_set() argument
878 (unsigned int)dcount * DENTRY_SIZE > exfat->clus_size) in exfat_add_dentry_set()
885 if (exfat_alloc_cluster(exfat, parent, &new_clus)) in exfat_add_dentry_set()
887 if ((uint64_t)loc->file_offset == parent->size - exfat->clus_size) in exfat_add_dentry_set()
888 dev_off = exfat_c2o(exfat, new_clus); in exfat_add_dentry_set()
891 if (exfat_write_dentry_set(exfat, dset, dcount, dev_off, &next_dev_off)) in exfat_add_dentry_set()
901 int exfat_create_file(struct exfat *exfat, struct exfat_inode *parent, in exfat_create_file() argument
909 err = exfat_lookup_file(exfat, parent, name, &filter); in exfat_create_file()
918 err = exfat_build_file_dentry_set(exfat, name, attr, in exfat_create_file()
926 err = exfat_add_dentry_set(exfat, &loc, dset, dcount, false); in exfat_create_file()