Unionfs: uninline unionfs_copy_attr_times and unionfs_copy_attr_all
authorErez Zadok <ezk@cs.sunysb.edu>
Fri, 15 Feb 2008 22:18:48 +0000 (17:18 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 29 Apr 2011 02:25:55 +0000 (22:25 -0400)
This reduces text size by about 6k.

Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/fanout.h
fs/unionfs/subr.c
fs/unionfs/union.h

index 4d9a45fa6d4bfb401dce98ef28c0adb48fdff9ce..29d42fbca223294fad48f2fc8e7e2457b81c34fd 100644 (file)
@@ -313,54 +313,4 @@ static inline void verify_locked(struct dentry *d)
        BUG_ON(!mutex_is_locked(&UNIONFS_D(d)->lock));
 }
 
-/* copy a/m/ctime from the lower branch with the newest times */
-static inline void unionfs_copy_attr_times(struct inode *upper)
-{
-       int bindex;
-       struct inode *lower;
-
-       if (!upper || ibstart(upper) < 0)
-               return;
-       for (bindex = ibstart(upper); bindex <= ibend(upper); bindex++) {
-               lower = unionfs_lower_inode_idx(upper, bindex);
-               if (!lower)
-                       continue; /* not all lower dir objects may exist */
-               if (unlikely(timespec_compare(&upper->i_mtime,
-                                             &lower->i_mtime) < 0))
-                       upper->i_mtime = lower->i_mtime;
-               if (unlikely(timespec_compare(&upper->i_ctime,
-                                             &lower->i_ctime) < 0))
-                       upper->i_ctime = lower->i_ctime;
-               if (unlikely(timespec_compare(&upper->i_atime,
-                                             &lower->i_atime) < 0))
-                       upper->i_atime = lower->i_atime;
-       }
-}
-
-/*
- * A unionfs/fanout version of fsstack_copy_attr_all.  Uses a
- * unionfs_get_nlinks to properly calcluate the number of links to a file.
- * Also, copies the max() of all a/m/ctimes for all lower inodes (which is
- * important if the lower inode is a directory type)
- */
-static inline void unionfs_copy_attr_all(struct inode *dest,
-                                        const struct inode *src)
-{
-       dest->i_mode = src->i_mode;
-       dest->i_uid = src->i_uid;
-       dest->i_gid = src->i_gid;
-       dest->i_rdev = src->i_rdev;
-
-       unionfs_copy_attr_times(dest);
-
-       dest->i_blkbits = src->i_blkbits;
-       dest->i_flags = src->i_flags;
-
-       /*
-        * Update the nlinks AFTER updating the above fields, because the
-        * get_links callback may depend on them.
-        */
-       dest->i_nlink = unionfs_get_nlinks(dest);
-}
-
 #endif /* not _FANOUT_H */
index 0a0fce9ac1387629756935fe95cec5d342d72259..68a628065fcc14ddc275b9183bfb9567635968cf 100644 (file)
@@ -240,3 +240,53 @@ char *alloc_whname(const char *name, int len)
 
        return buf;
 }
+
+/* copy a/m/ctime from the lower branch with the newest times */
+void unionfs_copy_attr_times(struct inode *upper)
+{
+       int bindex;
+       struct inode *lower;
+
+       if (!upper || ibstart(upper) < 0)
+               return;
+       for (bindex = ibstart(upper); bindex <= ibend(upper); bindex++) {
+               lower = unionfs_lower_inode_idx(upper, bindex);
+               if (!lower)
+                       continue; /* not all lower dir objects may exist */
+               if (unlikely(timespec_compare(&upper->i_mtime,
+                                             &lower->i_mtime) < 0))
+                       upper->i_mtime = lower->i_mtime;
+               if (unlikely(timespec_compare(&upper->i_ctime,
+                                             &lower->i_ctime) < 0))
+                       upper->i_ctime = lower->i_ctime;
+               if (unlikely(timespec_compare(&upper->i_atime,
+                                             &lower->i_atime) < 0))
+                       upper->i_atime = lower->i_atime;
+       }
+}
+
+/*
+ * A unionfs/fanout version of fsstack_copy_attr_all.  Uses a
+ * unionfs_get_nlinks to properly calcluate the number of links to a file.
+ * Also, copies the max() of all a/m/ctimes for all lower inodes (which is
+ * important if the lower inode is a directory type)
+ */
+void unionfs_copy_attr_all(struct inode *dest,
+                          const struct inode *src)
+{
+       dest->i_mode = src->i_mode;
+       dest->i_uid = src->i_uid;
+       dest->i_gid = src->i_gid;
+       dest->i_rdev = src->i_rdev;
+
+       unionfs_copy_attr_times(dest);
+
+       dest->i_blkbits = src->i_blkbits;
+       dest->i_flags = src->i_flags;
+
+       /*
+        * Update the nlinks AFTER updating the above fields, because the
+        * get_links callback may depend on them.
+        */
+       dest->i_nlink = unionfs_get_nlinks(dest);
+}
index ff764d93924d33d12f7279873b0e306fcf520de1..2e21595ed0355aaadaa661dcfda42ab39f6bf81c 100644 (file)
@@ -206,6 +206,8 @@ struct unionfs_dir_state {
 
 /* externs needed for fanout.h or sioq.h */
 extern int unionfs_get_nlinks(const struct inode *inode);
+extern void unionfs_copy_attr_times(struct inode *upper);
+extern void unionfs_copy_attr_all(struct inode *dest, const struct inode *src);
 
 /* include miscellaneous macros */
 #include "fanout.h"