+2003-12-11 Theodore Ts'o <tytso@thunk.org>
+
+ * debugfs.c (do_write, do_mkdir): If the directory is full,
+ automatically call ext2fs_expand_dir() and then retry to
+ add the link to the directory as a convenience to the
+ user. (Addresses Debian Bug: #217892)
+ (do_mknod): Clean up expand_dir error handling.
+
2003-12-07 Theodore Ts'o <tytso@mit.edu>
* debugfs.c (do_write): Mask off the file type bits, and OR in the
printf("Allocated inode: %u\n", newfile);
retval = ext2fs_link(current_fs, cwd, argv[2], newfile,
EXT2_FT_REG_FILE);
+ if (retval == EXT2_ET_DIR_NO_SPACE) {
+ retval = ext2fs_expand_dir(current_fs, cwd);
+ if (retval) {
+ com_err(argv[0], retval, "while expanding directory");
+ return;
+ }
+ retval = ext2fs_link(current_fs, cwd, argv[2], newfile,
+ EXT2_FT_REG_FILE);
+ }
if (retval) {
com_err(argv[2], retval, "");
close(fd);
}
printf("Allocated inode: %u\n", newfile);
retval = ext2fs_link(current_fs, cwd, argv[1], newfile, filetype);
- if (retval) {
- if (retval == EXT2_ET_DIR_NO_SPACE) {
- retval = ext2fs_expand_dir(current_fs, cwd);
- if (!retval)
- retval = ext2fs_link(current_fs, cwd,
- argv[1], newfile,
- filetype);
- }
+ if (retval == EXT2_ET_DIR_NO_SPACE) {
+ retval = ext2fs_expand_dir(current_fs, cwd);
if (retval) {
- com_err(argv[1], retval, "");
+ com_err(argv[0], retval, "while expanding directory");
return;
}
+ retval = ext2fs_link(current_fs, cwd, argv[1], newfile,
+ filetype);
+ }
+ if (retval) {
+ com_err(argv[1], retval, "");
+ return;
}
if (ext2fs_test_inode_bitmap(current_fs->inode_map,newfile))
com_err(argv[0], 0, "Warning: inode already set");
name = argv[1];
}
-
+try_again:
retval = ext2fs_mkdir(current_fs, parent, 0, name);
+ if (retval == EXT2_ET_DIR_NO_SPACE) {
+ retval = ext2fs_expand_dir(current_fs, parent);
+ if (retval) {
+ com_err("argv[0]", retval, "while expanding directory");
+ return;
+ }
+ goto try_again;
+ }
if (retval) {
com_err("ext2fs_mkdir", retval, "");
return;