commit 484315a1640ca570be0ef59205cc674dc89bab2a
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Wed Apr 11 16:38:57 2007 -0400

    cleanup thread to print warning only once

diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index 7395464..b03a061 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -541,6 +541,8 @@ out:
  *     ODF_CLEAN_CACHE: cleans all the dir caches
  *     ODF_CLEAN_BLOCKS: clean until size blocks are freed
  *     ODF_CLEAN_INODES: clean until size inodes are freed
+ * Returns 1 if it manages to bring inodes/block below requested, 
+ * threshold and 0 if not.
  */
 int odf_cleanup(struct odf_sb_info *odf, int mode, u64 size)
 {
@@ -655,12 +657,10 @@ cleanup_loop:
                        stack.item[stack.n++] = odf->odi_rc->dentry;
                        goto cleanup_loop;
                }
-               else if (mode == ODF_CLEAN_BLOCKS)
-                       printk("unionfs: Failed to bring free odf data blocks 
below threshold\n");
-               else if (mode == ODF_CLEAN_INODES)
-                       printk("unionfs: Failed to bring free odf inodes below 
threshold\n");
        }
-       
+
+       if (mode == ODF_CLEAN_ALL)
+               success = 1;
 
 out:
        BUG_ON(stack.n < 0);
@@ -669,6 +669,8 @@ out:
        
        kfree(buf);
        kfree(stack.item);
+       if (!err)
+               err = success;
        return err;
 }
 
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index fdd5996..812cd53 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -1814,9 +1814,17 @@ void __odf_cleanup(void *args)
        }
        if (cleanup)
                err = odf_cleanup(cl->odf, cleanup, size);
-       if (err)
+       if (err < 0)
                printk("unionfs cleanup thread: error %d\n", err);
-
+       else {
+               if (err == 0 && cl->success == 1) {
+                       if (cleanup == ODF_CLEAN_BLOCKS)
+                               printk("unionfs: Failed to bring free odf data 
blocks below threshold\n");
+                       else if (cleanup == ODF_CLEAN_INODES)
+                               printk("unionfs: Failed to bring free odf 
inodes below threshold\n");
+               }
+               cl->success = err;
+       }
        odf_unlock(cl->odf->odi_ic);
        odf_unlock(cl->odf->odi_rc);
 }
diff --git a/fs/unionfs/sioq.h b/fs/unionfs/sioq.h
index 6e542eb..a7be2f0 100644
--- a/fs/unionfs/sioq.h
+++ b/fs/unionfs/sioq.h
@@ -37,6 +37,7 @@ struct cleanup_args {
        struct odf_sb_info *odf;
        struct unionfs_attributes *attr;
        int force;
+       int success;
 };
 
 struct sioq_args {
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to