22 Jan, 2009

1 commit

  • [XFS] Long btree pointers are still 64 bit on disk

    On 32 bit machines with CONFIG_LBD=n, XFS reduces the
    in memory size of xfs_fsblock_t to 32 bits so that it
    will fit within 32 bit addressing. However, the disk format
    for long btree pointers are still 64 bits in size.

    The recent btree rewrite failed to take this into account
    when initialising new btree blocks, setting sibling pointers
    to NULL and checking if they are NULL. Hence checking whether
    a 64 bit NULL was the same as a 32 bit NULL was failingi
    resulting in NULL sibling pointers failing to be detected
    correctly. This showed up as WANT_CORRUPTED_GOTO shutdowns
    in xfs_btree_delrec.

    Fix this by making all the comparisons and setting of long
    pointer btree NULL blocks to the disk format, not the
    in memory format. i.e. use NULLDFSBNO.

    Reported-by: Alexander Beregalov
    Reported-by: Jacek Luczak
    Reported-by: Danny ter Haar
    Tested-by: Jacek Luczak
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Dave Chinner
    Signed-off-by: Felix Blyakher

    Dave Chinner
     

19 Jan, 2009

1 commit


09 Jan, 2009

1 commit

  • Change the left/right variables to the proper always 64bit xfs_dfsbo_t
    type because otherwise compilation fails for Geert on m68k without
    CONFIG_LBD:

    | fs/xfs/xfs_btree.c: In function 'xfs_btree_readahead_lblock':
    | fs/xfs/xfs_btree.c:736: warning: comparison is always true due to limited range of data type
    | fs/xfs/xfs_btree.c:741: warning: comparison is always true due to limited range of data type

    Reported-by: Geert Uytterhoeven
    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Lachlan McIlroy

    Christoph Hellwig
     

30 Oct, 2008

