~daniel-mehrmann/e2fsprogs/master

« back to all changes in this revision

Viewing changes to resize/main.c

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2014-10-27 09:44:27 UTC
  • mfrom: (8.4.29 sid)
  • Revision ID: package-import@ubuntu.com-20141027094427-g56dce6sg7pasdgm
Tags: 1.42.12-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - debian/rules:
      Block pkg-create-dbgsym from operating on this package.
      Build without dietlibc-dev, which is in universe 
      Use the autotools-dev dh addon to update config.guess/config.sub for new
      ports.
  - debian/control:
      Regenerate with ./debian/rules debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
318
318
                printf("%s", _("Couldn't find valid filesystem superblock.\n"));
319
319
                exit (1);
320
320
        }
 
321
        fs->default_bitmap_type = EXT2FS_BMAP64_RBTREE;
 
322
 
 
323
        if (!(mount_flags & EXT2_MF_MOUNTED)) {
 
324
                if (!force && ((fs->super->s_lastcheck < fs->super->s_mtime) ||
 
325
                               (fs->super->s_state & EXT2_ERROR_FS) ||
 
326
                               ((fs->super->s_state & EXT2_VALID_FS) == 0))) {
 
327
                        fprintf(stderr,
 
328
                                _("Please run 'e2fsck -f %s' first.\n\n"),
 
329
                                device_name);
 
330
                        exit(1);
 
331
                }
 
332
        }
321
333
 
322
334
        /*
323
335
         * Check for compatibility with the feature sets.  We need to
332
344
        min_size = calculate_minimum_resize_size(fs, flags);
333
345
 
334
346
        if (print_min_size) {
335
 
                if (!force && ((fs->super->s_state & EXT2_ERROR_FS) ||
336
 
                               ((fs->super->s_state & EXT2_VALID_FS) == 0))) {
337
 
                        fprintf(stderr,
338
 
                                _("Please run 'e2fsck -f %s' first.\n\n"),
339
 
                                device_name);
340
 
                        exit(1);
341
 
                }
342
347
                printf(_("Estimated minimum size of the filesystem: %llu\n"),
343
348
                       min_size);
344
349
                exit(0);
436
441
                exit(1);
437
442
        }
438
443
        if (new_size == ext2fs_blocks_count(fs->super)) {
439
 
                fprintf(stderr, _("The filesystem is already %llu blocks "
440
 
                        "long.  Nothing to do!\n\n"), new_size);
 
444
                fprintf(stderr, _("The filesystem is already %llu (%dk) "
 
445
                        "blocks long.  Nothing to do!\n\n"), new_size,
 
446
                        fs->blocksize / 1024);
441
447
                exit(0);
442
448
        }
443
449
        if (mount_flags & EXT2_MF_MOUNTED) {
444
450
                bigalloc_check(fs, force);
445
451
                retval = online_resize_fs(fs, mtpt, &new_size, flags);
446
452
        } else {
447
 
                if (!force && ((fs->super->s_lastcheck < fs->super->s_mtime) ||
448
 
                               (fs->super->s_state & EXT2_ERROR_FS) ||
449
 
                               ((fs->super->s_state & EXT2_VALID_FS) == 0))) {
450
 
                        fprintf(stderr,
451
 
                                _("Please run 'e2fsck -f %s' first.\n\n"),
452
 
                                device_name);
453
 
                        exit(1);
454
 
                }
455
453
                bigalloc_check(fs, force);
456
454
                printf(_("Resizing the filesystem on "
457
455
                         "%s to %llu (%dk) blocks.\n"),
468
466
                        _("Please run 'e2fsck -fy %s' to fix the filesystem\n"
469
467
                          "after the aborted resize operation.\n"),
470
468
                        device_name);
471
 
                ext2fs_close(fs);
 
469
                ext2fs_close_free(&fs);
472
470
                exit(1);
473
471
        }
474
 
        printf(_("The filesystem on %s is now %llu blocks long.\n\n"),
475
 
               device_name, new_size);
 
472
        printf(_("The filesystem on %s is now %llu (%dk) blocks long.\n\n"),
 
473
               device_name, new_size, fs->blocksize / 1024);
476
474
 
477
475
        if ((st_buf.st_size > new_file_size) &&
478
476
            (fd > 0)) {