28 Feb, 2017

1 commit

  • Replace all 1 << inode->i_blkbits and (1 << inode->i_blkbits) in fs
    branch.

    This patch also fixes multiple checkpatch warnings: WARNING: Prefer
    'unsigned int' to bare use of 'unsigned'

    Thanks to Andrew Morton for suggesting more appropriate function instead
    of macro.

    [geliangtang@gmail.com: truncate: use i_blocksize()]
    Link: http://lkml.kernel.org/r/9c8b2cd83c8f5653805d43debde9fa8817e02fc4.1484895804.git.geliangtang@gmail.com
    Link: http://lkml.kernel.org/r/1481319905-10126-1-git-send-email-fabf@skynet.be
    Signed-off-by: Fabian Frederick
    Signed-off-by: Geliang Tang
    Cc: Alexander Viro
    Cc: Ross Zwisler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabian Frederick
     

03 Aug, 2016

1 commit

  • Replace bit shifts by BIT macro for clarity.

    Link: http://lkml.kernel.org/r/1465825507-3407-3-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     

08 Jun, 2016

1 commit


24 May, 2016

2 commits

  • E-mail addresses of osrg.net domain are no longer available. This
    removes them from authorship notices and prevents reporters from being
    confused.

    Link: http://lkml.kernel.org/r/1461935747-10380-5-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • This removes the extra paragraph which mentions FSF address in GPL
    notices from source code of nilfs2 and avoids the checkpatch.pl error
    related to it.

    Link: http://lkml.kernel.org/r/1461935747-10380-4-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     

05 Apr, 2016

1 commit

  • PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
    ago with promise that one day it will be possible to implement page
    cache with bigger chunks than PAGE_SIZE.

    This promise never materialized. And unlikely will.

    We have many places where PAGE_CACHE_SIZE assumed to be equal to
    PAGE_SIZE. And it's constant source of confusion on whether
    PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
    especially on the border between fs and mm.

    Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
    breakage to be doable.

    Let's stop pretending that pages in page cache are special. They are
    not.

    The changes are pretty straight-forward:

    - << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};

    - page_cache_get() -> get_page();

    - page_cache_release() -> put_page();

    This patch contains automated changes generated with coccinelle using
    script below. For some reason, coccinelle doesn't patch header files.
    I've called spatch for them manually.

    The only adjustment after coccinelle is revert of changes to
    PAGE_CAHCE_ALIGN definition: we are going to drop it later.

    There are few places in the code where coccinelle didn't reach. I'll
    fix them manually in a separate patch. Comments and documentation also
    will be addressed with the separate patch.

    virtual patch

    @@
    expression E;
    @@
    - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    expression E;
    @@
    - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    @@
    - PAGE_CACHE_SHIFT
    + PAGE_SHIFT

    @@
    @@
    - PAGE_CACHE_SIZE
    + PAGE_SIZE

    @@
    @@
    - PAGE_CACHE_MASK
    + PAGE_MASK

    @@
    expression E;
    @@
    - PAGE_CACHE_ALIGN(E)
    + PAGE_ALIGN(E)

    @@
    expression E;
    @@
    - page_cache_get(E)
    + get_page(E)

    @@
    expression E;
    @@
    - page_cache_release(E)
    + put_page(E)

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     

10 May, 2011

3 commits


10 Mar, 2011

2 commits


24 Feb, 2011

1 commit

  • Michael Leun reported that running parallel opens on a fuse filesystem
    can trigger a "kernel BUG at mm/truncate.c:475"

    Gurudas Pai reported the same bug on NFS.

    The reason is, unmap_mapping_range() is not prepared for more than
    one concurrent invocation per inode. For example:

    thread1: going through a big range, stops in the middle of a vma and
    stores the restart address in vm_truncate_count.

    thread2: comes in with a small (e.g. single page) unmap request on
    the same vma, somewhere before restart_address, finds that the
    vma was already unmapped up to the restart address and happily
    returns without doing anything.

    Another scenario would be two big unmap requests, both having to
    restart the unmapping and each one setting vm_truncate_count to its
    own value. This could go on forever without any of them being able to
    finish.

    Truncate and hole punching already serialize with i_mutex. Other
    callers of unmap_mapping_range() do not, and it's difficult to get
    i_mutex protection for all callers. In particular ->d_revalidate(),
    which calls invalidate_inode_pages2_range() in fuse, may be called
    with or without i_mutex.

    This patch adds a new mutex to 'struct address_space' to prevent
    running multiple concurrent unmap_mapping_range() on the same mapping.

    [ We'll hopefully get rid of all this with the upcoming mm
    preemptibility series by Peter Zijlstra, the "mm: Remove i_mmap_mutex
    lockbreak" patch in particular. But that is for 2.6.39 ]

    Signed-off-by: Miklos Szeredi
    Reported-by: Michael Leun
    Reported-by: Gurudas Pai
    Tested-by: Gurudas Pai
    Acked-by: Hugh Dickins
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

10 Jan, 2011

1 commit

  • nilfs_dat_inode function was a wrapper to switch between normal dat
    inode and gcdat, a clone of the dat inode for garbage collection.

    This function got obsolete when the gcdat inode was removed, and now
    we can access the dat inode directly from a nilfs object. So, we will
    unfold the wrapper and remove it.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

23 Oct, 2010

1 commit

  • This adds optional function to metadata files which makes a copy of
    bmap, page caches, and b-tree node cache, and rolls back to the copy
    as needed.

    This enhancement is intended to displace gcdat inode that provides a
    similar function in a different way.

    In this patch, nilfs_shadow_map structure is added to store a copy of
    the foregoing states. nilfs_mdt_setup_shadow_map relates this
    structure to a metadata file. And, nilfs_mdt_save_to_shadow_map() and
    nilfs_mdt_restore_from_shadow_map() provides save and restore
    functions respectively. Finally, nilfs_mdt_clear_shadow_map() clears
    states of nilfs_shadow_map.

    The copy of b-tree node cache and page cache is made by duplicating
    only dirty pages into corresponding caches in nilfs_shadow_map. Their
    restoration is done by clearing dirty pages from original caches and
    by copying dirty pages back from nilfs_shadow_map.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

23 Jul, 2010

2 commits

  • This adds mode argument to nilfs_btnode_submit_block() function and
    allows it to issue a read-ahead request.

    An optional submit_ptr argument is also added to store the actual
    block address for which bio is sent. submit_ptr is used for a series
    of read-ahead requests, and helps to decide if each requested block is
    continous to the previous one on disk.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • nilfs_btnode_submit_block() refers to buffer head just before
    returning from the function, but it releases the buffer head earlier
    than that if nilfs_dat_translate() gets an error.

    This has potential for oops in the erroneous case. This fixes the
    issue.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

20 Nov, 2009

4 commits


03 Nov, 2009

2 commits


29 Sep, 2009

1 commit

  • This will fix file system corruption which infrequently happens after
    mount. The problem was reported from users with the title "[NILFS
    users] Fail to mount NILFS." (Message-ID:
    ), and so forth. I've also
    experienced the corruption multiple times on kernel 2.6.30 and 2.6.31.

    The problem turned out to be caused due to discordance between
    mapping->nrpages of a btree node cache and the actual number of pages
    hung on the cache; if the mapping->nrpages becomes zero even as it has
    pages, truncate_inode_pages() returns without doing anything. Usually
    this is harmless except it may cause page leak, but garbage collection
    fairly infrequently sees a stale page remained in the btree node cache
    of DAT (i.e. disk address translation file of nilfs), and induces the
    corruption.

    I identified a missing initialization in btree node caches was the
    root cause. This corrects the bug.

    I've tested this for kernel 2.6.30 and 2.6.31.

    Reported-by: Yuri Chislov
    Signed-off-by: Ryusuke Konishi
    Cc: stable

    Ryusuke Konishi
     

