11 Jun, 2011

2 commits

  • nilfs_btree_delete function does not terminate part of virtual block
    addresses when shrinking the last remaining child node into the root
    node. The missing address termination causes that dead btree node
    blocks persist and chip away free disk space.

    This fixes the leak bug on the btree node deletion.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • nilfs_btree_delete function wrongly terminates virtual block address
    of the btree node held by its parent at index 0. When concatenating
    the index-0 node with its right sibling node, nilfs_btree_delete
    terminates the block address of index-0 node instead of the right
    sibling node which should be deleted.

    This bug not only wears disk space in the long run, but also causes
    file system corruption. This will fix it.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

10 May, 2011

1 commit


08 Mar, 2011

1 commit

  • 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
     

23 Jul, 2010

15 commits

  • This applies read-ahead to nilfs_btree_do_lookup and
    nilfs_btree_lookup_contig functions and extends them to read ahead
    siblings of level 1 btree nodes that hold data blocks.

    At present, the read-ahead is not applied to most btree operations;
    only get_block() callback function, which is used during read of
    regular files or directories, receives the benefit.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • nilfs_btree_get_block() now may return untested buffer due to
    read-ahead. This adds a new flag for buffer heads so that the btree
    code can check whether the buffer is already verified or not.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This adds __nilfs_btree_get_block() function that can issue a series
    of read-ahead requests for sibling btree nodes.

    This read-ahead needs parent node block, so nilfs_btree_readahead_info
    structure is added to pass the information that
    __nilfs_btree_get_block() needs.

    This also replaces the previous nilfs_btree_get_block() implementation
    with a wrapper function of __nilfs_btree_get_block().

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • 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
     
  • This removes all inline uses from btree.c. Gcc now agressively apply
    inline expansion even for the functions declared without the keyword;
    the inline use in btree.c looks excessive.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • The patch "reduce repetitive calculation of max number of child nodes"
    gathered up the calculation of maximum number of child nodes into
    nilfs_btree_nchildren_per_block() function. This makes the function
    get resultant value from a private variable in bmap object instead of
    calculating it for each call.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • The current btree implementation repeats the same calculation on the
    maximum number of child nodes. This is because a few low level
    routines use the calculation for index addressing in a btree node
    block.

    This reduces the calculation by explicitly passing the maximum number
    of child nodes (ncmax) through their argument.

    This changes parameter passing of the following functions:

    - nilfs_btree_node_dptrs
    - nilfs_btree_node_get_ptr
    - nilfs_btree_node_set_ptr
    - nilfs_btree_node_init
    - nilfs_btree_node_move_left
    - nilfs_btree_node_move_right
    - nilfs_btree_node_insert
    - nilfs_btree_node_delete, and
    - nilfs_btree_get_node

    The following functions are removed:

    - nilfs_btree_node_nchildren_min
    - nilfs_btree_node_nchildren_max

    Most middle level btree operations are rewritten to pass a proper
    ncmax value depending on whether each occurrence of node is "root" or
    not.

    A constant NILFS_BTREE_ROOT_NCHILDREN_MAX is used for the root node,
    whereas nilfs_btree_nchildren_per_block() function is used for
    non-root nodes. If a node could be either root or a non-root node, an
    output argument of nilfs_btree_get_node() is used to set up ncmax.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • nilfs_btree_node_nchildren_max() and nilfs_btree_node_nchildren_min()
    functions switch return value depending on whether target node is the
    root or a node block. In most uses of these functions, however, the
    node type is fixed, and moreover the same calculation is repeatedly
    performed in loop.

    This unfold these functions depending on context and move them outside
    loops wherever possible.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • nilfs_bmap_lookup and its variants are supposed to take a valid
    pointer argument to return a block address, thus pointer checks in
    nilfs_btree_lookup and nilfs_direct_lookup are needless.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This unifies two similar functions nilfs_btree_set_target_v and
    nilfs_direct_set_target_v into one, nilfs_bmap_set_target_v.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This replaces all uses of nilfs_btree struct in implementation of
    btree mapping with nilfs_bmap struct.

    Name of local variable "btree" is kept not to bloat amount of change.
    And, a part of local variables "bmap" is renamed to "btree" to uniform
    naming rule.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • The first argument of bops->bop_propagate operation takes a constant
    qualifier, and causes compilation error when removed cast to pointer
    of nilfs_btree structure type. This fixes the issue to prepare for
    succesive removal of nilfs_btree struct.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • Will remove nilfs_bmap_key_to_dkey(), nilfs_bmap_dkey_to_key(),
    nilfs_bmap_ptr_to_dptr(), and nilfs_bmap_dptr_to_ptr() for simplicity.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This inserts sanity checks soon after read btree node from disk. This
    allows early detection of broken btree nodes, and helps to narrow down
    problems due to file system corruption.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • According to the report titled "problem with nilfs_cleanerd" from
    Łukasz Wójcicki, nilfs_btree_lookup_dirty_buffers or
    nilfs_btree_add_dirty_buffer got memory violation during garbage
    collection.

    This could happen if a level field of given btree node buffer is
    incorrect, which is a crucial internal bug.

    This inserts a sanity check to figure out the problem.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

10 May, 2010

3 commits


02 Apr, 2010

1 commit

  • `make CONFIG_NILFS2_FS=m M=fs/nilfs2/` will give the following warnings:

    fs/nilfs2/btree.c: In function 'nilfs_btree_propagate':
    fs/nilfs2/btree.c:1882: warning: 'maxlevel' may be used uninitialized in this function
    fs/nilfs2/btree.c:1882: note: 'maxlevel' was declared here

    Set maxlevel = 0 to fix it.

    Signed-off-by: Li Hong
    Signed-off-by: Ryusuke Konishi

    Li Hong
     

29 Nov, 2009

1 commit


20 Nov, 2009

4 commits

  • This removes the obsolete nilfs_btnode_get() function and makes
    nilfs_btree_get_block() directly call nilfs_btnode_submit_block().

    This expansion will provide better opportunity for code optimization.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • This displaces nilfs_btnode_get() use to create new btree node block
    with nilfs_btnode_create_block.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • lock_buffer() and unlock_buffer() uses in btree.c are eliminable
    because btree functions gain buffer heads through nilfs_btnode_get(),
    which never returns an on-the-fly buffer.

    Although nilfs_clear_dirty_page() and nilfs_copy_back_pages() in
    nilfs_commit_gcdat_inode() juggle btree node buffers of DAT, this is
    safe because these operations are protected by a log writer lock or
    the metadata file semaphore of DAT.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • The current btree lookup routines make a kernel oops when detected
    inconsistency in btree blocks. These routines should instead return a
    proper error code because the inconsistency usually comes from
    corruption of on-disk metadata.

    This fixes the issue by converting BUG_ON calls to proper error
    handlings.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

14 Sep, 2009

3 commits

  • The current btree code is written so that btree functions call dat
    operations via wrapper functions in bmap.c when they allocate, free,
    or modify virtual block addresses.

    This abstraction requires additional function calls and causes
    frequent call of nilfs_bmap_get_dat() function since it is used in the
    every wrapper function.

    This removes the wrapper functions and makes them available from
    btree.c and direct.c, which will increase the opportunity of
    compiler optimization.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • The btree path object is cleared just before it is freed.

    This will remove the code doing the unnecessary clear operation.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • Even though many btree functions take a btree object as their first
    argument, most of them are not used in their functions.

    This sticky use of the btree argument is hurting code readability and
    giving the possibility of inefficient code generation.

    So, this removes the unnecessary btree arguments.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     

10 Jun, 2009

9 commits