13 Aug, 2020

2 commits

  • Add macros for nilfs_(sb, fmt, ...) and convert the uses of
    'nilfs_msg(sb, KERN_, ...)' to 'nilfs_(sb, ...)' so nilfs2
    uses a logging style more like the typical kernel logging style.

    Miscellanea:

    o Realign arguments for these uses

    Signed-off-by: Joe Perches
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Link: http://lkml.kernel.org/r/1595860111-3920-4-git-send-email-konishi.ryusuke@gmail.com
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Reduce object size a bit by removing the KERN_ as a separate
    argument and adding it to the format string.

    Reduce overall object size by about ~.5% (x86-64 defconfig w/ nilfs2)

    old:
    $ size -t fs/nilfs2/built-in.a | tail -1
    191738 8676 44 200458 30f0a (TOTALS)

    new:
    $ size -t fs/nilfs2/built-in.a | tail -1
    190971 8676 44 199691 30c0b (TOTALS)

    Signed-off-by: Joe Perches
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Link: http://lkml.kernel.org/r/1595860111-3920-3-git-send-email-konishi.ryusuke@gmail.com
    Signed-off-by: Linus Torvalds

    Joe Perches
     

02 May, 2019

1 commit


05 Sep, 2018

1 commit

  • Remove the verbose license text from NILFS2 files and replace them with
    SPDX tags. This does not change the license of any of the code.

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

    Ryusuke Konishi
     

03 Aug, 2016

5 commits

  • The header file "include/linux/nilfs2_fs.h" is composed of parts for
    ioctl and disk format, and both are intended to be shared with user
    space programs.

    This moves them to the uapi directory "include/uapi/linux" splitting the
    file to "nilfs2_api.h" and "nilfs2_ondisk.h". The following minor
    changes are accompanied by this migration:

    - nilfs_direct_node struct in nilfs2/direct.h is converged to
    nilfs2_ondisk.h because it's an on-disk structure.
    - inline functions nilfs_rec_len_from_disk() and
    nilfs_rec_len_to_disk() are moved to nilfs2/dir.c.

    Link: http://lkml.kernel.org/r/1465825507-3407-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
     
  • 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
     
  • Use nilfs_msg() to output warning messages and get rid of
    nilfs_warning() function. This also removes function names from the
    messages unless we embed them explicitly in format strings. Instead,
    some messages are revised to clarify the context.

    [arnd@arndb.de: avoid warning about unused variables]
    Link: http://lkml.kernel.org/r/20160615201945.3348205-1-arnd@arndb.de
    Link: http://lkml.kernel.org/r/1464875891-5443-6-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
     
  • Define an own output routine to replace bare use of printk() function.
    The output routine is implemented with a macro and a helper function,
    which are named nilfs_msg() and __nilfs_msg(), respectively.

    __nilfs_msg() formats a message like "NILFS (): ",
    prefixing it with a given log level, and terminates the statement with a
    newline. The "device-name" is optional to make it available in early
    stages; it will be omitted if a NULL pointer is passed to super block
    instance argument. nilfs_msg() wraps __nilfs_msg() and is removed if
    CONFIG_PRINTK is not set.

    Link: http://lkml.kernel.org/r/1464875891-5443-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
     
  • Simplify nilfs_error(), an output function used to report critical
    issues in file system. This renames the original nilfs_error() function
    to __nilfs_error() and redefines it as a macro to hide its function name
    argument within the macro.

    Every call site of nilfs_error() is changed to strip __func__ argument
    except nilfs_bmap_convert_error(); nilfs_bmap_convert_error() directly
    calls __nilfs_error() because it inherits caller's function name.

    Link: http://lkml.kernel.org/r/1464875891-5443-2-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
     

24 May, 2016

4 commits

  • This fixes block comments with proper formatting to eliminate the
    following checkpatch.pl warnings:

    "WARNING: Block comments use * on subsequent lines"
    "WARNING: Block comments use a trailing */ on a separate line"

    Link: http://lkml.kernel.org/r/1462886671-3521-8-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 fixes checkpatch.pl warning "WARNING: Prefer 'unsigned int' to
    bare use of 'unsigned'".

    Link: http://lkml.kernel.org/r/1462886671-3521-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
     
  • 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
     

06 Feb, 2015

