summaryrefslogtreecommitdiffstats
path: root/fs/logfs/file.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-17 22:53:35 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-17 22:53:35 +0200
commit7d32c0aca4fbd0319c860d12af5fae3e88c760e6 (patch)
tree3df9712c128a98916601a98510e5160dac809264 /fs/logfs/file.c
parentMerge branch 'bkl/core' of git://git.kernel.org/pub/scm/linux/kernel/git/fred... (diff)
parentlogfs: handle powerfail on NAND flash (diff)
downloadlinux-7d32c0aca4fbd0319c860d12af5fae3e88c760e6.tar.xz
linux-7d32c0aca4fbd0319c860d12af5fae3e88c760e6.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/joern/logfs
* git://git.kernel.org/pub/scm/linux/kernel/git/joern/logfs: logfs: handle powerfail on NAND flash logfs: handle errors from get_mtd_device() logfs: remove unused variable logfs: fix sync logfs: fix compile failure logfs: initialize li->li_refcount logfs: commit reservations under space pressure logfs: survive logfs_buf_recover read errors logfs: Close i_ino reuse race logfs: fix logfs_seek_hole() logfs: Return -EINVAL if filesystem image doesn't match LogFS: Fix typo in b6349ac8 logfs: testing the wrong variable
Diffstat (limited to 'fs/logfs/file.c')
-rw-r--r--fs/logfs/file.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/logfs/file.c b/fs/logfs/file.c
index 370f367a933e..0de524071870 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);
}
@@ -212,10 +222,8 @@ int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
int logfs_fsync(struct file *file, struct dentry *dentry, int datasync)
{
struct super_block *sb = dentry->d_inode->i_sb;
- struct logfs_super *super = logfs_super(sb);
- /* FIXME: write anchor */
- super->s_devops->sync(sb);
+ logfs_write_anchor(sb);
return 0;
}