Skip to content

Commit

Permalink
Merge tag 'f2fs-for-v3.10' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/jaegeuk/f2fs

Pull f2fs updates from Jaegeuk Kim:
 "This patch-set includes the following major enhancement patches.
   - introduce a new gloabl lock scheme
   - add tracepoints on several major functions
   - fix the overall cleaning process focused on victim selection
   - apply the block plugging to merge IOs as much as possible
   - enhance management of free nids and its list
   - enhance the readahead mode for node pages
   - address several cretical deadlock conditions
   - reduce lock_page calls

  The other minor bug fixes and enhancements are as follows.
   - calculation mistakes: overflow
   - bio types: READ, READA, and READ_SYNC
   - fix the recovery flow, data races, and null pointer errors"

* tag 'f2fs-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (68 commits)
  f2fs: cover free_nid management with spin_lock
  f2fs: optimize scan_nat_page()
  f2fs: code cleanup for scan_nat_page() and build_free_nids()
  f2fs: bugfix for alloc_nid_failed()
  f2fs: recover when journal contains deleted files
  f2fs: continue to mount after failing recovery
  f2fs: avoid deadlock during evict after f2fs_gc
  f2fs: modify the number of issued pages to merge IOs
  f2fs: remove useless #include <linux/proc_fs.h> as we're now using sysfs as debug entry.
  f2fs: fix inconsistent using of NM_WOUT_THRESHOLD
  f2fs: check truncation of mapping after lock_page
  f2fs: enhance alloc_nid and build_free_nids flows
  f2fs: add a tracepoint on f2fs_new_inode
  f2fs: check nid == 0 in add_free_nid
  f2fs: add REQ_META about metadata requests for submit
  f2fs: give a chance to merge IOs by IO scheduler
  f2fs: avoid frequent background GC
  f2fs: add tracepoints to debug checkpoint request
  f2fs: add tracepoints for write page operations
  f2fs: add tracepoints to debug the block allocation
  ...
  • Loading branch information
torvalds committed May 8, 2013
2 parents 246e6a0 + 59bbd47 commit 942d33d
Show file tree
Hide file tree
Showing 20 changed files with 1,676 additions and 691 deletions.
4 changes: 3 additions & 1 deletion Documentation/filesystems/f2fs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ USAGE

Format options
--------------
-l [label] : Give a volume label, up to 256 unicode name.
-l [label] : Give a volume label, up to 512 unicode name.
-a [0 or 1] : Split start location of each area for heap-based allocation.
1 is set by default, which performs this.
-o [int] : Set overprovision ratio in percent over volume size.
Expand All @@ -156,6 +156,8 @@ Format options
-z [int] : Set the number of sections per zone.
1 is set by default.
-e [str] : Set basic extension list. e.g. "mp3,gif,mov"
-t [0 or 1] : Disable discard command or not.
1 is set by default, which conducts discard.

================================================================================
DESIGN
Expand Down
63 changes: 32 additions & 31 deletions fs/f2fs/checkpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "f2fs.h"
#include "node.h"
#include "segment.h"
#include <trace/events/f2fs.h>

static struct kmem_cache *orphan_entry_slab;
static struct kmem_cache *inode_entry_slab;
Expand Down Expand Up @@ -57,13 +58,19 @@ struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
cond_resched();
goto repeat;
}
if (f2fs_readpage(sbi, page, index, READ_SYNC)) {
if (PageUptodate(page))
goto out;

if (f2fs_readpage(sbi, page, index, READ_SYNC))
goto repeat;

lock_page(page);
if (page->mapping != mapping) {
f2fs_put_page(page, 1);
goto repeat;
}
out:
mark_page_accessed(page);

/* We do not allow returning an errorneous page */
return page;
}

Expand Down Expand Up @@ -541,54 +548,44 @@ void sync_dirty_dir_inodes(struct f2fs_sb_info *sbi)
*/
static void block_operations(struct f2fs_sb_info *sbi)
{
int t;
struct writeback_control wbc = {
.sync_mode = WB_SYNC_ALL,
.nr_to_write = LONG_MAX,
.for_reclaim = 0,
};
struct blk_plug plug;

/* Stop renaming operation */
mutex_lock_op(sbi, RENAME);
mutex_lock_op(sbi, DENTRY_OPS);
blk_start_plug(&plug);

retry_dents:
/* write all the dirty dentry pages */
sync_dirty_dir_inodes(sbi);
retry_flush_dents:
mutex_lock_all(sbi);

mutex_lock_op(sbi, DATA_WRITE);
/* write all the dirty dentry pages */
if (get_pages(sbi, F2FS_DIRTY_DENTS)) {
mutex_unlock_op(sbi, DATA_WRITE);
goto retry_dents;
mutex_unlock_all(sbi);
sync_dirty_dir_inodes(sbi);
goto retry_flush_dents;
}

/* block all the operations */
for (t = DATA_NEW; t <= NODE_TRUNC; t++)
mutex_lock_op(sbi, t);

mutex_lock(&sbi->write_inode);

/*
* POR: we should ensure that there is no dirty node pages
* until finishing nat/sit flush.
*/
retry:
sync_node_pages(sbi, 0, &wbc);

mutex_lock_op(sbi, NODE_WRITE);
retry_flush_nodes:
mutex_lock(&sbi->node_write);

if (get_pages(sbi, F2FS_DIRTY_NODES)) {
mutex_unlock_op(sbi, NODE_WRITE);
goto retry;
mutex_unlock(&sbi->node_write);
sync_node_pages(sbi, 0, &wbc);
goto retry_flush_nodes;
}
mutex_unlock(&sbi->write_inode);
blk_finish_plug(&plug);
}

static void unblock_operations(struct f2fs_sb_info *sbi)
{
int t;
for (t = NODE_WRITE; t >= RENAME; t--)
mutex_unlock_op(sbi, t);
mutex_unlock(&sbi->node_write);
mutex_unlock_all(sbi);
}

static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
Expand Down Expand Up @@ -727,9 +724,13 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
unsigned long long ckpt_ver;

trace_f2fs_write_checkpoint(sbi->sb, is_umount, "start block_ops");

mutex_lock(&sbi->cp_mutex);
block_operations(sbi);

trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish block_ops");

f2fs_submit_bio(sbi, DATA, true);
f2fs_submit_bio(sbi, NODE, true);
f2fs_submit_bio(sbi, META, true);
Expand All @@ -746,13 +747,13 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
flush_nat_entries(sbi);
flush_sit_entries(sbi);

reset_victim_segmap(sbi);

/* unlock all the fs_lock[] in do_checkpoint() */
do_checkpoint(sbi, is_umount);

unblock_operations(sbi);
mutex_unlock(&sbi->cp_mutex);

trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish checkpoint");
}

void init_orphan_info(struct f2fs_sb_info *sbi)
Expand Down
Loading

0 comments on commit 942d33d

Please sign in to comment.