1 commit

  • Nilfs2 eventually hangs in a stress test with fsstress program. This
    issue was caused by the following deadlock over I_SYNC flag between
    nilfs_segctor_thread() and writeback_sb_inodes():

    nilfs_segctor_thread()
    nilfs_segctor_thread_construct()
    nilfs_segctor_unlock()
    nilfs_dispose_list()
    iput()
    iput_final()
    evict()
    inode_wait_for_writeback() * wait for I_SYNC flag

    writeback_sb_inodes()
    * set I_SYNC flag on inode->i_state
    __writeback_single_inode()
    do_writepages()
    nilfs_writepages()
    nilfs_construct_dsync_segment()
    nilfs_segctor_sync()
    * wait for completion of segment constructor
    inode_sync_complete()
    * clear I_SYNC flag after __writeback_single_inode() completed

    writeback_sb_inodes() calls do_writepages() for dirty inodes after
    setting I_SYNC flag on inode->i_state. do_writepages() in turn calls
    nilfs_writepages(), which can run segment constructor and wait for its
    completion. On the other hand, segment constructor calls iput(), which
    can call evict() and wait for the I_SYNC flag on
    inode_wait_for_writeback().

    Since segment constructor doesn't know when I_SYNC will be set, it
    cannot know whether iput() will block or not unless inode->i_nlink has a
    non-zero count. We can prevent evict() from being called in iput() by
    implementing sop->drop_inode(), but it's not preferable to leave inodes
    with i_nlink == 0 for long periods because it even defers file
    truncation and inode deallocation. So, this instead resolves the
    deadlock by calling iput() asynchronously with a workqueue for inodes
    with i_nlink == 0.

    Signed-off-by: Ryusuke Konishi
    Cc: Al Viro
    Tested-by: Ryusuke Konishi
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     

14 Oct, 2014

1 commit

  • Support for fdatasync() has been implemented in NILFS2 for a long time,
    but whenever the corresponding inode is dirty the implementation falls
    back to a full-flegded sync(). Since every write operation has to
    update the modification time of the file, the inode will almost always
    be dirty and fdatasync() will fall back to sync() most of the time. But
    this fallback is only necessary for a change of the file size and not
    for a change of the various timestamps.

    This patch adds a new flag NILFS_I_INODE_SYNC to differentiate between
    those two situations.

    * If it is set the file size was changed and a full sync is necessary.
    * If it is not set then only the timestamps were updated and
    fdatasync() can go ahead.

    There is already a similar flag I_DIRTY_DATASYNC on the VFS layer with
    the exact same semantics. Unfortunately it cannot be used directly,
    because NILFS2 doesn't implement write_inode() and doesn't clear the VFS
    flags when inodes are written out. So the VFS writeback thread can
    clear I_DIRTY_DATASYNC at any time without notifying NILFS2. So
    I_DIRTY_DATASYNC has to be mapped onto NILFS_I_INODE_SYNC in
    nilfs_update_inode().

    Signed-off-by: Andreas Rohner
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andreas Rohner
     

09 Aug, 2014

1 commit

  • This patch integrates creation of sysfs groups and
    attributes into NILFS file system driver.

    It was found the issue with nilfs_sysfs_{create/delete}_snapshot_group
    functions by Michael L Semon in the first
    version of the patch:

    BUG: sleeping function called from invalid context at kernel/locking/mutex.c:579
    in_atomic(): 1, irqs_disabled(): 0, pid: 32676, name: umount.nilfs2
    2 locks held by umount.nilfs2/32676:
    #0: (&type->s_umount_key#21){++++..}, at: [] deactivate_super+0x37/0x58
    #1: (&(&nilfs->ns_cptree_lock)->rlock){+.+...}, at: [] nilfs_put_root+0x23/0x5a
    Preemption disabled at:[] nilfs_put_root+0x23/0x5a

    CPU: 0 PID: 32676 Comm: umount.nilfs2 Not tainted 3.14.0+ #2
    Hardware name: Dell Computer Corporation Dimension 2350/07W080, BIOS A01 12/17/2002
    Call Trace:
    dump_stack+0x4b/0x75
    __might_sleep+0x111/0x16f
    mutex_lock_nested+0x1e/0x3ad
    kernfs_remove+0x12/0x26
    sysfs_remove_dir+0x3d/0x62
    kobject_del+0x13/0x38
    nilfs_sysfs_delete_snapshot_group+0xb/0xd
    nilfs_put_root+0x2a/0x5a
    nilfs_detach_log_writer+0x1ab/0x2c1
    nilfs_put_super+0x13/0x68
    generic_shutdown_super+0x60/0xd1
    kill_block_super+0x1d/0x60
    deactivate_locked_super+0x22/0x3f
    deactivate_super+0x3e/0x58
    mntput_no_expire+0xe2/0x141
    SyS_oldumount+0x70/0xa5
    syscall_call+0x7/0xb

    The reason of the issue was placement of
    nilfs_sysfs_{create/delete}_snapshot_group() call under
    nilfs->ns_cptree_lock protection. But this protection is unnecessary and
    wrong solution. The second version of the patch fixes this issue.

    [fengguang.wu@intel.com: nilfs_sysfs_create_mounted_snapshots_group can be static]
    Reported-by: Michael L. Semon
    Signed-off-by: Vyacheslav Dubeyko
    Cc: Vyacheslav Dubeyko
    Cc: Ryusuke Konishi
    Tested-by: Michael L. Semon
    Signed-off-by: Fengguang Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vyacheslav Dubeyko
     

21 Dec, 2012

1 commit


31 Jul, 2012

1 commit


