Lines Matching refs:fs
51 (const struct ext_filesystem *fs, uint32_t bg_idx) in ext4fs_get_group_descriptor() argument
53 return (struct ext2_block_group *)(fs->gdtable + (bg_idx * fs->gdsize)); in ext4fs_get_group_descriptor()
72 (struct ext2_block_group *bg, const struct ext_filesystem *fs) in ext4fs_bg_free_inodes_dec() argument
75 if (fs->gdsize == 64) in ext4fs_bg_free_inodes_dec()
80 if (fs->gdsize == 64) in ext4fs_bg_free_inodes_dec()
85 (struct ext2_block_group *bg, const struct ext_filesystem *fs) in ext4fs_bg_free_blocks_dec() argument
88 if (fs->gdsize == 64) in ext4fs_bg_free_blocks_dec()
93 if (fs->gdsize == 64) in ext4fs_bg_free_blocks_dec()
98 (struct ext2_block_group *bg, const struct ext_filesystem *fs) in ext4fs_bg_itable_unused_dec() argument
101 if (fs->gdsize == 64) in ext4fs_bg_itable_unused_dec()
106 if (fs->gdsize == 64) in ext4fs_bg_itable_unused_dec()
124 const struct ext_filesystem *fs) in ext4fs_bg_get_free_blocks() argument
127 if (fs->gdsize == 64) in ext4fs_bg_get_free_blocks()
134 const struct ext_filesystem *fs) in ext4fs_bg_get_free_inodes() argument
137 if (fs->gdsize == 64) in ext4fs_bg_get_free_inodes()
155 const struct ext_filesystem *fs) in ext4fs_bg_get_block_id() argument
158 if (fs->gdsize == 64) in ext4fs_bg_get_block_id()
165 const struct ext_filesystem *fs) in ext4fs_bg_get_inode_id() argument
168 if (fs->gdsize == 64) in ext4fs_bg_get_inode_id()
176 const struct ext_filesystem *fs) in ext4fs_bg_get_inode_table_id() argument
179 if (fs->gdsize == 64) in ext4fs_bg_get_inode_table_id()
200 struct ext_filesystem *fs = get_fs(); in put_ext4() local
203 if (!fs->dev_desc) in put_ext4()
206 ALLOC_CACHE_ALIGN_BUFFER(unsigned char, sec_buf, fs->dev_desc->blksz); in put_ext4()
208 log2blksz = fs->dev_desc->log2blksz; in put_ext4()
211 remainder = off & (uint64_t)(fs->dev_desc->blksz - 1); in put_ext4()
214 (part_offset + fs->total_sect)) { in put_ext4()
216 printf("total_sector is %llu\n", fs->total_sect); in put_ext4()
222 blk_dread(fs->dev_desc, startblock, 1, sec_buf); in put_ext4()
225 blk_dwrite(fs->dev_desc, startblock, 1, sec_buf); in put_ext4()
228 blk_dwrite(fs->dev_desc, startblock, size >> log2blksz, in put_ext4()
231 blk_dread(fs->dev_desc, startblock, 1, sec_buf); in put_ext4()
234 blk_dwrite(fs->dev_desc, startblock, 1, in put_ext4()
242 struct ext_filesystem *fs = get_fs(); in _get_new_inode_no() local
257 for (j = 0; j < fs->blksz; j++) { in _get_new_inode_no()
283 struct ext_filesystem *fs = get_fs(); in _get_new_blk_no() local
288 if (count == (fs->blksz * 8)) in _get_new_blk_no()
292 if (fs->blksz == 1024) in _get_new_blk_no()
423 struct ext_filesystem *fs = get_fs(); in ext4fs_checksum_update() local
427 desc = ext4fs_get_group_descriptor(fs, i); in ext4fs_checksum_update()
428 if (le32_to_cpu(fs->sb->feature_ro_compat) & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) { in ext4fs_checksum_update()
431 crc = crc16(~0, (__u8 *)fs->sb->unique_id, in ext4fs_checksum_update()
432 sizeof(fs->sb->unique_id)); in ext4fs_checksum_update()
437 if (offset < fs->gdsize) { in ext4fs_checksum_update()
439 fs->gdsize - offset); in ext4fs_checksum_update()
488 struct ext_filesystem *fs = get_fs(); in ext4fs_update_parent_dentry() local
497 zero_buffer = zalloc(fs->blksz); in ext4fs_update_parent_dentry()
502 root_first_block_buffer = zalloc(fs->blksz); in ext4fs_update_parent_dentry()
523 * fs->sect_perblk, in ext4fs_update_parent_dentry()
524 0, fs->blksz, root_first_block_buffer); in ext4fs_update_parent_dentry()
538 if (fs->blksz - totalbytes == le16_to_cpu(dir->direntlen)) { in ext4fs_update_parent_dentry()
567 put_ext4((uint64_t)new_blk_no * fs->blksz, zero_buffer, fs->blksz); in ext4fs_update_parent_dentry()
573 new_size += fs->blksz; in ext4fs_update_parent_dentry()
577 new_blockcnt += fs->blksz >> LOG2_SECTOR_SIZE; in ext4fs_update_parent_dentry()
612 dir->direntlen = cpu_to_le16(fs->blksz - totalbytes); in ext4fs_update_parent_dentry()
641 struct ext_filesystem *fs = get_fs(); in search_dir() local
648 block_buffer = zalloc(fs->blksz); in search_dir()
659 status = ext4fs_devread((lbaint_t)blknr * fs->sect_perblk, in search_dir()
660 0, fs->blksz, (char *)block_buffer); in search_dir()
686 } while (offset < fs->blksz); in search_dir()
875 struct ext_filesystem *fs = get_fs(); in unlink_filename() local
879 block_buffer = zalloc(fs->blksz); in unlink_filename()
884 status = ext4fs_devread((lbaint_t)blknr * fs->sect_perblk, 0, in unlink_filename()
885 fs->blksz, block_buffer); in unlink_filename()
912 } while (offset < fs->blksz); in unlink_filename()
970 struct ext_filesystem *fs = get_fs(); in ext4fs_get_new_blk_no() local
971 char *journal_buffer = zalloc(fs->blksz); in ext4fs_get_new_blk_no()
972 char *zero_buffer = zalloc(fs->blksz); in ext4fs_get_new_blk_no()
976 if (fs->first_pass_bbmap == 0) { in ext4fs_get_new_blk_no()
977 for (i = 0; i < fs->no_blkgrp; i++) { in ext4fs_get_new_blk_no()
979 bgd = ext4fs_get_group_descriptor(fs, i); in ext4fs_get_new_blk_no()
980 if (ext4fs_bg_get_free_blocks(bgd, fs)) { in ext4fs_get_new_blk_no()
983 ext4fs_bg_get_block_id(bgd, fs); in ext4fs_get_new_blk_no()
985 memcpy(fs->blk_bmaps[i], zero_buffer, in ext4fs_get_new_blk_no()
986 fs->blksz); in ext4fs_get_new_blk_no()
987 put_ext4(b_bitmap_blk * fs->blksz, in ext4fs_get_new_blk_no()
988 fs->blk_bmaps[i], fs->blksz); in ext4fs_get_new_blk_no()
992 fs->curr_blkno = in ext4fs_get_new_blk_no()
993 _get_new_blk_no(fs->blk_bmaps[i]); in ext4fs_get_new_blk_no()
994 if (fs->curr_blkno == -1) in ext4fs_get_new_blk_no()
997 fs->curr_blkno = fs->curr_blkno + in ext4fs_get_new_blk_no()
998 (i * fs->blksz * 8); in ext4fs_get_new_blk_no()
999 fs->first_pass_bbmap++; in ext4fs_get_new_blk_no()
1000 ext4fs_bg_free_blocks_dec(bgd, fs); in ext4fs_get_new_blk_no()
1001 ext4fs_sb_free_blocks_dec(fs->sb); in ext4fs_get_new_blk_no()
1003 fs->sect_perblk, in ext4fs_get_new_blk_no()
1004 0, fs->blksz, in ext4fs_get_new_blk_no()
1019 fs->curr_blkno++; in ext4fs_get_new_blk_no()
1022 bg_idx = fs->curr_blkno / blk_per_grp; in ext4fs_get_new_blk_no()
1023 if (fs->blksz == 1024) { in ext4fs_get_new_blk_no()
1024 remainder = fs->curr_blkno % blk_per_grp; in ext4fs_get_new_blk_no()
1033 if (bg_idx >= fs->no_blkgrp) in ext4fs_get_new_blk_no()
1037 bgd = ext4fs_get_group_descriptor(fs, bg_idx); in ext4fs_get_new_blk_no()
1038 if (ext4fs_bg_get_free_blocks(bgd, fs) == 0) { in ext4fs_get_new_blk_no()
1040 fs->curr_blkno = (bg_idx + 1) * blk_per_grp; in ext4fs_get_new_blk_no()
1041 if (fs->blksz == 1024) in ext4fs_get_new_blk_no()
1042 fs->curr_blkno += 1; in ext4fs_get_new_blk_no()
1047 uint64_t b_bitmap_blk = ext4fs_bg_get_block_id(bgd, fs); in ext4fs_get_new_blk_no()
1049 memcpy(fs->blk_bmaps[bg_idx], zero_buffer, fs->blksz); in ext4fs_get_new_blk_no()
1050 put_ext4(b_bitmap_blk * fs->blksz, in ext4fs_get_new_blk_no()
1051 zero_buffer, fs->blksz); in ext4fs_get_new_blk_no()
1056 if (ext4fs_set_block_bmap(fs->curr_blkno, fs->blk_bmaps[bg_idx], in ext4fs_get_new_blk_no()
1059 fs->curr_blkno, bg_idx); in ext4fs_get_new_blk_no()
1060 fs->curr_blkno++; in ext4fs_get_new_blk_no()
1066 status = ext4fs_devread(b_bitmap_blk * fs->sect_perblk, in ext4fs_get_new_blk_no()
1067 0, fs->blksz, journal_buffer); in ext4fs_get_new_blk_no()
1075 ext4fs_bg_free_blocks_dec(bgd, fs); in ext4fs_get_new_blk_no()
1076 ext4fs_sb_free_blocks_dec(fs->sb); in ext4fs_get_new_blk_no()
1083 return fs->curr_blkno; in ext4fs_get_new_blk_no()
1098 struct ext_filesystem *fs = get_fs(); in ext4fs_get_new_inode_no() local
1099 char *journal_buffer = zalloc(fs->blksz); in ext4fs_get_new_inode_no()
1100 char *zero_buffer = zalloc(fs->blksz); in ext4fs_get_new_inode_no()
1103 int has_gdt_chksum = le32_to_cpu(fs->sb->feature_ro_compat) & in ext4fs_get_new_inode_no()
1106 if (fs->first_pass_ibmap == 0) { in ext4fs_get_new_inode_no()
1107 for (i = 0; i < fs->no_blkgrp; i++) { in ext4fs_get_new_inode_no()
1110 bgd = ext4fs_get_group_descriptor(fs, i); in ext4fs_get_new_inode_no()
1111 free_inodes = ext4fs_bg_get_free_inodes(bgd, fs); in ext4fs_get_new_inode_no()
1115 ext4fs_bg_get_inode_id(bgd, fs); in ext4fs_get_new_inode_no()
1119 put_ext4(i_bitmap_blk * fs->blksz, in ext4fs_get_new_inode_no()
1120 zero_buffer, fs->blksz); in ext4fs_get_new_inode_no()
1123 memcpy(fs->inode_bmaps[i], in ext4fs_get_new_inode_no()
1124 zero_buffer, fs->blksz); in ext4fs_get_new_inode_no()
1126 fs->curr_inode_no = in ext4fs_get_new_inode_no()
1127 _get_new_inode_no(fs->inode_bmaps[i]); in ext4fs_get_new_inode_no()
1128 if (fs->curr_inode_no == -1) in ext4fs_get_new_inode_no()
1131 fs->curr_inode_no = fs->curr_inode_no + in ext4fs_get_new_inode_no()
1133 fs->first_pass_ibmap++; in ext4fs_get_new_inode_no()
1134 ext4fs_bg_free_inodes_dec(bgd, fs); in ext4fs_get_new_inode_no()
1136 ext4fs_bg_itable_unused_dec(bgd, fs); in ext4fs_get_new_inode_no()
1137 ext4fs_sb_free_inodes_dec(fs->sb); in ext4fs_get_new_inode_no()
1139 fs->sect_perblk, in ext4fs_get_new_inode_no()
1140 0, fs->blksz, in ext4fs_get_new_inode_no()
1154 fs->curr_inode_no++; in ext4fs_get_new_inode_no()
1156 ibmap_idx = fs->curr_inode_no / inodes_per_grp; in ext4fs_get_new_inode_no()
1158 ext4fs_get_group_descriptor(fs, ibmap_idx); in ext4fs_get_new_inode_no()
1160 uint64_t i_bitmap_blk = ext4fs_bg_get_inode_id(bgd, fs); in ext4fs_get_new_inode_no()
1163 put_ext4(i_bitmap_blk * fs->blksz, in ext4fs_get_new_inode_no()
1164 zero_buffer, fs->blksz); in ext4fs_get_new_inode_no()
1167 memcpy(fs->inode_bmaps[ibmap_idx], zero_buffer, in ext4fs_get_new_inode_no()
1168 fs->blksz); in ext4fs_get_new_inode_no()
1171 if (ext4fs_set_inode_bmap(fs->curr_inode_no, in ext4fs_get_new_inode_no()
1172 fs->inode_bmaps[ibmap_idx], in ext4fs_get_new_inode_no()
1175 fs->curr_inode_no, ibmap_idx); in ext4fs_get_new_inode_no()
1181 status = ext4fs_devread(i_bitmap_blk * fs->sect_perblk, in ext4fs_get_new_inode_no()
1182 0, fs->blksz, journal_buffer); in ext4fs_get_new_inode_no()
1190 ext4fs_bg_free_inodes_dec(bgd, fs); in ext4fs_get_new_inode_no()
1193 ext4fs_sb_free_inodes_dec(fs->sb); in ext4fs_get_new_inode_no()
1201 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()
2344 struct ext_filesystem *fs = get_fs(); in ext4fs_mount() local
2360 fs->inodesz = 128; in ext4fs_mount()
2361 fs->gdsize = 32; in ext4fs_mount()
2382 fs->inodesz = le16_to_cpu(data->sblock.inode_size); in ext4fs_mount()
2383 fs->gdsize = le32_to_cpu(data->sblock.feature_incompat) & in ext4fs_mount()
2390 fs->inodesz, fs->gdsize); in ext4fs_mount()