10 May, 2011

1 commit


09 Mar, 2011

7 commits


10 Jan, 2011

1 commit


23 Oct, 2010

8 commits

  • Nilfs now can use sb->s_bdi to get backing_dev_info, so we use it
    instead of ns_bdi on the nilfs object and remove ns_bdi.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • Nilfs object holds a back pointer to a writable super block instance
    in nilfs->ns_writer, and this became eliminable since sb is now made
    per device and all inodes have a valid pointer to it.

    This deletes the ns_writer pointer and a reader/writer semaphore
    protecting it.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • After applied the patch that unified sb instances, root dentry of
    snapshots can be left in dcache even after their trees are unmounted.

    The orphan root dentry/inode keeps a root object, and this causes
    false positive of nilfs_checkpoint_is_mounted function.

    This resolves the issue by having nilfs_checkpoint_is_mounted test
    whether the root dentry is busy or not.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This applies prepared rollback function and redirect function of
    metadata file to DAT file, and eliminates GCDAT inode.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This stops pre-allocating nilfs object in nilfs_get_sb routine, and
    stops managing its life cycle by reference counting.

    nilfs_find_or_create_nilfs() function, nilfs->ns_mount_mutex,
    nilfs_objects list, and the reference counter will be removed through
    the simplification.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This stops allocating multiple super block instances for a device.

    All snapshots and a current mode mount (i.e. latest tree) will be
    controlled with nilfs_root objects that are kept within an sb
    instance.

    nilfs_get_sb() is rewritten so that it always has a root object for
    the latest tree and snapshots make additional root objects.

    The root dentry of the latest tree is binded to sb->s_root even if it
    isn't attached on a directory. Root dentries of snapshots or the
    latest tree are binded to mnt->mnt_root on which they are mounted.

    With this patch, nilfs_find_sbinfo() function, nilfs->ns_supers list,
    and nilfs->ns_current back pointer, are deleted. In addition,
    init_nilfs() and load_nilfs() are simplified since they will be called
    once for a device, not repeatedly called for mount points.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • To hold multiple versions of a filesystem in one sb instance, a new
    on-memory structure is necessary to handle one or more checkpoints.

    This adds a red-black tree of checkpoints to nilfs object, and adds
    lookup and create functions for them.

    Each checkpoint is represented by "nilfs_root" structure, and this
    structure has rb_node to configure the rb-tree.

    The nilfs_root object is identified with a checkpoint number. For
    each snapshot, a nilfs_root object is allocated and the checkpoint
    number of snapshot is assigned to it. For a regular mount
    (i.e. current mode mount), NILFS_CPTREE_CURRENT_CNO constant is
    assigned to the corresponding nilfs_root object.

    Each nilfs_root object has an ifile inode and some counters. These
    items will displace those of nilfs_sb_info structure in successive
    patches.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This uses inode hash function that vfs provides instead of the own
    hash table for caching gc inodes. This finally removes the own inode
    hash from nilfs.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

23 Jul, 2010

4 commits

  • Super blocks of nilfs are periodically overwritten in order to record
    the recent log position. This shortens recovery time after unclean
    unmount, but the current implementation performs the update even for a
    few blocks of change. If the filesystem gets small changes slowly and
    continually, super blocks may be updated excessively.

    This moderates the issue by skipping update of log cursor if it does
    not cross a segment boundary.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This will sync super blocks in turns instead of syncing duplicate
    super blocks at the time. This will help searching valid super root
    when super block is written into disk before log is written, which is
    happen when barrier-less block devices are unmounted uncleanly. In
    the situation, old super block likely points to valid log.

    This patch introduces ns_sbwcount member to the nilfs object and adds
    nilfs_sb_will_flip() function; ns_sbwcount counts how many times super
    blocks write back to the disk. And, nilfs_sb_will_flip() decides
    whether flipping required or not based on the count of ns_sbwcount to
    sync super blocks asymmetrically.

    The following functions are also changed:

    - nilfs_prepare_super(): flips super blocks according to the
    argument. The argument is calculated by nilfs_sb_will_flip()
    function.

    - nilfs_cleanup_super(): sets "clean" flag to both super blocks if
    they point to the same checkpoint.

    To update both of super block information, caller of
    nilfs_commit_super must set the information on both super blocks.

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

    Jiro SEKIBA
     
  • This counter is unused.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This stores blocksize in nilfs objects for the successive refactoring
    of recovery logic.

    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
     

