summaryrefslogtreecommitdiff
path: root/fs/logfs/file.c
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2010-05-04 19:41:09 +0200
committerJoern Engel <joern@logfs.org>2010-05-04 19:41:09 +0200
commit05ebad852901cf9127a743df6ea10c0e8b1590c3 (patch)
treeeb5e200d3ca4ae15bec2cbf3731055ff29e7f73c /fs/logfs/file.c
parent20503664b008e17976bff1fdbc693c77ebd6f6c9 (diff)
logfs: commit reservations under space pressure
Ensures we only return -ENOSPC when there really is no space. Signed-off-by: Joern Engel <joern@logfs.org>
Diffstat (limited to 'fs/logfs/file.c')
-rw-r--r--fs/logfs/file.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/logfs/file.c b/fs/logfs/file.c
index 370f367a933..bf9b1cf953a 100644
--- a/fs/logfs/file.c
+++ b/fs/logfs/file.c
@@ -161,7 +161,17 @@ static int logfs_writepage(struct page *page, struct writeback_control *wbc)
static void logfs_invalidatepage(struct page *page, unsigned long offset)
{
- move_page_to_btree(page);
+ struct logfs_block *block = logfs_block(page);
+
+ if (block->reserved_bytes) {
+ struct super_block *sb = page->mapping->host->i_sb;
+ struct logfs_super *super = logfs_super(sb);
+
+ super->s_dirty_pages -= block->reserved_bytes;
+ block->ops->free_block(sb, block);
+ BUG_ON(bitmap_weight(block->alias_map, LOGFS_BLOCK_FACTOR));
+ } else
+ move_page_to_btree(page);
BUG_ON(PagePrivate(page) || page->private);
}