aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-08-27 05:50:57 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-09-30 04:12:56 -0400
commit746103aca2ae2b044e32a6ab06a6536652124c99 (patch)
treed667b2efc613ccc6349e9b034b965eb645810997 /fs
parent8d47aef43ba166bdd11d522307c61ab23aab61c3 (diff)
UBIFS: inline one-line functions
'ubifs_get_lprops()' and 'ubifs_release_lprops()' basically wrap mutex lock and unlock. We have them because we want lprops subsystem be separate and as independent as possible. And we planned better locking rules for lprops. Anyway, because they are short, it is better to inline them. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ubifs/lprops.c28
-rw-r--r--fs/ubifs/misc.h27
-rw-r--r--fs/ubifs/ubifs.h2
3 files changed, 27 insertions, 30 deletions
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index 3659b887743b..f27176e9b70d 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -461,18 +461,6 @@ static void change_category(struct ubifs_info *c, struct ubifs_lprops *lprops)
461} 461}
462 462
463/** 463/**
464 * ubifs_get_lprops - get reference to LEB properties.
465 * @c: the UBIFS file-system description object
466 *
467 * This function locks lprops. Lprops have to be unlocked by
468 * 'ubifs_release_lprops()'.
469 */
470void ubifs_get_lprops(struct ubifs_info *c)
471{
472 mutex_lock(&c->lp_mutex);
473}
474
475/**
476 * calc_dark - calculate LEB dark space size. 464 * calc_dark - calculate LEB dark space size.
477 * @c: the UBIFS file-system description object 465 * @c: the UBIFS file-system description object
478 * @spc: amount of free and dirty space in the LEB 466 * @spc: amount of free and dirty space in the LEB
@@ -643,22 +631,6 @@ const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
643} 631}
644 632
645/** 633/**
646 * ubifs_release_lprops - release lprops lock.
647 * @c: the UBIFS file-system description object
648 *
649 * This function has to be called after each 'ubifs_get_lprops()' call to
650 * unlock lprops.
651 */
652void ubifs_release_lprops(struct ubifs_info *c)
653{
654 ubifs_assert(mutex_is_locked(&c->lp_mutex));
655 ubifs_assert(c->lst.empty_lebs >= 0 &&
656 c->lst.empty_lebs <= c->main_lebs);
657
658 mutex_unlock(&c->lp_mutex);
659}
660
661/**
662 * ubifs_get_lp_stats - get lprops statistics. 634 * ubifs_get_lp_stats - get lprops statistics.
663 * @c: UBIFS file-system description object 635 * @c: UBIFS file-system description object
664 * @st: return statistics 636 * @st: return statistics
diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h
index 4c12a9215d7f..4fa81d867e41 100644
--- a/fs/ubifs/misc.h
+++ b/fs/ubifs/misc.h
@@ -310,4 +310,31 @@ static inline int ubifs_tnc_lookup(struct ubifs_info *c,
310 return ubifs_tnc_locate(c, key, node, NULL, NULL); 310 return ubifs_tnc_locate(c, key, node, NULL, NULL);
311} 311}
312 312
313/**
314 * ubifs_get_lprops - get reference to LEB properties.
315 * @c: the UBIFS file-system description object
316 *
317 * This function locks lprops. Lprops have to be unlocked by
318 * 'ubifs_release_lprops()'.
319 */
320static inline void ubifs_get_lprops(struct ubifs_info *c)
321{
322 mutex_lock(&c->lp_mutex);
323}
324
325/**
326 * ubifs_release_lprops - release lprops lock.
327 * @c: the UBIFS file-system description object
328 *
329 * This function has to be called after each 'ubifs_get_lprops()' call to
330 * unlock lprops.
331 */
332static inline void ubifs_release_lprops(struct ubifs_info *c)
333{
334 ubifs_assert(mutex_is_locked(&c->lp_mutex));
335 ubifs_assert(c->lst.empty_lebs >= 0 &&
336 c->lst.empty_lebs <= c->main_lebs);
337 mutex_unlock(&c->lp_mutex);
338}
339
313#endif /* __UBIFS_MISC_H__ */ 340#endif /* __UBIFS_MISC_H__ */
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 17c620b93eec..ce8654928aad 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1586,12 +1586,10 @@ int ubifs_lpt_post_commit(struct ubifs_info *c);
1586void ubifs_lpt_free(struct ubifs_info *c, int wr_only); 1586void ubifs_lpt_free(struct ubifs_info *c, int wr_only);
1587 1587
1588/* lprops.c */ 1588/* lprops.c */
1589void ubifs_get_lprops(struct ubifs_info *c);
1590const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c, 1589const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
1591 const struct ubifs_lprops *lp, 1590 const struct ubifs_lprops *lp,
1592 int free, int dirty, int flags, 1591 int free, int dirty, int flags,
1593 int idx_gc_cnt); 1592 int idx_gc_cnt);
1594void ubifs_release_lprops(struct ubifs_info *c);
1595void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *stats); 1593void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *stats);
1596void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops, 1594void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops,
1597 int cat); 1595 int cat);