13 Feb, 2010

2 commits


20 Nov, 2009

1 commit


14 Sep, 2009

3 commits

  • This is a re-revised patch to shorten freeze period.
    This version include a fix of the bug Konishi-san mentioned last time.

    When GC is runnning, GC moves live block to difference segments.
    Copying live blocks into memory is done in a transaction,
    however it is not necessarily to be in the transaction.
    This patch will get the nilfs_ioctl_move_blocks() out from
    transaction lock and put it before the transaction.

    I ran sysbench fileio test against nilfs partition.
    I copied some DVD/CD images and created snapshot to create live blocks
    before starting the benchmark.

    Followings are summary of rc8 and rc8 w/ the patch of per-request
    statistics, which is min/max and avg. I ran each test three times and
    bellow is average of those numers.

    According to this benchmark result, average time is slightly degrated.
    However, worstcase (max) result is significantly improved.
    This can address a few seconds write freeze.

    - random write per-request performance of rc8
    min 0.843ms
    max 680.406ms
    avg 3.050ms
    - random write per-request performance of rc8 w/ this patch
    min 0.843ms -> 100.00%
    max 380.490ms -> 55.90%
    avg 3.233ms -> 106.00%

    - sequential write per-request performance of rc8
    min 0.736ms
    max 774.343ms
    avg 2.883ms
    - sequential write per-request performance of rc8 w/ this patch
    min 0.720ms -> 97.80%
    max 644.280ms-> 83.20%
    avg 3.130ms -> 108.50%

    -----8
    Signed-off-by: Ryusuke Konishi

    Jiro SEKIBA
     
  • Separate conditions that check if syncing super block and alternative
    super block are required as inline functions to reuse the conditions.

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

    Jiro SEKIBA
     
  • will get rid of nilfs_get_writer() and nilfs_put_writer() pair used to
    retain a writable FS-instance for a period.

    The pair functions were making up some kind of recursive lock with a
    mutex, but they became overkill since the commit
    201913ed746c7724a40d33ee5a0b6a1fd2ef3193. Furthermore, they caused
    the following lockdep warning because the mutex can be released by a
    task which didn't lock it:

    =====================================
    [ BUG: bad unlock balance detected! ]
    -------------------------------------
    kswapd0/422 is trying to release lock (&nilfs->ns_writer_mutex) at:
    [] mutex_unlock+0x8/0xa
    but there are no more locks to release!

    other info that might help us debug this:
    no locks held by kswapd0/422.

    stack backtrace:
    Pid: 422, comm: kswapd0 Not tainted 2.6.31-rc4-nilfs #51
    Call Trace:
    [] ? printk+0xf/0x18
    [] print_unlock_inbalance_bug+0xcc/0xd7
    [] ? prop_put_global+0x3/0x35
    [] lock_release+0xed/0x1dc
    [] ? mutex_unlock+0x8/0xa
    [] __mutex_unlock_slowpath+0xaf/0x119
    [] mutex_unlock+0x8/0xa
    [] nilfs_mdt_write_page+0xd8/0xe1 [nilfs2]
    [] shrink_page_list+0x379/0x68d
    [] ? isolate_pages_global+0xb4/0x18c
    [] shrink_list+0x26b/0x54b
    [] shrink_zone+0x20c/0x2a2
    [] kswapd+0x407/0x591
    [] ? isolate_pages_global+0x0/0x18c
    [] ? autoremove_wake_function+0x0/0x33
    [] ? kswapd+0x0/0x591
    [] kthread+0x69/0x6e
    [] ? kthread+0x0/0x6e
    [] kernel_thread_helper+0x7/0x1a

    This patch uses a reader/writer semaphore instead of the own lock and
    kills this warning.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

19 Aug, 2009