27 commits

  • structures.

    Always use the generic xfs_btree_block type instead of the short / long
    structures. Add XFS_BTREE_SBLOCK_LEN / XFS_BTREE_LBLOCK_LEN defines for
    the length of a short / long form block. The rationale for this is that we
    will grow more btree block header variants to support CRCs and other RAS
    information, and always accessing them through the same datatype with
    unions for the short / long form pointers makes implementing this much
    easier.

    SGI-PV: 988146

    SGI-Modid: xfs-linux-melb:xfs-kern:32300a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Donald Douwsma
    Signed-off-by: David Chinner
    Signed-off-by: Lachlan McIlroy

    Christoph Hellwig
     
  • SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32224a

    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Christoph Hellwig

    Lachlan McIlroy
     
  • Lots of functionality in xfs_btree.c isn't needed by callers outside of
    this file anymore, so mark these functions static.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32209a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Add methods to check whether two keys/records are in the righ order. This
    replaces the xfs_btree_check_key and xfs_btree_check_rec methods. For the
    callers from xfs_bmap.c just opencode the bmbt-specific asserts.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32208a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • These are equivalent to the xfs_btree_* versions, and the only remaining
    caller can be switched to the generic one after they are exported. Also
    remove some now dead infrastructure in xfs_bmap_btree.c.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32207a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Not really much reason to make it generic given that it's so small, but
    this is the last non-method in xfs_alloc_btree.c and xfs_ialloc_btree.c,
    so it makes the whole btree implementation more structured.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32206a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Make the btree delete code generic. Based on a patch from David Chinner
    with lots of changes to follow the original btree implementations more
    closely. While this loses some of the generic helper routines for
    inserting/moving/removing records it also solves some of the one off bugs
    in the original code and makes it easier to verify.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32205a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • xfs_bmbt_killroot is a mostly generic implementation of moving from a real
    block based root to an inode based root. So move it to xfs_btree.c where
    it can use all the nice infrastructure there and make it pointer size
    agnostic

    The new name for it is xfs_btree_kill_iroot, following the old naming but
    making it clear we're dealing with the root in inode case here, and to
    avoid confusion with xfs_btree_new_root which is used for the not inode
    rooted case. I've also added a comment describing what it does and why
    it's named the way it is.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32203a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Make the btree insert code generic. Based on a patch from David Chinner
    with lots of changes to follow the original btree implementations more
    closely. While this loses some of the generic helper routines for
    inserting/moving/removing records it also solves some of the one off bugs
    in the original code and makes it easier to verify.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32202a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • xfs_bmbt_newroot is a mostly generic implementation of moving from an
    inode root to a real block based root. So move it to xfs_btree.c where it
    can use all the nice infrastructure there and make it pointer size
    agnostic

    The new name for it is xfs_btree_new_iroot, following the old naming but
    making it clear we're dealing with the root in inode case here, and to
    avoid confusion with xfs_btree_new_root which is used for the not inode
    rooted case.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32201a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • From: Dave Chinner

    Add a xfs_btree_new_root helper for the alloc and ialloc btrees. The bmap
    btree needs it's own version and is not converted.

    [hch: split out from bigger patch and minor adaptions]

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32200a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Make the btree split code generic. Based on a patch from David Chinner
    with lots of changes to follow the original btree implementations more
    closely. While this loses some of the generic helper routines for
    inserting/moving/removing records it also solves some of the one off bugs
    in the original code and makes it easier to verify.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32198a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Make the btree left shift code generic. Based on a patch from David
    Chinner with lots of changes to follow the original btree implementations
    more closely. While this loses some of the generic helper routines for
    inserting/moving/removing records it also solves some of the one off bugs
    in the original code and makes it easier to verify.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32197a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Make the btree right shift code generic. Based on a patch from David
    Chinner with lots of changes to follow the original btree implementations
    more closely. While this loses some of the generic helper routines for
    inserting/moving/removing records it also solves some of the one off bugs
    in the original code and makes it easier to verify.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32196a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • From: Dave Chinner

    The most complicated part here is the lastrec tracking for the alloc
    btree. Most logic is in the update_lastrec method which has to do some
    hopefully good enough dirty magic to maintain it.

    [hch: split out from bigger patch and a rework of the lastrec

    logic]

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32194a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • From: Dave Chinner

    Note that there are many > 80 char lines introduced due to the
    xfs_btree_key casts. But the places where this happens is throw-away code
    once the whole btree code gets merged into a common implementation.

    The same is true for the temporary xfs_alloc_log_keys define to the new
    name. All old users will be gone after a few patches.

    [hch: split out from bigger patch and minor adaptions]

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32193a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • From: Dave Chinner

    [hch: split out from bigger patch and minor adaptions]

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32192a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • From: Dave Chinner

    [hch: split out from bigger patch and minor adaptions]

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32191a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • From: Dave Chinner

    Because this is the first major generic btree routine this patch includes
    some infrastrucure, first a few routines to deal with a btree block that
    can be either in short or long form, second xfs_btree_read_buf_block,
    which is the new central routine to read a btree block given a cursor, and
    third the new xfs_btree_ptr_addr routine to calculate the address for a
    given btree pointer record.

    [hch: split out from bigger patch and minor adaptions]

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32190a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Add new helpers in xfs_btree.c to find the record, key and block pointer
    entries inside a btree block. To implement this genericly the
    ->get_maxrecs methods and two new xfs_btree_ops entries for the key and
    record sizes are used. Also add a big comment describing how the
    addressing inside a btree block works.

    Note that these helpers are unused until users are introduced in the next
    patches and this patch will thus cause some harmless compiler warnings.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32189a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Factor xfs_btree_maxrecs into a per-btree operation.

    The get_maxrecs method is based on a patch from Dave Chinner.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32188a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Move the various btree validation helpers around in xfs_btree.c so that
    they are close to each other and in common #ifdef DEBUG sections.

    Also add a new xfs_btree_check_ptr helper to check a btree ptr that can be
    either long or short form.

    Split out from a bigger patch from Dave Chinner with various small changes
    applied by me.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32183a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • From: Dave Chinner

    Refactor xfs_btree_readahead to make it more readable:

    (a) remove the inline xfs_btree_readahead wrapper and move all checks out

    of line into the main routine.

    (b) factor out helpers for short/long form btrees

    (c) move check for root in inodes from the callers into
    xfs_btree_readahead

    [hch: split out from a big patch and minor cleanups]

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32182a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • Add a flag to the xfs btree cursor when using long (64bit) block pointers
    instead of checking btnum == XFS_BTNUM_BMAP.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32181a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • The bmap btree is rooted in the inode and not in a disk block. Make the
    support for this feature more generic by adding a btree flag to for this
    feature instead of relying on the XFS_BTNUM_BMAP btnum check.

    Also clean up xfs_btree_get_block where this new flag is used.

    Based upon a patch from Dave Chinner.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32180a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • xfs_btree_init_cursor contains close to little shared code for the
    different btrees and will get even more non-common code in the future.
    Split it up into one routine per btree type.

    Because xfs_btree_dup_cursor needs to call the init routine for a generic
    btree cursor add a new btree operation vector that contains a dup_cursor
    method that initializes a new cursor based on an existing one.

    The btree operations vector is based on an idea and code from Dave Chinner
    and will grow more entries later during this series.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32176a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     
  • This type is only embedded in struct xfs_btree_block and never used
    directly. By moving the fields directly into struct xfs_btree_block a lot
    of the macros for struct xfs_btree_sblock and struct xfs_btree_lblock can
    be used for struct xfs_btree_block too now which helps greatly with some
    of the migrations during implementing the generic btree code.

    SGI-PV: 985583

    SGI-Modid: xfs-linux-melb:xfs-kern:32174a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Bill O'Donnell
    Signed-off-by: David Chinner

    Christoph Hellwig
     

13 Aug, 2008

2 commits

  • The alloc and inobt btree use the same agbp/agno pair in the btree_cur
    union. Make them use the same bc_private.a union member so that code for
    these two short form btree implementations can be shared.

    SGI-PV: 981498

    SGI-Modid: xfs-linux-melb:xfs-kern:31788a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Tim Shimmin
    Signed-off-by: David Chinner
    Signed-off-by: Lachlan McIlroy

    Christoph Hellwig
     
  • Remove unneeded xfs_btree_get_block forward declaration. Move
    xfs_btree_firstrec next to xfs_btree_lastrec.

    SGI-PV: 981498

    SGI-Modid: xfs-linux-melb:xfs-kern:31787a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Tim Shimmin
    Signed-off-by: David Chinner
    Signed-off-by: Lachlan McIlroy

    Christoph Hellwig
     

28 Sep, 2006

2 commits


20 Jun, 2006

1 commit


02 Nov, 2005

3 commits


21 Jun, 2005

2 commits