Lines Matching full:fs
14 * based on code from grub2 fs/ext2.c and fs/fshelp.c by
49 (const struct ext_filesystem *fs, uint32_t bg_idx) in ext4fs_get_group_descriptor() argument
51 return (struct ext2_block_group *)(fs->gdtable + (bg_idx * fs->gdsize)); in ext4fs_get_group_descriptor()
70 (struct ext2_block_group *bg, const struct ext_filesystem *fs) in ext4fs_bg_free_inodes_dec() argument
73 if (fs->gdsize == 64) in ext4fs_bg_free_inodes_dec()
78 if (fs->gdsize == 64) in ext4fs_bg_free_inodes_dec()
83 (struct ext2_block_group *bg, const struct ext_filesystem *fs) in ext4fs_bg_free_blocks_dec() argument
86 if (fs->gdsize == 64) in ext4fs_bg_free_blocks_dec()
91 if (fs->gdsize == 64) in ext4fs_bg_free_blocks_dec()
96 (struct ext2_block_group *bg, const struct ext_filesystem *fs) in ext4fs_bg_itable_unused_dec() argument
99 if (fs->gdsize == 64) in ext4fs_bg_itable_unused_dec()
104 if (fs->gdsize == 64) in ext4fs_bg_itable_unused_dec()
122 const struct ext_filesystem *fs) in ext4fs_bg_get_free_blocks() argument
125 if (fs->gdsize == 64) in ext4fs_bg_get_free_blocks()
132 const struct ext_filesystem *fs) in ext4fs_bg_get_free_inodes() argument
135 if (fs->gdsize == 64) in ext4fs_bg_get_free_inodes()
153 const struct ext_filesystem *fs) in ext4fs_bg_get_block_id() argument
156 if (fs->gdsize == 64) in ext4fs_bg_get_block_id()
163 const struct ext_filesystem *fs) in ext4fs_bg_get_inode_id() argument
166 if (fs->gdsize == 64) in ext4fs_bg_get_inode_id()
174 const struct ext_filesystem *fs) in ext4fs_bg_get_inode_table_id() argument
177 if (fs->gdsize == 64) in ext4fs_bg_get_inode_table_id()
198 struct ext_filesystem *fs = get_fs(); in put_ext4() local
199 int log2blksz = fs->dev_desc->log2blksz; in put_ext4()
200 ALLOC_CACHE_ALIGN_BUFFER(unsigned char, sec_buf, fs->dev_desc->blksz); in put_ext4()
204 remainder = off & (uint64_t)(fs->dev_desc->blksz - 1); in put_ext4()
206 if (fs->dev_desc == NULL) in put_ext4()
210 (part_offset + fs->total_sect)) { in put_ext4()
212 printf("total_sector is %llu\n", fs->total_sect); in put_ext4()
218 blk_dread(fs->dev_desc, startblock, 1, sec_buf); in put_ext4()
221 blk_dwrite(fs->dev_desc, startblock, 1, sec_buf); in put_ext4()
224 blk_dwrite(fs->dev_desc, startblock, size >> log2blksz, in put_ext4()
227 blk_dread(fs->dev_desc, startblock, 1, sec_buf); in put_ext4()
230 blk_dwrite(fs->dev_desc, startblock, 1, in put_ext4()
238 struct ext_filesystem *fs = get_fs(); in _get_new_inode_no() local
253 for (j = 0; j < fs->blksz; j++) { in _get_new_inode_no()
279 struct ext_filesystem *fs = get_fs(); in _get_new_blk_no() local
284 if (count == (fs->blksz * 8)) in _get_new_blk_no()
288 if (fs->blksz == 1024) in _get_new_blk_no()
419 struct ext_filesystem *fs = get_fs(); in ext4fs_checksum_update() local
423 desc = ext4fs_get_group_descriptor(fs, i); in ext4fs_checksum_update()
424 if (le32_to_cpu(fs->sb->feature_ro_compat) & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) { in ext4fs_checksum_update()
427 crc = ext2fs_crc16(~0, fs->sb->unique_id, in ext4fs_checksum_update()
428 sizeof(fs->sb->unique_id)); in ext4fs_checksum_update()
433 if (offset < fs->gdsize) { in ext4fs_checksum_update()
435 fs->gdsize - offset); in ext4fs_checksum_update()
484 struct ext_filesystem *fs = get_fs(); in ext4fs_update_parent_dentry() local
493 zero_buffer = zalloc(fs->blksz); in ext4fs_update_parent_dentry()
498 root_first_block_buffer = zalloc(fs->blksz); in ext4fs_update_parent_dentry()
518 * fs->sect_perblk, in ext4fs_update_parent_dentry()
519 0, fs->blksz, root_first_block_buffer); in ext4fs_update_parent_dentry()
533 if (fs->blksz - totalbytes == le16_to_cpu(dir->direntlen)) { in ext4fs_update_parent_dentry()
562 put_ext4((uint64_t)new_blk_no * fs->blksz, zero_buffer, fs->blksz); in ext4fs_update_parent_dentry()
568 new_size += fs->blksz; in ext4fs_update_parent_dentry()
572 new_blockcnt += fs->sect_perblk; in ext4fs_update_parent_dentry()
607 dir->direntlen = cpu_to_le16(fs->blksz - totalbytes); in ext4fs_update_parent_dentry()
636 struct ext_filesystem *fs = get_fs(); in search_dir() local
643 block_buffer = zalloc(fs->blksz); in search_dir()
654 status = ext4fs_devread((lbaint_t)blknr * fs->sect_perblk, in search_dir()
655 0, fs->blksz, (char *)block_buffer); in search_dir()
681 } while (offset < fs->blksz); in search_dir()
870 struct ext_filesystem *fs = get_fs(); in unlink_filename() local
874 block_buffer = zalloc(fs->blksz); in unlink_filename()
879 status = ext4fs_devread((lbaint_t)blknr * fs->sect_perblk, 0, in unlink_filename()
880 fs->blksz, block_buffer); in unlink_filename()
907 } while (offset < fs->blksz); in unlink_filename()
965 struct ext_filesystem *fs = get_fs(); in ext4fs_get_new_blk_no() local
966 char *journal_buffer = zalloc(fs->blksz); in ext4fs_get_new_blk_no()
967 char *zero_buffer = zalloc(fs->blksz); in ext4fs_get_new_blk_no()
971 if (fs->first_pass_bbmap == 0) { in ext4fs_get_new_blk_no()
972 for (i = 0; i < fs->no_blkgrp; i++) { in ext4fs_get_new_blk_no()
974 bgd = ext4fs_get_group_descriptor(fs, i); in ext4fs_get_new_blk_no()
975 if (ext4fs_bg_get_free_blocks(bgd, fs)) { in ext4fs_get_new_blk_no()
978 ext4fs_bg_get_block_id(bgd, fs); in ext4fs_get_new_blk_no()
980 memcpy(fs->blk_bmaps[i], zero_buffer, in ext4fs_get_new_blk_no()
981 fs->blksz); in ext4fs_get_new_blk_no()
982 put_ext4(b_bitmap_blk * fs->blksz, in ext4fs_get_new_blk_no()
983 fs->blk_bmaps[i], fs->blksz); in ext4fs_get_new_blk_no()
987 fs->curr_blkno = in ext4fs_get_new_blk_no()
988 _get_new_blk_no(fs->blk_bmaps[i]); in ext4fs_get_new_blk_no()
989 if (fs->curr_blkno == -1) in ext4fs_get_new_blk_no()
992 fs->curr_blkno = fs->curr_blkno + in ext4fs_get_new_blk_no()
993 (i * fs->blksz * 8); in ext4fs_get_new_blk_no()
994 fs->first_pass_bbmap++; in ext4fs_get_new_blk_no()
995 ext4fs_bg_free_blocks_dec(bgd, fs); in ext4fs_get_new_blk_no()
996 ext4fs_sb_free_blocks_dec(fs->sb); in ext4fs_get_new_blk_no()
998 fs->sect_perblk, in ext4fs_get_new_blk_no()
999 0, fs->blksz, in ext4fs_get_new_blk_no()
1014 fs->curr_blkno++; in ext4fs_get_new_blk_no()
1017 bg_idx = fs->curr_blkno / blk_per_grp; in ext4fs_get_new_blk_no()
1018 if (fs->blksz == 1024) { in ext4fs_get_new_blk_no()
1019 remainder = fs->curr_blkno % blk_per_grp; in ext4fs_get_new_blk_no()
1028 if (bg_idx >= fs->no_blkgrp) in ext4fs_get_new_blk_no()
1032 bgd = ext4fs_get_group_descriptor(fs, bg_idx); in ext4fs_get_new_blk_no()
1033 if (ext4fs_bg_get_free_blocks(bgd, fs) == 0) { in ext4fs_get_new_blk_no()
1035 fs->curr_blkno = (bg_idx + 1) * blk_per_grp; in ext4fs_get_new_blk_no()
1036 if (fs->blksz == 1024) in ext4fs_get_new_blk_no()
1037 fs->curr_blkno += 1; in ext4fs_get_new_blk_no()
1042 uint64_t b_bitmap_blk = ext4fs_bg_get_block_id(bgd, fs); in ext4fs_get_new_blk_no()
1044 memcpy(fs->blk_bmaps[bg_idx], zero_buffer, fs->blksz); in ext4fs_get_new_blk_no()
1045 put_ext4(b_bitmap_blk * fs->blksz, in ext4fs_get_new_blk_no()
1046 zero_buffer, fs->blksz); in ext4fs_get_new_blk_no()
1051 if (ext4fs_set_block_bmap(fs->curr_blkno, fs->blk_bmaps[bg_idx], in ext4fs_get_new_blk_no()
1054 fs->curr_blkno, bg_idx); in ext4fs_get_new_blk_no()
1055 fs->curr_blkno++; in ext4fs_get_new_blk_no()
1061 status = ext4fs_devread(b_bitmap_blk * fs->sect_perblk, in ext4fs_get_new_blk_no()
1062 0, fs->blksz, journal_buffer); in ext4fs_get_new_blk_no()
1070 ext4fs_bg_free_blocks_dec(bgd, fs); in ext4fs_get_new_blk_no()
1071 ext4fs_sb_free_blocks_dec(fs->sb); in ext4fs_get_new_blk_no()
1078 return fs->curr_blkno; in ext4fs_get_new_blk_no()
1093 struct ext_filesystem *fs = get_fs(); in ext4fs_get_new_inode_no() local
1094 char *journal_buffer = zalloc(fs->blksz); in ext4fs_get_new_inode_no()
1095 char *zero_buffer = zalloc(fs->blksz); in ext4fs_get_new_inode_no()
1098 int has_gdt_chksum = le32_to_cpu(fs->sb->feature_ro_compat) & in ext4fs_get_new_inode_no()
1101 if (fs->first_pass_ibmap == 0) { in ext4fs_get_new_inode_no()
1102 for (i = 0; i < fs->no_blkgrp; i++) { in ext4fs_get_new_inode_no()
1105 bgd = ext4fs_get_group_descriptor(fs, i); in ext4fs_get_new_inode_no()
1106 free_inodes = ext4fs_bg_get_free_inodes(bgd, fs); in ext4fs_get_new_inode_no()
1110 ext4fs_bg_get_inode_id(bgd, fs); in ext4fs_get_new_inode_no()
1114 put_ext4(i_bitmap_blk * fs->blksz, in ext4fs_get_new_inode_no()
1115 zero_buffer, fs->blksz); in ext4fs_get_new_inode_no()
1118 memcpy(fs->inode_bmaps[i], in ext4fs_get_new_inode_no()
1119 zero_buffer, fs->blksz); in ext4fs_get_new_inode_no()
1121 fs->curr_inode_no = in ext4fs_get_new_inode_no()
1122 _get_new_inode_no(fs->inode_bmaps[i]); in ext4fs_get_new_inode_no()
1123 if (fs->curr_inode_no == -1) in ext4fs_get_new_inode_no()
1126 fs->curr_inode_no = fs->curr_inode_no + in ext4fs_get_new_inode_no()
1128 fs->first_pass_ibmap++; in ext4fs_get_new_inode_no()
1129 ext4fs_bg_free_inodes_dec(bgd, fs); in ext4fs_get_new_inode_no()
1131 ext4fs_bg_itable_unused_dec(bgd, fs); in ext4fs_get_new_inode_no()
1132 ext4fs_sb_free_inodes_dec(fs->sb); in ext4fs_get_new_inode_no()
1134 fs->sect_perblk, in ext4fs_get_new_inode_no()
1135 0, fs->blksz, in ext4fs_get_new_inode_no()
1149 fs->curr_inode_no++; in ext4fs_get_new_inode_no()
1151 ibmap_idx = fs->curr_inode_no / inodes_per_grp; in ext4fs_get_new_inode_no()
1153 ext4fs_get_group_descriptor(fs, ibmap_idx); in ext4fs_get_new_inode_no()
1155 uint64_t i_bitmap_blk = ext4fs_bg_get_inode_id(bgd, fs); in ext4fs_get_new_inode_no()
1158 put_ext4(i_bitmap_blk * fs->blksz, in ext4fs_get_new_inode_no()
1159 zero_buffer, fs->blksz); in ext4fs_get_new_inode_no()
1162 memcpy(fs->inode_bmaps[ibmap_idx], zero_buffer, in ext4fs_get_new_inode_no()
1163 fs->blksz); in ext4fs_get_new_inode_no()
1166 if (ext4fs_set_inode_bmap(fs->curr_inode_no, in ext4fs_get_new_inode_no()
1167 fs->inode_bmaps[ibmap_idx], in ext4fs_get_new_inode_no()
1170 fs->curr_inode_no, ibmap_idx); in ext4fs_get_new_inode_no()
1176 status = ext4fs_devread(i_bitmap_blk * fs->sect_perblk, in ext4fs_get_new_inode_no()
1177 0, fs->blksz, journal_buffer); in ext4fs_get_new_inode_no()
1185 ext4fs_bg_free_inodes_dec(bgd, fs); in ext4fs_get_new_inode_no()
1188 ext4fs_sb_free_inodes_dec(fs->sb); in ext4fs_get_new_inode_no()
1196 return fs->curr_inode_no; in ext4fs_get_new_inode_no()
1217 struct ext_filesystem *fs = get_fs(); in alloc_single_indirect_block() local
1220 si_buffer = zalloc(fs->blksz); in alloc_single_indirect_block()
1234 status = ext4fs_devread((lbaint_t)si_blockno * fs->sect_perblk, in alloc_single_indirect_block()
1235 0, fs->blksz, (char *)si_buffer); in alloc_single_indirect_block()
1236 memset(si_buffer, '\0', fs->blksz); in alloc_single_indirect_block()
1240 for (i = 0; i < (fs->blksz / sizeof(int)); i++) { in alloc_single_indirect_block()
1257 put_ext4(((uint64_t) ((uint64_t)si_blockno * (uint64_t)fs->blksz)), in alloc_single_indirect_block()
1258 si_start_addr, fs->blksz); in alloc_single_indirect_block()
1280 struct ext_filesystem *fs = get_fs(); in alloc_double_indirect_block() local
1289 di_parent_buffer = zalloc(fs->blksz); in alloc_double_indirect_block()
1299 fs->sect_perblk, 0, in alloc_double_indirect_block()
1300 fs->blksz, (char *)di_parent_buffer); in alloc_double_indirect_block()
1306 memset(di_parent_buffer, '\0', fs->blksz); in alloc_double_indirect_block()
1312 for (i = 0; i < (fs->blksz / sizeof(int)); i++) { in alloc_double_indirect_block()
1318 di_child_buff = zalloc(fs->blksz); in alloc_double_indirect_block()
1330 fs->sect_perblk, 0, in alloc_double_indirect_block()
1331 fs->blksz, in alloc_double_indirect_block()
1338 memset(di_child_buff, '\0', fs->blksz); in alloc_double_indirect_block()
1340 for (j = 0; j < (fs->blksz / sizeof(int)); j++) { in alloc_double_indirect_block()
1356 put_ext4(((uint64_t) ((uint64_t)di_blockno_child * (uint64_t)fs->blksz)), in alloc_double_indirect_block()
1357 di_child_buff_start, fs->blksz); in alloc_double_indirect_block()
1364 put_ext4(((uint64_t) ((uint64_t)di_blockno_parent * (uint64_t)fs->blksz)), in alloc_double_indirect_block()
1365 di_block_start_addr, fs->blksz); in alloc_double_indirect_block()
1390 struct ext_filesystem *fs = get_fs(); in alloc_triple_indirect_block() local
1398 ti_gp_buff = zalloc(fs->blksz); in alloc_triple_indirect_block()
1408 for (i = 0; i < (fs->blksz / sizeof(int)); i++) { in alloc_triple_indirect_block()
1414 ti_parent_buff = zalloc(fs->blksz); in alloc_triple_indirect_block()
1426 for (j = 0; j < (fs->blksz / sizeof(int)); j++) { in alloc_triple_indirect_block()
1432 ti_child_buff = zalloc(fs->blksz); in alloc_triple_indirect_block()
1444 for (k = 0; k < (fs->blksz / sizeof(int)); in alloc_triple_indirect_block()
1464 (uint64_t)fs->blksz)), in alloc_triple_indirect_block()
1465 ti_cbuff_start_addr, fs->blksz); in alloc_triple_indirect_block()
1472 put_ext4(((uint64_t) ((uint64_t)ti_parent_blockno * (uint64_t)fs->blksz)), in alloc_triple_indirect_block()
1473 ti_pbuff_start_addr, fs->blksz); in alloc_triple_indirect_block()
1480 put_ext4(((uint64_t) ((uint64_t)ti_gp_blockno * (uint64_t)fs->blksz)), in alloc_triple_indirect_block()
1481 ti_gp_buff_start_addr, fs->blksz); in alloc_triple_indirect_block()
1589 struct ext_filesystem *fs = get_fs(); in ext4fs_read_inode() local
1602 inodes_per_block = EXT2_BLOCK_SIZE(data) / fs->inodesz; in ext4fs_read_inode()
1603 blkno = ext4fs_bg_get_inode_table_id(&blkgrp, fs) + in ext4fs_read_inode()
1605 blkoff = (ino % inodes_per_block) * fs->inodesz; in ext4fs_read_inode()
2331 struct ext_filesystem *fs = get_fs(); in ext4fs_mount() local
2348 fs->inodesz = 128; in ext4fs_mount()
2349 fs->gdsize = 32; in ext4fs_mount()
2356 fs->inodesz = le16_to_cpu(data->sblock.inode_size); in ext4fs_mount()
2357 fs->gdsize = le32_to_cpu(data->sblock.feature_incompat) & in ext4fs_mount()
2364 fs->inodesz, fs->gdsize); in ext4fs_mount()