1 commit

  • will fix kernel oopses like the following:

    # mount -t nilfs2 -r -o cp=20 /dev/sdb1 /test1
    # mount -t nilfs2 -r -o cp=20 /dev/sdb1 /test2
    # umount /test1
    # umount /test2

    BUG: sleeping function called from invalid context at arch/x86/mm/fault.c:1069
    in_atomic(): 0, irqs_disabled(): 1, pid: 3886, name: umount.nilfs2
    1 lock held by umount.nilfs2/3886:
    #0: (&type->s_umount_key#31){+.+...}, at: [] deactivate_super+0x52/0x6c
    irq event stamp: 1219
    hardirqs last enabled at (1219): [] __mutex_unlock_slowpath+0xf8/0x119
    hardirqs last disabled at (1218): [] __mutex_unlock_slowpath+0x59/0x119
    softirqs last enabled at (1214): [] __do_softirq+0x1a5/0x1ad
    softirqs last disabled at (1205): [] do_softirq+0x36/0x5a
    Pid: 3886, comm: umount.nilfs2 Not tainted 2.6.31-rc6 #55
    Call Trace:
    [] __might_sleep+0x107/0x10e
    [] do_page_fault+0x246/0x397
    [] ? do_page_fault+0x0/0x397
    [] error_code+0x6b/0x70
    [] ? do_page_fault+0x0/0x397
    [] ? __lock_acquire+0x91/0x12fd
    [] ? __lock_acquire+0x12ee/0x12fd
    [] ? __lock_acquire+0x12ee/0x12fd
    [] lock_acquire+0xba/0xdd
    [] ? nilfs_detach_segment_constructor+0x2f/0x2fa [nilfs2]
    [] down_write+0x2a/0x46
    [] ? nilfs_detach_segment_constructor+0x2f/0x2fa [nilfs2]
    [] nilfs_detach_segment_constructor+0x2f/0x2fa [nilfs2]
    [] ? mark_held_locks+0x43/0x5b
    [] ? trace_hardirqs_on_caller+0x10b/0x133
    [] ? trace_hardirqs_on+0xb/0xd
    [] nilfs_put_super+0x2f/0xca [nilfs2]
    [] generic_shutdown_super+0x49/0xb8
    [] kill_block_super+0x1d/0x31
    [] ? vfs_quota_off+0x0/0x12
    [] deactivate_super+0x57/0x6c
    [] mntput_no_expire+0x8c/0xb4
    [] sys_umount+0x27f/0x2a4
    [] sys_oldumount+0xd/0xf
    [] sysenter_do_call+0x12/0x38
    ...

    This turns out to be a bug brought by an -rc1 patch ("nilfs2: simplify
    remaining sget() use").

    In the patch, a new "put resource" function, nilfs_put_sbinfo()
    was introduced to delay freeing nilfs_sb_info struct.

    But the nilfs_put_sbinfo() mistakenly used atomic_dec_and_test()
    function to check the reference count, and it caused the nilfs_sb_info
    was freed when user mounted a snapshot twice.

    This bug also suggests there was unseen memory leak in usual mount
    /umount operations for nilfs.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

12 Jun, 2009

5 commits

  • This will remove every bd_mount_sem use in nilfs.

    The intended exclusion control was replaced by the previous patch
    ("nilfs2: correct exclusion control in nilfs_remount function") for
    nilfs_remount(), and this patch will replace remains with a new mutex
    that this inserts in nilfs object.

    Signed-off-by: Ryusuke Konishi
    Cc: Christoph Hellwig
    Signed-off-by: Al Viro

    Ryusuke Konishi
     
  • nilfs_remount() changes mount state of a superblock instance. Even
    though nilfs accesses other superblock instances during mount or
    remount, the mount state was not properly protected in
    nilfs_remount().

    Moreover, nilfs_remount() has a lock order reversal problem;
    nilfs_get_sb() holds:

    1. bdev->bd_mount_sem
    2. sb->s_umount (sget acquires)

    and nilfs_remount() holds:

    1. sb->s_umount (locked by the caller in vfs)
    2. bdev->bd_mount_sem

    To avoid these problems, this patch divides a semaphore protecting
    super block instances from nilfs->ns_sem, and applies it to the mount
    state protection in nilfs_remount().

    With this change, bd_mount_sem use is removed from nilfs_remount() and
    the lock order reversal will be resolved. And the new rw-semaphore,
    nilfs->ns_super_sem will properly protect the mount state except the
    modification from nilfs_error function.

    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Al Viro

    Ryusuke Konishi
     
  • This simplifies the test function passed on the remaining sget()
    callsite in nilfs.

    Instead of checking mount type (i.e. ro-mount/rw-mount/snapshot mount)
    in the test function passed to sget(), this patch first looks up the
    nilfs_sb_info struct which the given mount type matches, and then
    acquires the super block instance holding the nilfs_sb_info.

    Signed-off-by: Ryusuke Konishi
    Cc: Al Viro
    Signed-off-by: Al Viro

    Ryusuke Konishi
     
  • This stops using sget() for checking if an r/w-mount or an r/o-mount
    exists on the device. This elimination uses a back pointer to the
    current mount added to nilfs object.

    Signed-off-by: Ryusuke Konishi
    Cc: Al Viro
    Signed-off-by: Al Viro

    Ryusuke Konishi
     
  • This will change the way to obtain nilfs object in nilfs_get_sb()
    function.

    Previously, a preliminary sget() call was performed, and the nilfs
    object was acquired from a super block instance found by the sget()
    call.

    This patch, instead, instroduces a new dedicated function
    find_or_create_nilfs(); as the name implies, the function finds an
    existent nilfs object from a global list or creates a new one if no
    object is found on the device.

    Signed-off-by: Ryusuke Konishi
    Cc: Al Viro
    Signed-off-by: Al Viro

    Ryusuke Konishi
     

07 Apr, 2009

6 commits

  • The former versions didn't have extra super blocks. This improves the
    weak point by introducing another super block at unused region in tail of
    the partition.

    This doesn't break disk format compatibility; older versions just ingore
    the secondary super block, and new versions just recover it if it doesn't
    exist. The partition created by an old mkfs may not have unused region,
    but in that case, the secondary super block will not be added.

    This doesn't make more redundant copies of the super block; it is a future
    work.

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

    Ryusuke Konishi
     
  • 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
     
  • 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 removes NILFS_IOCTL_TIMEDWAIT command from ioctl interface along
    with the related flags and wait queue.

    The command is terrible because it just sleeps in the ioctl. I prefer
    to avoid this by devising means of event polling in userland program.
    By reconsidering the userland GC daemon, I found this is possible
    without changing behaviour of the daemon and sacrificing efficiency.

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

    Ryusuke Konishi
     
  • Pekka Enberg pointed out that double error handlings found after
    nilfs_transaction_end() can be avoided by separating abort operation:

    OK, I don't understand this. The only way nilfs_transaction_end() can
    fail is if we have NILFS_TI_SYNC set and we fail to construct the
    segment. But why do we want to construct a segment if we don't commit?

    I guess what I'm asking is why don't we have a separate
    nilfs_transaction_abort() function that can't fail for the erroneous
    case to avoid this double error value tracking thing?

    This does the separation and renames nilfs_transaction_end() to
    nilfs_transaction_commit() for clarification.

    Since, some calls of these functions were used just for exclusion control
    against the segment constructor, they are replaced with semaphore
    operations.

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

    Ryusuke Konishi
     
  • This adds the following common structures of the NILFS2 file system.

    * nilfs_inode_info structure:
    gives on-memory inode.

    * nilfs_sb_info structure:
    keeps per-mount state and a special inode for the ifile.
    This structure is attached to the super_block structure.

    * the_nilfs structure:
    keeps shared state and locks among a read/write mount and snapshot
    mounts. This keeps special inodes for the sufile, cpfile, dat, and
    another dat inode used during GC (gcdat). This also has a hash table
    of dummy inodes to cache disk blocks during GC (gcinodes).

    * nilfs_transaction_info structure:
    keeps per task state while nilfs is writing logs or doing indivisible
    inode or namespace operations. This structure is used to identify
    context during log making and store nest level of the lock which
    ensures atomicity of file system operations.

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

    Ryusuke Konishi