aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/find.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-06 15:00:19 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-06 15:00:19 -0700
commite0724bf6e4a1f2e678d2b2aab01cae22e17862f0 (patch)
tree559a8fa8e7a92f8ae0e0a27d4e71f408fa7cec62 /fs/ubifs/find.c
parent38d9aefb5ce8f26358b0d5cd933cfa9e267105b1 (diff)
parentde0975781a1a8bc92e07eb7681d10ef9bb5e6df9 (diff)
downloadkernel_samsung_smdk4412-e0724bf6e4a1f2e678d2b2aab01cae22e17862f0.zip
kernel_samsung_smdk4412-e0724bf6e4a1f2e678d2b2aab01cae22e17862f0.tar.gz
kernel_samsung_smdk4412-e0724bf6e4a1f2e678d2b2aab01cae22e17862f0.tar.bz2
Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
* 'linux-next' of git://git.infradead.org/ubifs-2.6: UBIFS: fix recovery bug UBIFS: add R/O compatibility UBIFS: fix compiler warnings UBIFS: fully sort GCed nodes UBIFS: fix commentaries UBIFS: introduce a helpful variable UBIFS: use KERN_CONT UBIFS: fix lprops committing bug UBIFS: fix bogus assertion UBIFS: fix bug where page is marked uptodate when out of space UBIFS: amend key_hash return value UBIFS: improve find function interface UBIFS: list usage cleanup UBIFS: fix dbg_chk_lpt_sz()
Diffstat (limited to 'fs/ubifs/find.c')
-rw-r--r--fs/ubifs/find.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c
index 717d79c..1d54383 100644
--- a/fs/ubifs/find.c
+++ b/fs/ubifs/find.c
@@ -478,7 +478,7 @@ const struct ubifs_lprops *do_find_free_space(struct ubifs_info *c,
* ubifs_find_free_space - find a data LEB with free space.
* @c: the UBIFS file-system description object
* @min_space: minimum amount of required free space
- * @free: contains amount of free space in the LEB on exit
+ * @offs: contains offset of where free space starts on exit
* @squeeze: whether to try to find space in a non-empty LEB first
*
* This function looks for an LEB with at least @min_space bytes of free space.
@@ -490,7 +490,7 @@ const struct ubifs_lprops *do_find_free_space(struct ubifs_info *c,
* failed to find a LEB with @min_space bytes of free space and other a negative
* error codes in case of failure.
*/
-int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *free,
+int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *offs,
int squeeze)
{
const struct ubifs_lprops *lprops;
@@ -558,10 +558,10 @@ int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *free,
spin_unlock(&c->space_lock);
}
- *free = lprops->free;
+ *offs = c->leb_size - lprops->free;
ubifs_release_lprops(c);
- if (*free == c->leb_size) {
+ if (*offs == 0) {
/*
* Ensure that empty LEBs have been unmapped. They may not have
* been, for example, because of an unclean unmount. Also
@@ -573,8 +573,8 @@ int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *free,
return err;
}
- dbg_find("found LEB %d, free %d", lnum, *free);
- ubifs_assert(*free >= min_space);
+ dbg_find("found LEB %d, free %d", lnum, c->leb_size - *offs);
+ ubifs_assert(*offs <= c->leb_size - min_space);
return lnum;
out: