13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15 #include <linux/kernel.h>
16 #include <linux/sched.h>
17 #include <linux/slab.h>
22 static void jffs2_build_remove_unlinked_inode(
struct jffs2_sb_info *,
42 return first_inode_chain(i, c);
45 #define for_each_inode(i, c, ic) \
46 for (i = 0, ic = first_inode_chain(&i, (c)); \
48 ic = next_inode(&i, ic, (c)))
68 dbg_fsbuild(
"child \"%s\" (ino #%u) of dir ino #%u doesn't exist!\n",
76 JFFS2_ERROR(
"child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n",
122 jffs2_build_inode_pass1(c, ic);
140 jffs2_build_remove_unlinked_inode(c, ic, &dead_fds);
153 jffs2_build_remove_unlinked_inode(c, ic, &dead_fds);
158 dbg_fsbuild(
"freeing temporary data structures\n");
195 static void jffs2_build_remove_unlinked_inode(
struct jffs2_sb_info *c,
205 while (raw != (
void *)ic) {
214 dbg_fsbuild(
"inode #%u was a directory which may have children...\n", ic->
ino);
224 dbg_fsbuild(
"child \"%s\" is a deletion dirent, skipping...\n", fd->
name);
235 dbg_fsbuild(
"cannot remove child \"%s\", ino #%u, because it doesn't exist\n",
250 dbg_fsbuild(
"inode #%u (\"%s\") now has no links; adding to dead_fds list.\n",
252 fd->
next = *dead_fds;
255 dbg_fsbuild(
"inode #%u (\"%s\") has now got nlink %d. Ignoring.\n",
268 static void jffs2_calc_trigger_levels(
struct jffs2_sb_info *c)
312 dbg_fsbuild(
"trigger levels (size %d KiB, block size %d KiB, %d blocks)\n",
314 dbg_fsbuild(
"Blocks required to allow deletion: %d (%d KiB)\n",
316 dbg_fsbuild(
"Blocks required to allow writes: %d (%d KiB)\n",
318 dbg_fsbuild(
"Blocks required to quiesce GC thread: %d (%d KiB)\n",
320 dbg_fsbuild(
"Blocks required to allow GC merges: %d (%d KiB)\n",
322 dbg_fsbuild(
"Blocks required to GC bad blocks: %d (%d KiB)\n",
324 dbg_fsbuild(
"Amount of dirty space required to GC: %d bytes\n",
326 dbg_fsbuild(
"Very dirty blocks before GC triggered: %d\n",
340 if (jffs2_blocks_use_vmalloc(c))
349 INIT_LIST_HEAD(&c->
blocks[i].list);
373 if (jffs2_build_filesystem(c)) {
381 jffs2_calc_trigger_levels(c);
387 if (jffs2_blocks_use_vmalloc(c))