1. 18 3月, 2014 2 次提交
  2. 28 2月, 2014 1 次提交
    • C
      f2fs: fix dirty page accounting when redirty · 9cf3c389
      Chao Yu 提交于
      We should de-account dirty counters for page when redirty in ->writepage().
      
      Wu Fengguang described in 'commit 971767ca':
      "writeback: fix dirtied pages accounting on redirty
      De-account the accumulative dirty counters on page redirty.
      
      Page redirties (very common in ext4) will introduce mismatch between
      counters (a) and (b)
      
      a) NR_DIRTIED, BDI_DIRTIED, tsk->nr_dirtied
      b) NR_WRITTEN, BDI_WRITTEN
      
      This will introduce systematic errors in balanced_rate and result in
      dirty page position errors (ie. the dirty pages are no longer balanced
      around the global/bdi setpoints)."
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      9cf3c389
  3. 24 2月, 2014 1 次提交
    • J
      f2fs: fix not to write data pages on the page reclaiming path · 8618b881
      Jaegeuk Kim 提交于
      Even if f2fs_write_data_page is called by the page reclaiming path, we should
      not write the page to provide enough free segments for the worst case scenario.
      Otherwise, f2fs can face with no free segment while gc is conducted, resulting
      in:
      
       ------------[ cut here ]------------
       kernel BUG at /home/zeus/f2fs_test/src/fs/f2fs/segment.c:565!
       RIP: 0010:[<ffffffffa02c3b11>]  [<ffffffffa02c3b11>] new_curseg+0x331/0x340 [f2fs]
       Call Trace:
        allocate_segment_by_default+0x204/0x280 [f2fs]
        allocate_data_block+0x108/0x210 [f2fs]
        write_data_page+0x8a/0xc0 [f2fs]
        do_write_data_page+0xe1/0x2a0 [f2fs]
        move_data_page+0x8a/0xf0 [f2fs]
        f2fs_gc+0x446/0x970 [f2fs]
        f2fs_balance_fs+0xb6/0xd0 [f2fs]
        f2fs_write_begin+0x50/0x350 [f2fs]
        ? unlock_page+0x27/0x30
        ? unlock_page+0x27/0x30
        generic_file_buffered_write+0x10a/0x280
        ? file_update_time+0xa3/0xf0
        __generic_file_aio_write+0x1c8/0x3d0
        ? generic_file_aio_write+0x52/0xb0
        ? generic_file_aio_write+0x52/0xb0
        generic_file_aio_write+0x65/0xb0
        do_sync_write+0x5a/0x90
        vfs_write+0xc5/0x1f0
        SyS_write+0x55/0xa0
        system_call_fastpath+0x16/0x1b
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      8618b881
  4. 17 2月, 2014 3 次提交
  5. 22 1月, 2014 1 次提交
  6. 20 1月, 2014 1 次提交
  7. 16 1月, 2014 2 次提交
    • C
      f2fs: missing REQ_META and REQ_PRIO when sync_meta_pages(META_FLUSH) · c434cbc0
      Changman Lee 提交于
      Doing sync_meta_pages with META_FLUSH when checkpoint, we overide rw
      using WRITE_FLUSH_FUA. At this time, we also should set
      REQ_META|REQ_PRIO.
      Signed-off-by: NChangman Lee <cm224.lee@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      c434cbc0
    • J
      f2fs: avoid f2fs_balance_fs call during pageout · c33ec326
      Jaegeuk Kim 提交于
      This patch should resolve the following bug.
      
      =========================================================
      [ INFO: possible irq lock inversion dependency detected ]
      3.13.0-rc5.f2fs+ #6 Not tainted
      ---------------------------------------------------------
      kswapd0/41 just changed the state of lock:
       (&sbi->gc_mutex){+.+.-.}, at: [<ffffffffa030503e>] f2fs_balance_fs+0xae/0xd0 [f2fs]
      but this lock took another, RECLAIM_FS-READ-unsafe lock in the past:
       (&sbi->cp_rwsem){++++.?}
      
      and interrupts could create inverse lock ordering between them.
      
      other info that might help us debug this:
      Chain exists of:
        &sbi->gc_mutex --> &sbi->cp_mutex --> &sbi->cp_rwsem
      
       Possible interrupt unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(&sbi->cp_rwsem);
                                     local_irq_disable();
                                     lock(&sbi->gc_mutex);
                                     lock(&sbi->cp_mutex);
        <Interrupt>
          lock(&sbi->gc_mutex);
      
       *** DEADLOCK ***
      
      This bug is due to the f2fs_balance_fs call in f2fs_write_data_page.
      If f2fs_write_data_page is triggered by wbc->for_reclaim via kswapd, it should
      not call f2fs_balance_fs which tries to get a mutex grabbed by original syscall
      flow.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      c33ec326
  8. 14 1月, 2014 1 次提交
  9. 06 1月, 2014 3 次提交
    • J
      f2fs: handle errors correctly during f2fs_reserve_block · a8865372
      Jaegeuk Kim 提交于
      The get_dnode_of_data nullifies inode and node page when error is occurred.
      
      There are two cases that passes inode page into get_dnode_of_data().
      
      1. make_empty_dir()
          -> get_new_data_page()
            -> f2fs_reserve_block(ipage)
      	-> get_dnode_of_data()
      
      2. f2fs_convert_inline_data()
          -> __f2fs_convert_inline_data()
            -> f2fs_reserve_block(ipage)
      	-> get_dnode_of_data()
      
      This patch adds correct error handling codes when get_dnode_of_data() returns
      an error.
      
      At first, f2fs_reserve_block() calls f2fs_put_dnode() whenever reserve_new_block
      returns an error.
      So, the rule of f2fs_reserve_block() is to nullify inode page when there is any
      error internally.
      
      Finally, two callers of f2fs_reserve_block() should call f2fs_put_dnode()
      appropriately if they got an error since successful f2fs_reserve_block().
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      a8865372
    • J
      f2fs: refactor f2fs_convert_inline_data · 9e09fc85
      Jaegeuk Kim 提交于
      Change log from v1:
       o handle NULL pointer of grab_cache_page_write_begin() pointed by Chao Yu.
      
      This patch refactors f2fs_convert_inline_data to check a couple of conditions
      internally for deciding whether it needs to convert inline_data or not.
      
      So, the new f2fs_convert_inline_data initially checks:
      1) f2fs_has_inline_data(), and
      2) the data size to be changed.
      
      If the inode has inline_data but the size to fill is less than MAX_INLINE_DATA,
      then we don't need to convert the inline_data with data allocation.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      9e09fc85
    • J
      f2fs: call f2fs_put_page at the error case · 26f466f4
      Jaegeuk Kim 提交于
      In f2fs_write_begin(), if f2fs_conver_inline_data() returns an error like
      -ENOSPC, f2fs should call f2fs_put_page().
      Otherwise, it is remained as a locked page, resulting in the following bug.
      
      [<ffffffff8114657e>] sleep_on_page+0xe/0x20
      [<ffffffff81146567>] __lock_page+0x67/0x70
      [<ffffffff81157d08>] truncate_inode_pages_range+0x368/0x5d0
      [<ffffffff81157ff5>] truncate_inode_pages+0x15/0x20
      [<ffffffff8115804b>] truncate_pagecache+0x4b/0x70
      [<ffffffff81158082>] truncate_setsize+0x12/0x20
      [<ffffffffa02a1842>] f2fs_setattr+0x72/0x270 [f2fs]
      [<ffffffff811cdae3>] notify_change+0x213/0x400
      [<ffffffff811ab376>] do_truncate+0x66/0xa0
      [<ffffffff811ab541>] vfs_truncate+0x191/0x1b0
      [<ffffffff811ab5bc>] do_sys_truncate+0x5c/0xa0
      [<ffffffff811ab78e>] SyS_truncate+0xe/0x10
      [<ffffffff81756052>] system_call_fastpath+0x16/0x1b
      [<ffffffffffffffff>] 0xffffffffffffffff
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      26f466f4
  10. 26 12月, 2013 3 次提交
    • H
      f2fs: handle inline data operations · 9ffe0fb5
      Huajun Li 提交于
      Hook inline data read/write, truncate, fallocate, setattr, etc.
      
      Files need meet following 2 requirement to inline:
       1) file size is not greater than MAX_INLINE_DATA;
       2) file doesn't pre-allocate data blocks by fallocate().
      
      FI_INLINE_DATA will not be set while creating a new regular inode because
      most of the files are bigger than ~3.4K. Set FI_INLINE_DATA only when
      data is submitted to block layer, ranther than set it while creating a new
      inode, this also avoids converting data from inline to normal data block
      and vice versa.
      
      While writting inline data to inode block, the first data block should be
      released if the file has a block indexed by i_addr[0].
      
      On the other hand, when a file operation is appied to a file with inline
      data, we need to test if this file can remain inline by doing this
      operation, otherwise it should be convert into normal file by reserving
      a new data block, copying inline data to this new block and clear
      FI_INLINE_DATA flag. Because reserve a new data block here will make use
      of i_addr[0], if we save inline data in i_addr[0..872], then the first
      4 bytes would be overwriten. This problem can be avoided simply by
      not using i_addr[0] for inline data.
      Signed-off-by: NHuajun Li <huajun.li@intel.com>
      Signed-off-by: NHaicheng Li <haicheng.li@linux.intel.com>
      Signed-off-by: NWeihong Xu <weihong.xu@intel.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      9ffe0fb5
    • J
      f2fs: check the blocksize before calling generic_direct_IO path · 944fcfc1
      Jaegeuk Kim 提交于
      The f2fs supports 4KB block size. If user requests dwrite with under 4KB data,
      it allocates a new 4KB data block.
      However, f2fs doesn't add zero data into the untouched data area inside the
      newly allocated data block.
      
      This incurs an error during the xfstest #263 test as follow.
      
      263 12s ... [failed, exit status 1] - output mismatch (see 263.out.bad)
      	--- 263.out	2013-03-09 03:37:15.043967603 +0900
      	+++ 263.out.bad	2013-12-27 04:20:39.230203114 +0900
      	@@ -1,3 +1,976 @@
      	QA output created by 263
      	fsx -N 10000 -o 8192 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z
      	-fsx -N 10000 -o 128000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z
      	+fsx -N 10000 -o 8192 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z
      	+truncating to largest ever: 0x12a00
      	+truncating to largest ever: 0x75400
      	+fallocating to largest ever: 0x79cbf
      	...
      	(Run 'diff -u 263.out 263.out.bad' to see the entire diff)
      	Ran: 263
      	Failures: 263
      	Failed 1 of 1 tests
      
      It turns out that, when the test tries to write 2KB data with dio, the new dio
      path allocates 4KB data block without filling zero data inside the remained 2KB
      area. Finally, the output file contains a garbage data for that region.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      944fcfc1
    • J
      f2fs: should put the dnode when NEW_ADDR is detected · 1ec79083
      Jaegeuk Kim 提交于
      When get_dnode_of_data() in get_data_block() returns a successful dnode, we
      should put the dnode.
      But, previously, if its data block address is equal to NEW_ADDR, we didn't do
      that, resulting in a deadlock condition.
      So, this patch splits original error conditions with this case, and then calls
      f2fs_put_dnode before finishing the function.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      1ec79083
  11. 23 12月, 2013 19 次提交
  12. 24 11月, 2013 2 次提交
    • K
      block: Abstract out bvec iterator · 4f024f37
      Kent Overstreet 提交于
      Immutable biovecs are going to require an explicit iterator. To
      implement immutable bvecs, a later patch is going to add a bi_bvec_done
      member to this struct; for now, this patch effectively just renames
      things.
      Signed-off-by: NKent Overstreet <kmo@daterainc.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: "Ed L. Cashin" <ecashin@coraid.com>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Geoff Levand <geoff@infradead.org>
      Cc: Yehuda Sadeh <yehuda@inktank.com>
      Cc: Sage Weil <sage@inktank.com>
      Cc: Alex Elder <elder@inktank.com>
      Cc: ceph-devel@vger.kernel.org
      Cc: Joshua Morris <josh.h.morris@us.ibm.com>
      Cc: Philip Kelleher <pjk1939@linux.vnet.ibm.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: Neil Brown <neilb@suse.de>
      Cc: Alasdair Kergon <agk@redhat.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: dm-devel@redhat.com
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: linux390@de.ibm.com
      Cc: Boaz Harrosh <bharrosh@panasas.com>
      Cc: Benny Halevy <bhalevy@tonian.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Jaegeuk Kim <jaegeuk.kim@samsung.com>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Cc: Dave Kleikamp <shaggy@kernel.org>
      Cc: Joern Engel <joern@logfs.org>
      Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Ben Myers <bpm@sgi.com>
      Cc: xfs@oss.sgi.com
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Guo Chao <yan@linux.vnet.ibm.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Asai Thambi S P <asamymuthupa@micron.com>
      Cc: Selvan Mani <smani@micron.com>
      Cc: Sam Bradshaw <sbradshaw@micron.com>
      Cc: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
      Cc: "Roger Pau Monné" <roger.pau@citrix.com>
      Cc: Jan Beulich <jbeulich@suse.com>
      Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
      Cc: Ian Campbell <Ian.Campbell@citrix.com>
      Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Jiang Liu <jiang.liu@huawei.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Jerome Marchand <jmarchand@redhat.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Peng Tao <tao.peng@emc.com>
      Cc: Andy Adamson <andros@netapp.com>
      Cc: fanchaoting <fanchaoting@cn.fujitsu.com>
      Cc: Jie Liu <jeff.liu@oracle.com>
      Cc: Sunil Mushran <sunil.mushran@gmail.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Namjae Jeon <namjae.jeon@samsung.com>
      Cc: Pankaj Kumar <pankaj.km@samsung.com>
      Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
      Cc: Mel Gorman <mgorman@suse.de>6
      4f024f37
    • K
      block: Convert various code to bio_for_each_segment() · 2c30c71b
      Kent Overstreet 提交于
      With immutable biovecs we don't want code accessing bi_io_vec directly -
      the uses this patch changes weren't incorrect since they all own the
      bio, but it makes the code harder to audit for no good reason - also,
      this will help with multipage bvecs later.
      Signed-off-by: NKent Overstreet <kmo@daterainc.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Jaegeuk Kim <jaegeuk.kim@samsung.com>
      Cc: Joern Engel <joern@logfs.org>
      Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      2c30c71b
  13. 29 10月, 2013 1 次提交