03 Aug, 2016

3 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
     
  • Replace most use of printk() in nilfs2 implementation with nilfs_msg(),
    and reduce the following checkpatch.pl warning:

    "WARNING: Prefer [subsystem eg: netdev]_crit([subsystem]dev, ...
    then dev_crit(dev, ... then pr_crit(... to printk(KERN_CRIT ..."

    This patch also fixes a minor checkpatch warning "WARNING: quoted string
    split across lines" that often accompanies the prior warning, and amends
    message format as needed.

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

24 May, 2016

4 commits

  • Clean up checkpatch.pl warnings "WARNING: Missing a blank line after
    declarations" from nilfs2.

    Link: http://lkml.kernel.org/r/1461935747-10380-11-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
     
  • Fix checkpatch.pl error "ERROR: space prohibited before that ','
    (ctx:WxW)" at nilfs_sufile_set_suinfo().

    This also fixes checkpatch.pl warning "WARNING: Prefer 'unsigned int' to
    bare use of 'unsigned'" at nilfs_sufile_set_suinfo() and
    nilfs_sufile_get_suinfo().

    Link: http://lkml.kernel.org/r/1461935747-10380-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
     

07 Nov, 2015

2 commits

  • Fix the following build warnings:

    $ make W=1
    [...]
    CC [M] fs/nilfs2/btree.o
    fs/nilfs2/btree.c: In function 'nilfs_btree_split':
    fs/nilfs2/btree.c:923:8: warning: variable 'newptr' set but not used [-Wunused-but-set-variable]
    __u64 newptr;
    ^
    fs/nilfs2/btree.c:922:8: warning: variable 'newkey' set but not used [-Wunused-but-set-variable]
    __u64 newkey;
    ^
    CC [M] fs/nilfs2/dat.o
    fs/nilfs2/dat.c: In function 'nilfs_dat_prepare_end':
    fs/nilfs2/dat.c:158:8: warning: variable 'start' set but not used [-Wunused-but-set-variable]
    __u64 start;
    ^
    CC [M] fs/nilfs2/segment.o
    fs/nilfs2/segment.c: In function 'nilfs_segctor_do_immediate_flush':
    fs/nilfs2/segment.c:2433:6: warning: variable 'err' set but not used [-Wunused-but-set-variable]
    int err;
    ^
    CC [M] fs/nilfs2/sufile.o
    fs/nilfs2/sufile.c: In function 'nilfs_sufile_alloc':
    fs/nilfs2/sufile.c:320:27: warning: variable 'ncleansegs' set but not used [-Wunused-but-set-variable]
    unsigned long nsegments, ncleansegs, nsus, cnt;
    ^
    CC [M] fs/nilfs2/alloc.o
    fs/nilfs2/alloc.c: In function 'nilfs_palloc_prepare_alloc_entry':
    fs/nilfs2/alloc.c:478:38: warning: variable 'groups_per_desc_block' set but not used [-Wunused-but-set-variable]
    unsigned long n, entries_per_group, groups_per_desc_block;
    ^

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

    Ryusuke Konishi
     
  • This patch adds tracepoints which would be useful for analyzing segment
    usage from a perspective of high level sufile manipulation (check, alloc,
    free). sufile is an important in-place updated metadata file, so
    analyzing the behavior would be useful for performance turning.

    example of usage (a case of allocation):

    $ sudo bin/tpoint nilfs2:nilfs2_segment_usage_allocated
    Tracing nilfs2:nilfs2_segment_usage_allocated. Ctrl-C to end.
    segctord-17800 [002] ...1 10671.867294: nilfs2_segment_usage_allocated: sufile = ffff880054f908a8 segnum = 2
    segctord-17800 [002] ...1 10675.073477: nilfs2_segment_usage_allocated: sufile = ffff880054f908a8 segnum = 3

    Signed-off-by: Hitoshi Mitake
    Signed-off-by: Ryusuke Konishi
    Cc: Steven Rostedt
    Cc: Benixon Dhas
    Cc: TK Kato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hitoshi Mitake
     

04 Apr, 2014

3 commits

  • Add code to check sizes of on-disk data of metadata files such as inode
    size, segment usage size, DAT entry size, and checkpoint size. Although
    these sizes are read from disk, the current implementation doesn't check
    them.

    If these sizes are not sane on disk, it can cause out-of-range access to
    metadata or memory access overrun on metadata block buffers due to
    overflow in sundry calculations.

    Both lower limit and upper limit of metadata sizes are verified to
    prevent these issues.

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

    Ryusuke Konishi
     
  • Add nilfs_sufile_trim_fs(), which takes an fstrim_range structure and
    calls blkdev_issue_discard for every clean segment in the specified
    range. The range is truncated to file system block boundaries.

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

    Andreas Rohner
     
  • Introduce nilfs_sufile_set_suinfo(), which expects an array of
    nilfs_suinfo_update structures and updates the segment usage information
    accordingly.

    This is basically a helper function for the newly introduced
    NILFS_IOCTL_SET_SUINFO ioctl.

    [konishi.ryusuke@lab.ntt.co.jp: use put_bh() instead of brelse() because we know bh != NULL]
    Signed-off-by: Andreas Rohner
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andreas Rohner
     

31 Jul, 2012

1 commit


20 Mar, 2012

1 commit


10 May, 2011

5 commits


23 Oct, 2010

2 commits


14 Mar, 2010

1 commit


20 Nov, 2009

8 commits


10 Jun, 2009

2 commits

  • Nilfs has some ioctl commands to read out metadata from meta data
    files:

    - NILFS_IOCTL_GET_CPINFO for checkpoint file,
    - NILFS_IOCTL_GET_SUINFO for segment usage file, and
    - NILFS_IOCTL_GET_VINFO for Disk Address Transalation (DAT) file,
    respectively.

    Every routine on these metadata files is implemented so that it allows
    future expansion of on-disk format. But, the above ioctl commands do
    not support expansion even though nilfs_argv structure can handle
    arbitrary size for data exchanged via ioctl.

    This allows future expansion of the following structures which give
    basic format of the "get information" ioctls:

    - struct nilfs_cpinfo
    - struct nilfs_suinfo
    - struct nilfs_vinfo

    So, this introduces forward compatility of such ioctl commands.

    In this patch, a sanity check in nilfs_ioctl_get_info() function is
    changed to accept larger data structure [1], and metadata read
    routines are rewritten so that they become compatible for larger
    structures; the routines will just ignore the remaining fields which
    the current version of nilfs doesn't know.

    [1] The ioctl function already has another upper limit (PAGE_SIZE
    against a structure, which appears in nilfs_ioctl_wrap_copy
    function), and this will not cause security problem.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This is a preparation for the later cleanup patch ("nilfs2: remove
    list of freeing segments").

    This adds nilfs_sufile_updatev() to sufile, which can modify multiple
    segment usages at a time.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

13 Apr, 2009

4 commits

  • On-disk counters ndirtysegs and ncleansegs of sufile, can go wrong
    after roll-forward recovery because
    nilfs_prepare_segment_for_recovery() function marks segments dirty
    without adjusting value of these counters.

    This fixes the problem by adding a function to sufile which does the
    operation adjusting the counters, and by letting the recovery function
    use it.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This will simplify sufile.c by sharing common code which repeatedly
    appears in routines updating a segment usage entry; a wrapper function
    nilfs_sufile_update() is introduced for the purpose, and counter
    modifications are integrated to a new function
    nilfs_sufile_mod_counter().

    This is a preparation for the successive bugfix patch ("nilfs2: fix
    possible mismatch of sufile counters on recovery").

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • The nilfs_sufile_set_error() function wrongly adjusts the number of
    dirty segments instead of the number of clean segments. In addition,
    the function calls brelse() twice for the same buffer head.

    This fixes these bugs.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This fixes a bug of ("nilfs2: simplify handling of active state of
    segments") patch. The patch did not take account that a base index is
    increased in nilfs_sufile_get_suinfo() function if requested entries
    go across block boundary on sufile.

    Due to this bug, the active flag sometimes appears on wrong segments
    and has induced malfunction of garbage collection.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

07 Apr, 2009

4 commits

  • will reduce some lines of segment constructor. Previously, the state was
    complexly controlled through a list of segments in order to keep
    consistency in meta data of usage state of segments. Instead, this
    presents ``calculated'' active flags to userland cleaner program and stop
    maintaining its real flag on disk.

    Only by this fake flag, the cleaner cannot exactly know if each segment is
    reclaimable or not. However, the recent extension of nilfs_sustat ioctl
    struct (nilfs2-extend-nilfs_sustat-ioctl-struct.patch) can prevent the
    cleaner from reclaiming in-use segment wrongly.

    So, now I can apply this for simplification.

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

    Ryusuke Konishi
     
  • Pekka Enberg advised me:
    > It would be nice if BUG(), BUG_ON(), and panic() calls would be
    > converted to proper error handling using WARN_ON() calls. The BUG()
    > call in nilfs_cpfile_delete_checkpoints(), for example, looks to be
    > triggerable from user-space via the ioctl() system call.

    This will follow the comment and keep them to a minimum.

    Acked-by: Pekka Enberg
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • This adds a new argument to the nilfs_sustat structure.

    The extended field allows to delete volatile active state of segments,
    which was needed to protect freshly-created segments from garbage
    collection but has confused code dealing with segments. This
    extension alleviates the mess and gives room for further
    simplifications.

    The volatile active flag is not persistent, so it's eliminable on this
    occasion without affecting compatibility other than the ioctl change.

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

    Ryusuke Konishi
     
  • This adds a meta data file which stores the allocation state of segments.

    [konishi.ryusuke@lab.ntt.co.jp: fix wrong counting of checkpoints and dirty segments]
    Signed-off-by: Koji Sato
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Koji Sato