summaryrefslogtreecommitdiff
path: root/fs/ubifs/misc.h
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-06 17:52:32 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-16 14:12:12 +0300
commite11602ea3e43392904db7a579dc990062ebb7151 (patch)
tree3930553264a369773cc1f66aa33b790d17589a40 /fs/ubifs/misc.h
parent91c66083fca36cdf496e927ef8bea19e6b1bbdce (diff)
UBIFS: share the next_log_lnum helper
We'll need to use the 'next_log_lnum()' helper function from log.c in the fixup code, so let's move it to misc.h. IOW, this is a preparation to the following free space fixup changes. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/misc.h')
-rw-r--r--fs/ubifs/misc.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h
index c3de04dc952..0b5296a9a4c 100644
--- a/fs/ubifs/misc.h
+++ b/fs/ubifs/misc.h
@@ -340,4 +340,21 @@ static inline void ubifs_release_lprops(struct ubifs_info *c)
mutex_unlock(&c->lp_mutex);
}
+/**
+ * ubifs_next_log_lnum - switch to the next log LEB.
+ * @c: UBIFS file-system description object
+ * @lnum: current log LEB
+ *
+ * This helper function returns the log LEB number which goes next after LEB
+ * 'lnum'.
+ */
+static inline int ubifs_next_log_lnum(const struct ubifs_info *c, int lnum)
+{
+ lnum += 1;
+ if (lnum > c->log_last)
+ lnum = UBIFS_LOG_LNUM;
+
+ return lnum;
+}
+
#endif /* __UBIFS_MISC_H__ */