22 Sep, 2009

1 commit


31 Aug, 2009

1 commit

  • This will fix the following preempt count underflow reported from
    users with the title "[NILFS users] segctord problem" (Message-ID:
    and Message-ID:
    ):

    WARNING: at kernel/sched.c:4890 sub_preempt_count+0x95/0xa0()
    Hardware name: HP Compaq 6530b (KR980UT#ABC)
    Modules linked in: bridge stp llc bnep rfcomm l2cap xfs exportfs nilfs2 cowloop loop vboxnetadp vboxnetflt vboxdrv btusb bluetooth uvcvideo videodev v4l1_compat v4l2_compat_ioctl32 arc4 snd_hda_codec_analog ecb iwlagn iwlcore rfkill lib80211 mac80211 snd_hda_intel snd_hda_codec ehci_hcd uhci_hcd usbcore snd_hwdep snd_pcm tg3 cfg80211 psmouse snd_timer joydev libphy ohci1394 snd_page_alloc hp_accel lis3lv02d ieee1394 led_class i915 drm i2c_algo_bit video backlight output i2c_core dm_crypt dm_mod
    Pid: 4197, comm: segctord Not tainted 2.6.30-gentoo-r4-64 #7
    Call Trace:
    [] ? sub_preempt_count+0x95/0xa0
    [] warn_slowpath_common+0x78/0xd0
    [] warn_slowpath_null+0xf/0x20
    [] sub_preempt_count+0x95/0xa0
    [] nilfs_btnode_prepare_change_key+0x11b/0x190 [nilfs2]
    [] nilfs_btree_assign_p+0x19d/0x1e0 [nilfs2]
    [] nilfs_btree_assign+0xbd/0x130 [nilfs2]
    [] nilfs_bmap_assign+0x47/0x70 [nilfs2]
    [] nilfs_segctor_do_construct+0x956/0x20f0 [nilfs2]
    [] ? _spin_unlock_irqrestore+0x12/0x40
    [] ? __up_write+0xe0/0x150
    [] ? up_write+0x9/0x10
    [] ? nilfs_bmap_test_and_clear_dirty+0x43/0x60 [nilfs2]
    [] ? nilfs_mdt_fetch_dirty+0x27/0x60 [nilfs2]
    [] nilfs_segctor_construct+0x8c/0xd0 [nilfs2]
    [] nilfs_segctor_thread+0x15c/0x3a0 [nilfs2]
    [] ? nilfs_construction_timeout+0x0/0x10 [nilfs2]
    [] ? add_timer+0x13/0x20
    [] ? __wake_up_common+0x5a/0x90
    [] ? autoremove_wake_function+0x0/0x40
    [] ? nilfs_segctor_thread+0x0/0x3a0 [nilfs2]
    [] ? nilfs_segctor_thread+0x0/0x3a0 [nilfs2]
    [] kthread+0x56/0x90
    [] child_rip+0xa/0x20
    [] ? kthread+0x0/0x90
    [] ? child_rip+0x0/0x20

    This problem was caused due to a missing radix_tree_preload() call in
    the retry path of nilfs_btnode_prepare_change_key() function.

    Reported-by: Eric A
    Reported-by: Jerome Poulin
    Signed-off-by: Ryusuke Konishi
    Tested-by: Jerome Poulin
    Cc: stable@kernel.org

    Ryusuke Konishi
     

10 Jun, 2009

2 commits


07 Apr, 2009

1 commit