04 Jan, 2012

1 commit


01 Nov, 2011

1 commit

  • Standardize the style for compiler based printf format verification.
    Standardized the location of __printf too.

    Done via script and a little typing.

    $ grep -rPl --include=*.[ch] -w "__attribute__" * | \
    grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
    xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'

    [akpm@linux-foundation.org: revert arch bits]
    Signed-off-by: Joe Perches
    Cc: "Kirill A. Shutemov"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

21 Jul, 2011

1 commit

  • Btrfs needs to be able to control how filemap_write_and_wait_range() is called
    in fsync to make it less of a painful operation, so push down taking i_mutex and
    the calling of filemap_write_and_wait() down into the ->fsync() handlers. Some
    file systems can drop taking the i_mutex altogether it seems, like ext3 and
    ocfs2. For correctness sake I just pushed everything down in all cases to make
    sure that we keep the current behavior the same for everybody, and then each
    individual fs maintainer can make up their mind about what to do from there.
    Thanks,

    Acked-by: Jan Kara
    Signed-off-by: Josef Bacik
    Signed-off-by: Al Viro

    Josef Bacik
     

20 Jul, 2011

1 commit


27 May, 2011

1 commit

  • Tell the filesystem if we just updated timestamp (I_DIRTY_SYNC) or
    anything else, so that the filesystem can track internally if it
    needs to push out a transaction for fdatasync or not.

    This is just the prototype change with no user for it yet. I plan
    to push large XFS changes for the next merge window, and getting
    this trivial infrastructure in this window would help a lot to avoid
    tree interdependencies.

    Also remove incorrect comments that ->dirty_inode can't block. That
    has been changed a long time ago, and many implementations rely on it.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

10 May, 2011

2 commits


30 Mar, 2011

1 commit


09 Mar, 2011

2 commits

  • This directly uses sb->s_fs_info to keep a nilfs filesystem object and
    fully removes the intermediate nilfs_sb_info structure. With this
    change, the hierarchy of on-memory structures of nilfs will be
    simplified as follows:

    Before:
    super_block
    -> nilfs_sb_info
    -> the_nilfs
    -> cptree --+-> nilfs_root (current file system)
    +-> nilfs_root (snapshot A)
    +-> nilfs_root (snapshot B)
    :
    -> nilfs_sc_info (log writer structure)
    After:
    super_block
    -> the_nilfs
    -> cptree --+-> nilfs_root (current file system)
    +-> nilfs_root (snapshot A)
    +-> nilfs_root (snapshot B)
    :
    -> nilfs_sc_info (log writer structure)

    The reason why we didn't design so from the beginning is because the
    initial shape also differed from the above. The early hierachy was
    composed of "per-mount-point" super_block -> nilfs_sb_info pairs and a
    shared nilfs object. On the kernel 2.6.37, it was changed to the
    current shape in order to unify super block instances into one per
    device, and this cleanup became applicable as the result.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This replaces sbi uses with direct reference to sb instance.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

08 Mar, 2011

3 commits

  • This records the number of used blocks per checkpoint in each
    checkpoint entry of cpfile. Even though userland tools can get the
    block count via nilfs_get_cpinfo ioctl, it was not updated by the
    nilfs2 kernel code. This fixes the issue and makes it available for
    userland tools to calculate used amount per checkpoint.

    Signed-off-by: Ryusuke Konishi
    Cc: Jiro SEKIBA

    Ryusuke Konishi
     
  • The current FS_IOC_GETFLAGS/SETFLAGS/GETVERSION will fail if
    application is 32 bit and kernel is 64 bit.

    This issue is avoidable by adding compat_ioctl method.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • Nilfs has few rectrictions on which flags may be set on which inodes
    like ext2/3/4 filesystems used to be. Specifically DIRSYNC may only
    be set on directories and IMMUTABLE and APPEND may not be set on
    links. Tighten that to disallow TOPDIR being set on non-directories
    and only NODUMP and NOATIME to be set on non-regular file,
    non-directories.

    This introduces a flags masking function like those of extN and uses
    it during inode creation.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

10 Jan, 2011

3 commits

  • 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
     
  • This removes argument for passing nilfs_sb_info structure from
    nilfs_set_file_dirty and nilfs_load_inode_block functions. We can get
    a pointer to the structure from inodes.

    [Stephen Rothwell : fix conflict with commit
    b74c79e99389cd79b31fcc08f82c24e492e63c7e]

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This adds fiemap to nilfs. Two new functions, nilfs_fiemap and
    nilfs_find_uncommitted_extent are added.

    nilfs_fiemap() implements the fiemap inode operation, and
    nilfs_find_uncommitted_extent() helps to get a range of data blocks
    whose physical location has not been determined.

    nilfs_fiemap() collects extent information by looping through
    nilfs_bmap_lookup_contig and nilfs_find_uncommitted_extent routines.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

07 Jan, 2011

1 commit


23 Oct, 2010

5 commits