2 * pass1b.c --- Pass #1b of e2fsck
4 * This file contains pass1B, pass1C, and pass1D of e2fsck. They are
5 * only invoked if pass 1 discovered blocks which are in use by more
8 * Pass1B scans the data blocks of all the inodes again, generating a
9 * complete list of duplicate blocks and which inodes have claimed
12 * Pass1C does a tree-traversal of the filesystem, to determine the
13 * parent directories of these inodes. This step is necessary so that
14 * e2fsck can print out the pathnames of affected inodes.
16 * Pass1D is a reconciliation pass. For each inode with duplicate
17 * blocks, the user is prompted if s/he would like to clone the file
18 * (so that the file gets a fresh copy of the duplicated blocks) or
19 * simply to delete the file.
21 * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o.
24 * This file may be redistributed under the terms of the GNU Public
35 #ifdef HAVE_INTTYPES_H
40 typedef long intptr_t;
43 /* Needed for architectures where sizeof(int) != sizeof(void *) */
44 #define INT_TO_VOIDPTR(val) ((void *)(intptr_t)(val))
45 #define VOIDPTR_TO_INT(ptr) ((int)(intptr_t)(ptr))
47 #include <et/com_err.h>
53 /* Define an extension to the ext2 library's block count information */
54 #define BLOCK_COUNT_EXTATTR (-5)
58 struct block_el *next;
63 struct inode_el *next;
68 struct inode_el *inode_list;
72 * This structure stores information about a particular inode which
73 * is sharing blocks with other inodes. This information is collected
74 * to display to the user, so that the user knows what files he or she
75 * is dealing with, when trying to decide how to resolve the conflict
76 * of multiply-claimed blocks.
81 struct ext2_inode inode;
82 struct block_el *block_list;
85 static int process_pass1b_block(ext2_filsys fs, blk64_t *blocknr,
86 e2_blkcnt_t blockcnt, blk64_t ref_blk,
87 int ref_offset, void *priv_data);
88 static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
89 struct dup_inode *dp, char *block_buf);
90 static int clone_file(e2fsck_t ctx, ext2_ino_t ino,
91 struct dup_inode *dp, char* block_buf);
92 static int check_if_fs_block(e2fsck_t ctx, blk64_t test_blk);
94 static void pass1b(e2fsck_t ctx, char *block_buf);
95 static void pass1c(e2fsck_t ctx, char *block_buf);
96 static void pass1d(e2fsck_t ctx, char *block_buf);
98 static int dup_inode_count = 0;
99 static int dup_inode_founddir = 0;
101 static dict_t blk_dict, ino_dict;
103 static ext2fs_inode_bitmap inode_dup_map;
105 static int dict_int_cmp(const void *a, const void *b)
116 * Add a duplicate block record
118 static void add_dupe(e2fsck_t ctx, ext2_ino_t ino, blk64_t blk,
119 struct ext2_inode *inode)
122 struct dup_block *db;
123 struct dup_inode *di;
124 struct block_el *blk_el;
125 struct inode_el *ino_el;
127 n = dict_lookup(&blk_dict, INT_TO_VOIDPTR(blk));
129 db = (struct dup_block *) dnode_get(n);
131 db = (struct dup_block *) e2fsck_allocate_memory(ctx,
132 sizeof(struct dup_block), "duplicate block header");
135 dict_alloc_insert(&blk_dict, INT_TO_VOIDPTR(blk), db);
137 ino_el = (struct inode_el *) e2fsck_allocate_memory(ctx,
138 sizeof(struct inode_el), "inode element");
140 ino_el->next = db->inode_list;
141 db->inode_list = ino_el;
144 n = dict_lookup(&ino_dict, INT_TO_VOIDPTR(ino));
146 di = (struct dup_inode *) dnode_get(n);
148 di = (struct dup_inode *) e2fsck_allocate_memory(ctx,
149 sizeof(struct dup_inode), "duplicate inode header");
150 if (ino == EXT2_ROOT_INO) {
151 di->dir = EXT2_ROOT_INO;
152 dup_inode_founddir++;
156 di->num_dupblocks = 0;
159 dict_alloc_insert(&ino_dict, INT_TO_VOIDPTR(ino), di);
161 blk_el = (struct block_el *) e2fsck_allocate_memory(ctx,
162 sizeof(struct block_el), "block element");
164 blk_el->next = di->block_list;
165 di->block_list = blk_el;
170 * Free a duplicate inode record
172 static void inode_dnode_free(dnode_t *node,
173 void *context EXT2FS_ATTR((unused)))
175 struct dup_inode *di;
176 struct block_el *p, *next;
178 di = (struct dup_inode *) dnode_get(node);
179 for (p = di->block_list; p; p = next) {
188 * Free a duplicate block record
190 static void block_dnode_free(dnode_t *node,
191 void *context EXT2FS_ATTR((unused)))
193 struct dup_block *db;
194 struct inode_el *p, *next;
196 db = (struct dup_block *) dnode_get(node);
197 for (p = db->inode_list; p; p = next) {
207 * Main procedure for handling duplicate blocks
209 void e2fsck_pass1_dupblocks(e2fsck_t ctx, char *block_buf)
211 ext2_filsys fs = ctx->fs;
212 struct problem_context pctx;
213 #ifdef RESOURCE_TRACK
214 struct resource_track rtrack;
217 clear_problem_context(&pctx);
219 pctx.errcode = ext2fs_allocate_inode_bitmap(fs,
220 _("multiply claimed inode map"), &inode_dup_map);
222 fix_problem(ctx, PR_1B_ALLOCATE_IBITMAP_ERROR, &pctx);
223 ctx->flags |= E2F_FLAG_ABORT;
227 dict_init(&ino_dict, DICTCOUNT_T_MAX, dict_int_cmp);
228 dict_init(&blk_dict, DICTCOUNT_T_MAX, dict_int_cmp);
229 dict_set_allocator(&ino_dict, NULL, inode_dnode_free, NULL);
230 dict_set_allocator(&blk_dict, NULL, block_dnode_free, NULL);
232 init_resource_track(&rtrack, ctx->fs->io);
233 pass1b(ctx, block_buf);
234 print_resource_track(ctx, "Pass 1b", &rtrack, ctx->fs->io);
236 init_resource_track(&rtrack, ctx->fs->io);
237 pass1c(ctx, block_buf);
238 print_resource_track(ctx, "Pass 1c", &rtrack, ctx->fs->io);
240 init_resource_track(&rtrack, ctx->fs->io);
241 pass1d(ctx, block_buf);
242 print_resource_track(ctx, "Pass 1d", &rtrack, ctx->fs->io);
245 * Time to free all of the accumulated data structures that we
246 * don't need anymore.
248 dict_free_nodes(&ino_dict);
249 dict_free_nodes(&blk_dict);
250 ext2fs_free_inode_bitmap(inode_dup_map);
254 * Scan the inodes looking for inodes that contain duplicate blocks.
256 struct process_block_struct {
260 struct ext2_inode *inode;
261 struct problem_context *pctx;
264 static void pass1b(e2fsck_t ctx, char *block_buf)
266 ext2_filsys fs = ctx->fs;
268 struct ext2_inode inode;
269 ext2_inode_scan scan;
270 struct process_block_struct pb;
271 struct problem_context pctx;
273 clear_problem_context(&pctx);
275 if (!(ctx->options & E2F_OPT_PREEN))
276 fix_problem(ctx, PR_1B_PASS_HEADER, &pctx);
277 pctx.errcode = ext2fs_open_inode_scan(fs, ctx->inode_buffer_blocks,
280 fix_problem(ctx, PR_1B_ISCAN_ERROR, &pctx);
281 ctx->flags |= E2F_FLAG_ABORT;
284 ctx->stashed_inode = &inode;
289 pctx.errcode = ext2fs_get_next_inode(scan, &ino, &inode);
290 if (pctx.errcode == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE)
293 fix_problem(ctx, PR_1B_ISCAN_ERROR, &pctx);
294 ctx->flags |= E2F_FLAG_ABORT;
299 pctx.ino = ctx->stashed_ino = ino;
300 if ((ino != EXT2_BAD_INO) &&
301 !ext2fs_test_inode_bitmap2(ctx->inode_used_map, ino))
308 if (ext2fs_inode_has_valid_blocks(&inode) ||
309 (ino == EXT2_BAD_INO))
310 pctx.errcode = ext2fs_block_iterate3(fs, ino,
311 BLOCK_FLAG_READ_ONLY, block_buf,
312 process_pass1b_block, &pb);
313 /* If the feature is not set, attrs will be cleared later anyway */
314 if ((fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR) &&
315 ext2fs_file_acl_block(&inode)) {
316 blk64_t blk = ext2fs_file_acl_block(&inode);
317 process_pass1b_block(fs, &blk,
318 BLOCK_COUNT_EXTATTR, 0, 0, &pb);
319 ext2fs_file_acl_block_set(&inode, blk);
322 end_problem_latch(ctx, PR_LATCH_DBLOCK);
323 if (ino >= EXT2_FIRST_INODE(fs->super) ||
324 ino == EXT2_ROOT_INO)
328 fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
330 ext2fs_close_inode_scan(scan);
331 e2fsck_use_inode_shortcuts(ctx, 0);
334 static int process_pass1b_block(ext2_filsys fs EXT2FS_ATTR((unused)),
336 e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
337 blk64_t ref_blk EXT2FS_ATTR((unused)),
338 int ref_offset EXT2FS_ATTR((unused)),
341 struct process_block_struct *p;
344 if (HOLE_BLKADDR(*block_nr))
346 p = (struct process_block_struct *) priv_data;
349 if (!ext2fs_test_block_bitmap2(ctx->block_dup_map, *block_nr))
352 /* OK, this is a duplicate block */
353 if (p->ino != EXT2_BAD_INO) {
354 p->pctx->blk = *block_nr;
355 fix_problem(ctx, PR_1B_DUP_BLOCK, p->pctx);
358 ext2fs_mark_inode_bitmap2(inode_dup_map, p->ino);
360 add_dupe(ctx, p->ino, *block_nr, p->inode);
366 * Pass 1c: Scan directories for inodes with duplicate blocks. This
367 * is used so that we can print pathnames when prompting the user for
370 struct search_dir_struct {
372 ext2_ino_t first_inode;
373 ext2_ino_t max_inode;
376 static int search_dirent_proc(ext2_ino_t dir, int entry,
377 struct ext2_dir_entry *dirent,
378 int offset EXT2FS_ATTR((unused)),
379 int blocksize EXT2FS_ATTR((unused)),
380 char *buf EXT2FS_ATTR((unused)),
383 struct search_dir_struct *sd;
387 sd = (struct search_dir_struct *) priv_data;
389 if (dirent->inode > sd->max_inode)
390 /* Should abort this inode, but not everything */
393 if ((dirent->inode < sd->first_inode) || (entry < DIRENT_OTHER_FILE) ||
394 !ext2fs_test_inode_bitmap2(inode_dup_map, dirent->inode))
397 n = dict_lookup(&ino_dict, INT_TO_VOIDPTR(dirent->inode));
400 p = (struct dup_inode *) dnode_get(n);
406 return(sd->count ? 0 : DIRENT_ABORT);
410 static void pass1c(e2fsck_t ctx, char *block_buf)
412 ext2_filsys fs = ctx->fs;
413 struct search_dir_struct sd;
414 struct problem_context pctx;
416 clear_problem_context(&pctx);
418 if (!(ctx->options & E2F_OPT_PREEN))
419 fix_problem(ctx, PR_1C_PASS_HEADER, &pctx);
422 * Search through all directories to translate inodes to names
423 * (by searching for the containing directory for that inode.)
425 sd.count = dup_inode_count - dup_inode_founddir;
426 sd.first_inode = EXT2_FIRST_INODE(fs->super);
427 sd.max_inode = fs->super->s_inodes_count;
428 ext2fs_dblist_dir_iterate(fs->dblist, 0, block_buf,
429 search_dirent_proc, &sd);
432 static void pass1d(e2fsck_t ctx, char *block_buf)
434 ext2_filsys fs = ctx->fs;
435 struct dup_inode *p, *t;
437 ext2_ino_t *shared, ino;
442 struct problem_context pctx;
447 clear_problem_context(&pctx);
449 if (!(ctx->options & E2F_OPT_PREEN))
450 fix_problem(ctx, PR_1D_PASS_HEADER, &pctx);
451 e2fsck_read_bitmaps(ctx);
453 pctx.num = dup_inode_count; /* dict_count(&ino_dict); */
454 fix_problem(ctx, PR_1D_NUM_DUP_INODES, &pctx);
455 shared = (ext2_ino_t *) e2fsck_allocate_memory(ctx,
456 sizeof(ext2_ino_t) * dict_count(&ino_dict),
457 "Shared inode list");
458 for (n = dict_first(&ino_dict); n; n = dict_next(&ino_dict, n)) {
459 p = (struct dup_inode *) dnode_get(n);
462 ino = (ext2_ino_t)VOIDPTR_TO_INT(dnode_getkey(n));
463 if (ino == EXT2_BAD_INO || ino == EXT2_RESIZE_INO)
467 * Find all of the inodes which share blocks with this
468 * one. First we find all of the duplicate blocks
469 * belonging to this inode, and then search each block
470 * get the list of inodes, and merge them together.
472 for (s = p->block_list; s; s = s->next) {
473 m = dict_lookup(&blk_dict, INT_TO_VOIDPTR(s->block));
475 continue; /* Should never happen... */
476 q = (struct dup_block *) dnode_get(m);
479 if (check_if_fs_block(ctx, s->block)) {
485 * Add all inodes used by this block to the
486 * shared[] --- which is a unique list, so
487 * if an inode is already in shared[], don't
490 for (r = q->inode_list; r; r = r->next) {
493 for (i = 0; i < shared_len; i++)
494 if (shared[i] == r->inode)
496 if (i == shared_len) {
497 shared[shared_len++] = r->inode;
503 * Report the inode that we are working on
505 pctx.inode = &p->inode;
508 pctx.blkcount = p->num_dupblocks;
509 pctx.num = meta_data ? shared_len+1 : shared_len;
510 fix_problem(ctx, PR_1D_DUP_FILE, &pctx);
515 fix_problem(ctx, PR_1D_SHARE_METADATA, &pctx);
517 for (i = 0; i < shared_len; i++) {
518 m = dict_lookup(&ino_dict, INT_TO_VOIDPTR(shared[i]));
520 continue; /* should never happen */
521 t = (struct dup_inode *) dnode_get(m);
523 * Report the inode that we are sharing with
525 pctx.inode = &t->inode;
526 pctx.ino = shared[i];
528 fix_problem(ctx, PR_1D_DUP_FILE_LIST, &pctx);
531 fix_problem(ctx, PR_1D_DUP_BLOCKS_DEALT, &pctx);
534 if (fix_problem(ctx, PR_1D_CLONE_QUESTION, &pctx)) {
535 pctx.errcode = clone_file(ctx, ino, p, block_buf);
537 fix_problem(ctx, PR_1D_CLONE_ERROR, &pctx);
541 if (fix_problem(ctx, PR_1D_DELETE_QUESTION, &pctx))
542 delete_file(ctx, ino, p, block_buf);
544 ext2fs_unmark_valid(fs);
546 ext2fs_free_mem(&shared);
550 * Drop the refcount on the dup_block structure, and clear the entry
551 * in the block_dup_map if appropriate.
553 static void decrement_badcount(e2fsck_t ctx, blk64_t block, struct dup_block *p)
556 if (p->num_bad <= 0 ||
557 (p->num_bad == 1 && !check_if_fs_block(ctx, block)))
558 ext2fs_unmark_block_bitmap2(ctx->block_dup_map, block);
561 static int delete_file_block(ext2_filsys fs,
563 e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
564 blk64_t ref_block EXT2FS_ATTR((unused)),
565 int ref_offset EXT2FS_ATTR((unused)),
568 struct process_block_struct *pb;
573 pb = (struct process_block_struct *) priv_data;
576 if (HOLE_BLKADDR(*block_nr))
579 if (ext2fs_test_block_bitmap2(ctx->block_dup_map, *block_nr)) {
580 n = dict_lookup(&blk_dict, INT_TO_VOIDPTR(*block_nr));
582 p = (struct dup_block *) dnode_get(n);
583 decrement_badcount(ctx, *block_nr, p);
585 com_err("delete_file_block", 0,
586 _("internal error: can't find dup_blk for %llu\n"),
589 ext2fs_unmark_block_bitmap2(ctx->block_found_map, *block_nr);
590 ext2fs_block_alloc_stats2(fs, *block_nr, -1);
596 static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
597 struct dup_inode *dp, char* block_buf)
599 ext2_filsys fs = ctx->fs;
600 struct process_block_struct pb;
601 struct ext2_inode inode;
602 struct problem_context pctx;
605 clear_problem_context(&pctx);
606 pctx.ino = pb.ino = ino;
607 pb.dup_blocks = dp->num_dupblocks;
609 pctx.str = "delete_file";
611 e2fsck_read_inode(ctx, ino, &inode, "delete_file");
612 if (ext2fs_inode_has_valid_blocks(&inode))
613 pctx.errcode = ext2fs_block_iterate3(fs, ino, BLOCK_FLAG_READ_ONLY,
614 block_buf, delete_file_block, &pb);
616 fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
617 if (ctx->inode_bad_map)
618 ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
619 ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(inode.i_mode));
621 /* Inode may have changed by block_iterate, so reread it */
622 e2fsck_read_inode(ctx, ino, &inode, "delete_file");
623 e2fsck_clear_inode(ctx, ino, &inode, 0, "delete_file");
624 if (ext2fs_file_acl_block(&inode) &&
625 (fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
627 pctx.errcode = ext2fs_adjust_ea_refcount2(fs,
628 ext2fs_file_acl_block(&inode),
629 block_buf, -1, &count);
630 if (pctx.errcode == EXT2_ET_BAD_EA_BLOCK_NUM) {
635 pctx.blk = ext2fs_file_acl_block(&inode);
636 fix_problem(ctx, PR_1B_ADJ_EA_REFCOUNT, &pctx);
639 * If the count is zero, then arrange to have the
640 * block deleted. If the block is in the block_dup_map,
641 * also call delete_file_block since it will take care
642 * of keeping the accounting straight.
645 ext2fs_test_block_bitmap2(ctx->block_dup_map,
646 ext2fs_file_acl_block(&inode))) {
647 blk64_t blk = ext2fs_file_acl_block(&inode);
648 delete_file_block(fs, &blk,
649 BLOCK_COUNT_EXTATTR, 0, 0, &pb);
650 ext2fs_file_acl_block_set(&inode, blk);
655 struct clone_struct {
662 static int clone_file_block(ext2_filsys fs,
664 e2_blkcnt_t blockcnt,
665 blk64_t ref_block EXT2FS_ATTR((unused)),
666 int ref_offset EXT2FS_ATTR((unused)),
672 struct clone_struct *cs = (struct clone_struct *) priv_data;
678 if (HOLE_BLKADDR(*block_nr))
681 if (ext2fs_test_block_bitmap2(ctx->block_dup_map, *block_nr)) {
682 n = dict_lookup(&blk_dict, INT_TO_VOIDPTR(*block_nr));
684 p = (struct dup_block *) dnode_get(n);
685 retval = ext2fs_new_block2(fs, 0, ctx->block_found_map,
688 cs->errcode = retval;
691 if (cs->dir && (blockcnt >= 0)) {
692 retval = ext2fs_set_dir_block2(fs->dblist,
693 cs->dir, new_block, blockcnt);
695 cs->errcode = retval;
700 printf("Cloning block %u to %u\n", *block_nr,
703 retval = io_channel_read_blk64(fs->io, *block_nr, 1,
706 cs->errcode = retval;
709 retval = io_channel_write_blk64(fs->io, new_block, 1,
712 cs->errcode = retval;
715 decrement_badcount(ctx, *block_nr, p);
716 *block_nr = new_block;
717 ext2fs_mark_block_bitmap2(ctx->block_found_map,
719 ext2fs_mark_block_bitmap2(fs->block_map, new_block);
720 return BLOCK_CHANGED;
722 com_err("clone_file_block", 0,
723 _("internal error: can't find dup_blk for %llu\n"),
729 static int clone_file(e2fsck_t ctx, ext2_ino_t ino,
730 struct dup_inode *dp, char* block_buf)
732 ext2_filsys fs = ctx->fs;
734 struct clone_struct cs;
735 struct problem_context pctx;
736 blk64_t blk, new_blk;
738 struct inode_el *ino_el;
739 struct dup_block *db;
740 struct dup_inode *di;
742 clear_problem_context(&pctx);
746 retval = ext2fs_get_mem(fs->blocksize, &cs.buf);
750 if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino))
754 pctx.str = "clone_file";
755 if (ext2fs_inode_has_valid_blocks(&dp->inode))
756 pctx.errcode = ext2fs_block_iterate3(fs, ino, 0, block_buf,
757 clone_file_block, &cs);
758 ext2fs_mark_bb_dirty(fs);
760 fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
761 retval = pctx.errcode;
765 com_err("clone_file", cs.errcode,
766 _("returned from clone_file_block"));
770 /* The inode may have changed on disk, so we have to re-read it */
771 e2fsck_read_inode(ctx, ino, &dp->inode, "clone file EA");
772 blk = ext2fs_file_acl_block(&dp->inode);
774 if (blk && (clone_file_block(fs, &new_blk,
775 BLOCK_COUNT_EXTATTR, 0, 0, &cs) ==
777 ext2fs_file_acl_block_set(&dp->inode, new_blk);
778 e2fsck_write_inode(ctx, ino, &dp->inode, "clone file EA");
780 * If we cloned the EA block, find all other inodes
781 * which refered to that EA block, and modify
782 * them to point to the new EA block.
784 n = dict_lookup(&blk_dict, INT_TO_VOIDPTR(blk));
786 com_err("clone_file", 0,
787 _("internal error: couldn't lookup EA "
788 "block record for %llu"), blk);
789 retval = 0; /* OK to stumble on... */
792 db = (struct dup_block *) dnode_get(n);
793 for (ino_el = db->inode_list; ino_el; ino_el = ino_el->next) {
794 if (ino_el->inode == ino)
796 n = dict_lookup(&ino_dict, INT_TO_VOIDPTR(ino_el->inode));
798 com_err("clone_file", 0,
799 _("internal error: couldn't lookup EA "
800 "inode record for %u"),
802 retval = 0; /* OK to stumble on... */
805 di = (struct dup_inode *) dnode_get(n);
806 if (ext2fs_file_acl_block(&di->inode) == blk) {
807 ext2fs_file_acl_block_set(&di->inode,
808 ext2fs_file_acl_block(&dp->inode));
809 e2fsck_write_inode(ctx, ino_el->inode,
810 &di->inode, "clone file EA");
811 decrement_badcount(ctx, blk, db);
817 ext2fs_free_mem(&cs.buf);
822 * This routine returns 1 if a block overlaps with one of the superblocks,
823 * group descriptors, inode bitmaps, or block bitmaps.
825 static int check_if_fs_block(e2fsck_t ctx, blk64_t test_block)
827 ext2_filsys fs = ctx->fs;
831 first_block = fs->super->s_first_data_block;
832 for (i = 0; i < fs->group_desc_count; i++) {
834 /* Check superblocks/block group descriptors */
835 if (ext2fs_bg_has_super(fs, i)) {
836 if (test_block >= first_block &&
837 (test_block <= first_block + fs->desc_blocks))
841 /* Check the inode table */
842 if ((ext2fs_inode_table_loc(fs, i)) &&
843 (test_block >= ext2fs_inode_table_loc(fs, i)) &&
844 (test_block < (ext2fs_inode_table_loc(fs, i) +
845 fs->inode_blocks_per_group)))
848 /* Check the bitmap blocks */
849 if ((test_block == ext2fs_block_bitmap_loc(fs, i)) ||
850 (test_block == ext2fs_inode_bitmap_loc(fs, i)))
853 first_block += fs->super->s_blocks_per_group;