[JFFS2][XATTR] Remove jffs2_garbage_collect_xattr(c, ic)
authorKaiGai Kohei <kaigai@ak.jp.nec.com>
Sat, 13 May 2006 06:16:13 +0000 (15:16 +0900)
committerKaiGai Kohei <kaigai@ak.jp.nec.com>
Sat, 13 May 2006 06:16:13 +0000 (15:16 +0900)
Remove jffs2_garbage_collect_xattr(c, ic).
jffs2_garbage_collect_xattr_datum/ref() are called from gc.c directly.

In original implementation, jffs2_garbage_collect_xattr(c, ic) returns
with holding a spinlock if 'ic' is inode_cache. But it returns after
releasing a spinlock if 'ic' is xattr_datum/ref.
It looks so confusable behavior. Thus, this patch makes caller manage
locking/unlocking.

[5/10] jffs2-xattr-v5.1-05-update_xattr_gc.patch

Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com>
fs/jffs2/gc.c
fs/jffs2/xattr.c
fs/jffs2/xattr.h

index 4ea1b7f..a5ef981 100644 (file)
@@ -266,15 +266,22 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
 
        ic = jffs2_raw_ref_to_ic(raw);
 
+#ifdef CONFIG_JFFS2_FS_XATTR
        /* When 'ic' refers xattr_datum/xattr_ref, this node is GCed as xattr.
-          We can decide whether this node is inode or xattr by ic->class.
-          ret = 0 : ic is xattr_datum/xattr_ref, and GC was SUCCESSED.
-          ret < 0 : ic is xattr_datum/xattr_ref, but GC was FAILED.
-          ret > 0 : ic is NOT xattr_datum/xattr_ref.
-       */
-       ret = jffs2_garbage_collect_xattr(c, ic);
-       if (ret <= 0)
+        * We can decide whether this node is inode or xattr by ic->class.     */
+       if (ic->class == RAWNODE_CLASS_XATTR_DATUM
+           || ic->class == RAWNODE_CLASS_XATTR_REF) {
+               BUG_ON(raw->next_in_ino != (void *)ic);
+               spin_unlock(&c->erase_completion_lock);
+
+               if (ic->class == RAWNODE_CLASS_XATTR_DATUM) {
+                       ret = jffs2_garbage_collect_xattr_datum(c, (struct jffs2_xattr_datum *)ic);
+               } else {
+                       ret = jffs2_garbage_collect_xattr_ref(c, (struct jffs2_xattr_ref *)ic);
+               }
                goto release_sem;
+       }
+#endif
 
        /* We need to hold the inocache. Either the erase_completion_lock or
           the inocache_lock are sufficient; we trade down since the inocache_lock
Simple merge
Simple merge