Lines Matching refs:fs
52 (const struct ext_filesystem *fs, uint32_t bg_idx) in ext4fs_get_group_descriptor() argument
54 return (struct ext2_block_group *)(fs->gdtable + (bg_idx * fs->gdsize)); in ext4fs_get_group_descriptor()
73 (struct ext2_block_group *bg, const struct ext_filesystem *fs) in ext4fs_bg_free_inodes_dec() argument
76 if (fs->gdsize == 64) in ext4fs_bg_free_inodes_dec()
81 if (fs->gdsize == 64) in ext4fs_bg_free_inodes_dec()
86 (struct ext2_block_group *bg, const struct ext_filesystem *fs) in ext4fs_bg_free_blocks_dec() argument
89 if (fs->gdsize == 64) in ext4fs_bg_free_blocks_dec()
94 if (fs->gdsize == 64) in ext4fs_bg_free_blocks_dec()
99 (struct ext2_block_group *bg, const struct ext_filesystem *fs) in ext4fs_bg_itable_unused_dec() argument
102 if (fs->gdsize == 64) in ext4fs_bg_itable_unused_dec()
107 if (fs->gdsize == 64) in ext4fs_bg_itable_unused_dec()
125 const struct ext_filesystem *fs) in ext4fs_bg_get_free_blocks() argument
128 if (fs->gdsize == 64) in ext4fs_bg_get_free_blocks()
135 const struct ext_filesystem *fs) in ext4fs_bg_get_free_inodes() argument
138 if (fs->gdsize == 64) in ext4fs_bg_get_free_inodes()
156 const struct ext_filesystem *fs) in ext4fs_bg_get_block_id() argument
159 if (fs->gdsize == 64) in ext4fs_bg_get_block_id()
166 const struct ext_filesystem *fs) in ext4fs_bg_get_inode_id() argument
169 if (fs->gdsize == 64) in ext4fs_bg_get_inode_id()
177 const struct ext_filesystem *fs) in ext4fs_bg_get_inode_table_id() argument
180 if (fs->gdsize == 64) in ext4fs_bg_get_inode_table_id()
201 struct ext_filesystem *fs = get_fs(); in put_ext4() local
202 int log2blksz = fs->dev_desc->log2blksz; in put_ext4()
203 ALLOC_CACHE_ALIGN_BUFFER(unsigned char, sec_buf, fs->dev_desc->blksz); in put_ext4()
207 remainder = off & (uint64_t)(fs->dev_desc->blksz - 1); in put_ext4()
209 if (fs->dev_desc == NULL) in put_ext4()
213 (part_offset + fs->total_sect)) { in put_ext4()
215 printf("total_sector is %llu\n", fs->total_sect); in put_ext4()
221 blk_dread(fs->dev_desc, startblock, 1, sec_buf); in put_ext4()
224 blk_dwrite(fs->dev_desc, startblock, 1, sec_buf); in put_ext4()
227 blk_dwrite(fs->dev_desc, startblock, size >> log2blksz, in put_ext4()
230 blk_dread(fs->dev_desc, startblock, 1, sec_buf); in put_ext4()
233 blk_dwrite(fs->dev_desc, startblock, 1, in put_ext4()
241 struct ext_filesystem *fs = get_fs(); in _get_new_inode_no() local
256 for (j = 0; j < fs->blksz; j++) { in _get_new_inode_no()
282 struct ext_filesystem *fs = get_fs(); in _get_new_blk_no() local
287 if (count == (fs->blksz * 8)) in _get_new_blk_no()
291 if (fs->blksz == 1024) in _get_new_blk_no()
422 struct ext_filesystem *fs = get_fs(); in ext4fs_checksum_update() local
426 desc = ext4fs_get_group_descriptor(fs, i); in ext4fs_checksum_update()
427 if (le32_to_cpu(fs->sb->feature_ro_compat) & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) { in ext4fs_checksum_update()
430 crc = ext2fs_crc16(~0, fs->sb->unique_id, in ext4fs_checksum_update()
431 sizeof(fs->sb->unique_id)); in ext4fs_checksum_update()
436 if (offset < fs->gdsize) { in ext4fs_checksum_update()
438 fs->gdsize - offset); in ext4fs_checksum_update()
487 struct ext_filesystem *fs = get_fs(); in ext4fs_update_parent_dentry() local
496 zero_buffer = zalloc(fs->blksz); in ext4fs_update_parent_dentry()
501 root_first_block_buffer = zalloc(fs->blksz); in ext4fs_update_parent_dentry()
522 * fs->sect_perblk, in ext4fs_update_parent_dentry()
523 0, fs->blksz, root_first_block_buffer); in ext4fs_update_parent_dentry()
537 if (fs->blksz - totalbytes == le16_to_cpu(dir->direntlen)) { in ext4fs_update_parent_dentry()
566 put_ext4((uint64_t)new_blk_no * fs->blksz, zero_buffer, fs->blksz); in ext4fs_update_parent_dentry()
572 new_size += fs->blksz; in ext4fs_update_parent_dentry()
576 new_blockcnt += fs->blksz >> LOG2_SECTOR_SIZE; in ext4fs_update_parent_dentry()
611 dir->direntlen = cpu_to_le16(fs->blksz - totalbytes); in ext4fs_update_parent_dentry()
640 struct ext_filesystem *fs = get_fs(); in search_dir() local
647 block_buffer = zalloc(fs->blksz); in search_dir()
658 status = ext4fs_devread((lbaint_t)blknr * fs->sect_perblk, in search_dir()
659 0, fs->blksz, (char *)block_buffer); in search_dir()
685 } while (offset < fs->blksz); in search_dir()
874 struct ext_filesystem *fs = get_fs(); in unlink_filename() local
878 block_buffer = zalloc(fs->blksz); in unlink_filename()
883 status = ext4fs_devread((lbaint_t)blknr * fs->sect_perblk, 0, in unlink_filename()
884 fs->blksz, block_buffer); in unlink_filename()
911 } while (offset < fs->blksz); in unlink_filename()
969 struct ext_filesystem *fs = get_fs(); in ext4fs_get_new_blk_no() local
970 char *journal_buffer = zalloc(fs->blksz); in ext4fs_get_new_blk_no()
971 char *zero_buffer = zalloc(fs->blksz); in ext4fs_get_new_blk_no()
975 if (fs->first_pass_bbmap == 0) { in ext4fs_get_new_blk_no()
976 for (i = 0; i < fs->no_blkgrp; i++) { in ext4fs_get_new_blk_no()
978 bgd = ext4fs_get_group_descriptor(fs, i); in ext4fs_get_new_blk_no()
979 if (ext4fs_bg_get_free_blocks(bgd, fs)) { in ext4fs_get_new_blk_no()
982 ext4fs_bg_get_block_id(bgd, fs); in ext4fs_get_new_blk_no()
984 memcpy(fs->blk_bmaps[i], zero_buffer, in ext4fs_get_new_blk_no()
985 fs->blksz); in ext4fs_get_new_blk_no()
986 put_ext4(b_bitmap_blk * fs->blksz, in ext4fs_get_new_blk_no()
987 fs->blk_bmaps[i], fs->blksz); in ext4fs_get_new_blk_no()
991 fs->curr_blkno = in ext4fs_get_new_blk_no()
992 _get_new_blk_no(fs->blk_bmaps[i]); in ext4fs_get_new_blk_no()
993 if (fs->curr_blkno == -1) in ext4fs_get_new_blk_no()
996 fs->curr_blkno = fs->curr_blkno + in ext4fs_get_new_blk_no()
997 (i * fs->blksz * 8); in ext4fs_get_new_blk_no()
998 fs->first_pass_bbmap++; in ext4fs_get_new_blk_no()
999 ext4fs_bg_free_blocks_dec(bgd, fs); in ext4fs_get_new_blk_no()
1000 ext4fs_sb_free_blocks_dec(fs->sb); in ext4fs_get_new_blk_no()
1002 fs->sect_perblk, in ext4fs_get_new_blk_no()
1003 0, fs->blksz, in ext4fs_get_new_blk_no()
1018 fs->curr_blkno++; in ext4fs_get_new_blk_no()
1021 bg_idx = fs->curr_blkno / blk_per_grp; in ext4fs_get_new_blk_no()
1022 if (fs->blksz == 1024) { in ext4fs_get_new_blk_no()
1023 remainder = fs->curr_blkno % blk_per_grp; in ext4fs_get_new_blk_no()
1032 if (bg_idx >= fs->no_blkgrp) in ext4fs_get_new_blk_no()
1036 bgd = ext4fs_get_group_descriptor(fs, bg_idx); in ext4fs_get_new_blk_no()
1037 if (ext4fs_bg_get_free_blocks(bgd, fs) == 0) { in ext4fs_get_new_blk_no()
1039 fs->curr_blkno = (bg_idx + 1) * blk_per_grp; in ext4fs_get_new_blk_no()
1040 if (fs->blksz == 1024) in ext4fs_get_new_blk_no()
1041 fs->curr_blkno += 1; in ext4fs_get_new_blk_no()
1046 uint64_t b_bitmap_blk = ext4fs_bg_get_block_id(bgd, fs); in ext4fs_get_new_blk_no()
1048 memcpy(fs->blk_bmaps[bg_idx], zero_buffer, fs->blksz); in ext4fs_get_new_blk_no()
1049 put_ext4(b_bitmap_blk * fs->blksz, in ext4fs_get_new_blk_no()
1050 zero_buffer, fs->blksz); in ext4fs_get_new_blk_no()
1055 if (ext4fs_set_block_bmap(fs->curr_blkno, fs->blk_bmaps[bg_idx], in ext4fs_get_new_blk_no()
1058 fs->curr_blkno, bg_idx); in ext4fs_get_new_blk_no()
1059 fs->curr_blkno++; in ext4fs_get_new_blk_no()
1065 status = ext4fs_devread(b_bitmap_blk * fs->sect_perblk, in ext4fs_get_new_blk_no()
1066 0, fs->blksz, journal_buffer); in ext4fs_get_new_blk_no()
1074 ext4fs_bg_free_blocks_dec(bgd, fs); in ext4fs_get_new_blk_no()
1075 ext4fs_sb_free_blocks_dec(fs->sb); in ext4fs_get_new_blk_no()
1082 return fs->curr_blkno; in ext4fs_get_new_blk_no()
1097 struct ext_filesystem *fs = get_fs(); in ext4fs_get_new_inode_no() local
1098 char *journal_buffer = zalloc(fs->blksz); in ext4fs_get_new_inode_no()
1099 char *zero_buffer = zalloc(fs->blksz); in ext4fs_get_new_inode_no()
1102 int has_gdt_chksum = le32_to_cpu(fs->sb->feature_ro_compat) & in ext4fs_get_new_inode_no()
1105 if (fs->first_pass_ibmap == 0) { in ext4fs_get_new_inode_no()
1106 for (i = 0; i < fs->no_blkgrp; i++) { in ext4fs_get_new_inode_no()
1109 bgd = ext4fs_get_group_descriptor(fs, i); in ext4fs_get_new_inode_no()
1110 free_inodes = ext4fs_bg_get_free_inodes(bgd, fs); in ext4fs_get_new_inode_no()
1114 ext4fs_bg_get_inode_id(bgd, fs); in ext4fs_get_new_inode_no()
1118 put_ext4(i_bitmap_blk * fs->blksz, in ext4fs_get_new_inode_no()
1119 zero_buffer, fs->blksz); in ext4fs_get_new_inode_no()
1122 memcpy(fs->inode_bmaps[i], in ext4fs_get_new_inode_no()
1123 zero_buffer, fs->blksz); in ext4fs_get_new_inode_no()
1125 fs->curr_inode_no = in ext4fs_get_new_inode_no()
1126 _get_new_inode_no(fs->inode_bmaps[i]); in ext4fs_get_new_inode_no()
1127 if (fs->curr_inode_no == -1) in ext4fs_get_new_inode_no()
1130 fs->curr_inode_no = fs->curr_inode_no + in ext4fs_get_new_inode_no()
1132 fs->first_pass_ibmap++; in ext4fs_get_new_inode_no()
1133 ext4fs_bg_free_inodes_dec(bgd, fs); in ext4fs_get_new_inode_no()
1135 ext4fs_bg_itable_unused_dec(bgd, fs); in ext4fs_get_new_inode_no()
1136 ext4fs_sb_free_inodes_dec(fs->sb); in ext4fs_get_new_inode_no()
1138 fs->sect_perblk, in ext4fs_get_new_inode_no()
1139 0, fs->blksz, in ext4fs_get_new_inode_no()
1153 fs->curr_inode_no++; in ext4fs_get_new_inode_no()
1155 ibmap_idx = fs->curr_inode_no / inodes_per_grp; in ext4fs_get_new_inode_no()
1157 ext4fs_get_group_descriptor(fs, ibmap_idx); in ext4fs_get_new_inode_no()
1159 uint64_t i_bitmap_blk = ext4fs_bg_get_inode_id(bgd, fs); in ext4fs_get_new_inode_no()
1162 put_ext4(i_bitmap_blk * fs->blksz, in ext4fs_get_new_inode_no()
1163 zero_buffer, fs->blksz); in ext4fs_get_new_inode_no()
1166 memcpy(fs->inode_bmaps[ibmap_idx], zero_buffer, in ext4fs_get_new_inode_no()
1167 fs->blksz); in ext4fs_get_new_inode_no()
1170 if (ext4fs_set_inode_bmap(fs->curr_inode_no, in ext4fs_get_new_inode_no()
1171 fs->inode_bmaps[ibmap_idx], in ext4fs_get_new_inode_no()
1174 fs->curr_inode_no, ibmap_idx); in ext4fs_get_new_inode_no()
1180 status = ext4fs_devread(i_bitmap_blk * fs->sect_perblk, in ext4fs_get_new_inode_no()
1181 0, fs->blksz, journal_buffer); in ext4fs_get_new_inode_no()
1189 ext4fs_bg_free_inodes_dec(bgd, fs); in ext4fs_get_new_inode_no()
1192 ext4fs_sb_free_inodes_dec(fs->sb); in ext4fs_get_new_inode_no()
1200 return fs->curr_inode_no; in ext4fs_get_new_inode_no()
1221 struct ext_filesystem *fs = get_fs(); in alloc_single_indirect_block() local
1224 si_buffer = zalloc(fs->blksz); in alloc_single_indirect_block()
1238 status = ext4fs_devread((lbaint_t)si_blockno * fs->sect_perblk, in alloc_single_indirect_block()
1239 0, fs->blksz, (char *)si_buffer); in alloc_single_indirect_block()
1240 memset(si_buffer, '\0', fs->blksz); in alloc_single_indirect_block()
1244 for (i = 0; i < (fs->blksz / sizeof(int)); i++) { in alloc_single_indirect_block()
1261 put_ext4(((uint64_t) ((uint64_t)si_blockno * (uint64_t)fs->blksz)), in alloc_single_indirect_block()
1262 si_start_addr, fs->blksz); in alloc_single_indirect_block()
1284 struct ext_filesystem *fs = get_fs(); in alloc_double_indirect_block() local
1293 di_parent_buffer = zalloc(fs->blksz); in alloc_double_indirect_block()
1303 fs->sect_perblk, 0, in alloc_double_indirect_block()
1304 fs->blksz, (char *)di_parent_buffer); in alloc_double_indirect_block()
1310 memset(di_parent_buffer, '\0', fs->blksz); in alloc_double_indirect_block()
1316 for (i = 0; i < (fs->blksz / sizeof(int)); i++) { in alloc_double_indirect_block()
1322 di_child_buff = zalloc(fs->blksz); in alloc_double_indirect_block()
1334 fs->sect_perblk, 0, in alloc_double_indirect_block()
1335 fs->blksz, in alloc_double_indirect_block()
1342 memset(di_child_buff, '\0', fs->blksz); in alloc_double_indirect_block()
1344 for (j = 0; j < (fs->blksz / sizeof(int)); j++) { in alloc_double_indirect_block()
1360 put_ext4(((uint64_t) ((uint64_t)di_blockno_child * (uint64_t)fs->blksz)), in alloc_double_indirect_block()
1361 di_child_buff_start, fs->blksz); in alloc_double_indirect_block()
1368 put_ext4(((uint64_t) ((uint64_t)di_blockno_parent * (uint64_t)fs->blksz)), in alloc_double_indirect_block()
1369 di_block_start_addr, fs->blksz); in alloc_double_indirect_block()
1394 struct ext_filesystem *fs = get_fs(); in alloc_triple_indirect_block() local
1402 ti_gp_buff = zalloc(fs->blksz); in alloc_triple_indirect_block()
1412 for (i = 0; i < (fs->blksz / sizeof(int)); i++) { in alloc_triple_indirect_block()
1418 ti_parent_buff = zalloc(fs->blksz); in alloc_triple_indirect_block()
1430 for (j = 0; j < (fs->blksz / sizeof(int)); j++) { in alloc_triple_indirect_block()
1436 ti_child_buff = zalloc(fs->blksz); in alloc_triple_indirect_block()
1448 for (k = 0; k < (fs->blksz / sizeof(int)); in alloc_triple_indirect_block()
1468 (uint64_t)fs->blksz)), in alloc_triple_indirect_block()
1469 ti_cbuff_start_addr, fs->blksz); in alloc_triple_indirect_block()
1476 put_ext4(((uint64_t) ((uint64_t)ti_parent_blockno * (uint64_t)fs->blksz)), in alloc_triple_indirect_block()
1477 ti_pbuff_start_addr, fs->blksz); in alloc_triple_indirect_block()
1484 put_ext4(((uint64_t) ((uint64_t)ti_gp_blockno * (uint64_t)fs->blksz)), in alloc_triple_indirect_block()
1485 ti_gp_buff_start_addr, fs->blksz); in alloc_triple_indirect_block()
1599 struct ext_filesystem *fs = get_fs(); in ext4fs_read_inode() local
1612 if ( le32_to_cpu(sblock->inodes_per_group) == 0 || fs->inodesz == 0) { in ext4fs_read_inode()
1623 inodes_per_block = EXT2_BLOCK_SIZE(data) / fs->inodesz; in ext4fs_read_inode()
1628 blkno = ext4fs_bg_get_inode_table_id(blkgrp, fs) + in ext4fs_read_inode()
1630 blkoff = (ino % inodes_per_block) * fs->inodesz; in ext4fs_read_inode()
2370 struct ext_filesystem *fs = get_fs(); in ext4fs_mount() local
2387 fs->inodesz = 128; in ext4fs_mount()
2388 fs->gdsize = 32; in ext4fs_mount()
2395 fs->inodesz = le16_to_cpu(data->sblock.inode_size); in ext4fs_mount()
2396 fs->gdsize = le32_to_cpu(data->sblock.feature_incompat) & in ext4fs_mount()
2403 fs->inodesz, fs->gdsize); in ext4fs_mount()