01 Dec, 2008

8 commits

  • Most uses of struct xfs_imap are to map and inode to a buffer. To avoid
    copying around the inode location information we should just embedd a
    strcut xfs_imap into the xfs_inode. To make sure it doesn't bloat an
    inode the im_len is changed to a ushort, which is fine as that's what
    the users exepect anyway.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Niv Sardi

    Christoph Hellwig
     
  • We have removed the support for old-style inode items a while ago and
    xlog_recover_do_inode_trans is now only called for XFS_LI_INODE items.
    That means we can remove the call to xfs_imap there and with it the
    XFS_IMAP_LOOKUP that is set by all other callers. We can also mark
    xfs_imap static now.

    (First sent on October 21st)

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Niv Sardi

    Christoph Hellwig
     
  • The only caller of xfs_itobp that doesn't have i_blkno setup is now
    the initial inode read. It needs access to the whole xfs_imap so using
    xfs_inotobp is not an option. Instead opencode the buffer lookup in
    xfs_iread and kill all the functionality for the initial map from
    xfs_itobp.

    (First sent on October 21st)

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Niv Sardi

    Christoph Hellwig
     
  • Split out the body of the main loop into a separate helper to make the
    code readable.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Niv Sardi

    Christoph Hellwig
     
  • Now that we have a separate xfs_icdinode_t for the in-core inode which
    gets logged there is no need anymore for the xfs_dinode vs xfs_dinode_core
    split - the fact that part of the structure gets logged through the inode
    log item and a small part not can better be described in a comment.

    All sizeof operations on the dinode_core either really wanted the
    icdinode and are switched to that one, or had already added the size
    of the agi unlinked list pointer. Later both will be replaced with
    helpers once we get the larger CRC-enabled dinode.

    Removing the data and attribute fork unions also has the advantage that
    xfs_dinode.h doesn't need to pull in every header under the sun.

    While we're at it also add some more comments describing the dinode
    structure.

    (First sent on October 7th)

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Niv Sardi

    Christoph Hellwig
     
  • Move all fields from xlog_iclog_fields_t into xlog_in_core_t instead of having
    them in a substructure and the using #defines to make it look like they were
    directly in xlog_in_core_t. Also document that xlog_in_core_2_t is grossly
    misnamed, and make all references to it typesafe.

    (First sent on Semptember 15th)

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Niv Sardi

    Christoph Hellwig
     
  • Add a helper to read the AGF header and perform basic verification.
    Based on hunks from a larger patch from Dave Chinner.

    (First sent on Juli 23rd)

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Niv Sardi

    From: Christoph Hellwig
     
  • Add a helper to read the AGI header and perform basic verification.
    Based on hunks from a larger patch from Dave Chinner.

    (First sent on Juli 23rd)

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Niv Sardi

    Christoph Hellwig
     

30 Oct, 2008

8 commits

  • When we are about to add a new item to a transaction in recovery, we need
    to check that it is valid first. Currently we just assert that header
    magic number matches, but in production systems that is not present and we
    add a corrupted transaction to the list to be processed. This results in a
    kernel oops later when processing the corrupted transaction.

    Instead, if we detect a corrupted transaction, abort recovery and leave
    the user to clean up the mess that has occurred.

    SGI-PV: 988145

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

    Signed-off-by: David Chinner
    Signed-off-by: Tim Shimmin
    Signed-off-by: Eric Sandeen
    Signed-off-by: Lachlan McIlroy

    David Chinner
     
  • Change all the remaining AIL API functions that are passed struct
    xfs_mount pointers to pass pointers directly to the struct xfs_ail being
    used. With this conversion, all external access to the AIL is via the
    struct xfs_ail. Hence the operation and referencing of the AIL is almost
    entirely independent of the xfs_mount that is using it - it is now much
    more tightly tied to the log and the items it is tracking in the log than
    it is tied to the xfs_mount.

    SGI-PV: 988143

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

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

    David Chinner
     
  • When we need to go from the log to the AIL, we have to go via the
    xfs_mount. Add a xfs_ail pointer to the log so we can go directly to the
    AIL associated with the log.

    SGI-PV: 988143

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

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

    David Chinner
     
  • Bring the ail lock inside the struct xfs_ail. This means the AIL can be
    entirely manipulated via the struct xfs_ail rather than needing both the
    struct xfs_mount and the struct xfs_ail.

    SGI-PV: 988143

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

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

    David Chinner
     
  • With the new cursor interface, it makes sense to make all the traversing
    code use the cursor interface and make the old one go away. This means
    more of the AIL interfacing is done by passing struct xfs_ail pointers
    around the place instead of struct xfs_mount pointers.

    We can replace the use of xfs_trans_first_ail() in xfs_log_need_covered()
    as it is only checking if the AIL is empty. We can do that with a call to
    xfs_trans_ail_tail() instead, where a zero LSN returned indicates and
    empty AIL...

    SGI-PV: 988143

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

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

    David Chinner
     
  • To replace the current generation number ensuring sanity of the AIL
    traversal, replace it with an external cursor that is linked to the AIL.

    Basically, we store the next item in the cursor whenever we want to drop
    the AIL lock to do something to the current item. When we regain the lock.
    the current item may already be free, so we can't reference it, but the
    next item in the traversal is already held in the cursor.

    When we move or delete an object, we search all the active cursors and if
    there is an item match we clear the cursor(s) that point to the object.
    This forces the traversal to restart transparently.

    We don't invalidate the cursor on insert because the cursor still points
    to a valid item. If the intem is inserted between the current item and the
    cursor it does not matter; the traversal is considered to be past the
    insertion point so it will be picked up in the next traversal.

    Hence traversal restarts pretty much disappear altogether with this method
    of traversal, which should substantially reduce the overhead of pushing on
    a busy AIL.

    Version 2 o add restart logic o comment cursor interface o minor cleanups

    SGI-PV: 988143

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

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

    David Chinner
     
  • 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
     
  • Clean up the way the maximum and minimum records for the btree blocks are
    calculated. For the alloc and inobt btrees all the values are
    pre-calculated in xfs_mount_common, and we switch the current loop around
    the ugly generic macros that use cpp token pasting to generate type names
    to two small helpers in normal C code. For the bmbt and bmdr trees these
    helpers also exist, but can be called during runtime, too. Here we also
    kill various macros dealing with them and inline the logic into the
    get_minrecs / get_maxrecs / get_dmaxrecs methods in xfs_bmap_btree.c.

    Note that all these new helpers take an xfs_mount * argument which will be
    needed to determine the size of a btree block once we add support for
    extended btree blocks with CRCs and other RAS information.

    SGI-PV: 988146

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

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

    Christoph Hellwig
     

13 Aug, 2008

1 commit


28 Jul, 2008

1 commit

  • kmem_free() function takes (ptr, size) arguments but doesn't actually use
    second one.

    This patch removes size argument from all callsites.

    SGI-PV: 981498
    SGI-Modid: xfs-linux-melb:xfs-kern:31050a

    Signed-off-by: Denys Vlasenko
    Signed-off-by: David Chinner
    Signed-off-by: Lachlan McIlroy

    Denys Vlasenko
     

18 Apr, 2008

9 commits

  • xfs_buf_associate_memory() can fail, but the return is never checked.
    Propagate the error through XFS_BUF_SET_PTR() so that failures are
    detected.

    SGI-PV: 980084
    SGI-Modid: xfs-linux-melb:xfs-kern:30831a

    Signed-off-by: David Chinner
    Signed-off-by: Niv Sardi
    Signed-off-by: Lachlan McIlroy

    David Chinner
     
  • Catch errors from xfs_imap() in log recovery when we might be trying to
    map an invalid inode number due to a corrupted log.

    SGI-PV: 980084
    SGI-Modid: xfs-linux-melb:xfs-kern:30829a

    Signed-off-by: David Chinner
    Signed-off-by: Niv Sardi
    Signed-off-by: Lachlan McIlroy

    David Chinner
     
  • xfsbdstrat() is declared to return an error. That is never checked because
    the error is propagated by the xfs_buf_t that is passed through the
    function.

    Mark xfsbdstrat() as returning void and comment the prototype on the
    methods needed for error checking.

    SGI-PV: 980084
    SGI-Modid: xfs-linux-melb:xfs-kern:30823a

    Signed-off-by: David Chinner
    Signed-off-by: Niv Sardi
    Signed-off-by: Lachlan McIlroy

    David Chinner
     
  • xfs_free_extent() can fail, but log recovery never bothers to check if it
    successfully free the extent it was supposed to. This could lead to silent
    corruption during log recovery. Abort log recovery if we fail to free an
    extent.

    SGI-PV: 980084
    SGI-Modid: xfs-linux-melb:xfs-kern:30801a

    Signed-off-by: David Chinner
    Signed-off-by: Niv Sardi
    Signed-off-by: Lachlan McIlroy

    David Chinner
     
  • xfs_trans_commit() can return errors when there are problems in the
    transaction subsystem. They are indicative that the entire transaction may
    be incomplete, and hence the error should be propagated as there is a good
    possibility that there is something fatally wrong in the filesystem. Catch
    and propagate or warn about commit errors in the places where they are
    currently ignored.

    SGI-PV: 980084
    SGI-Modid: xfs-linux-melb:xfs-kern:30795a

    Signed-off-by: David Chinner
    Signed-off-by: Niv Sardi
    Signed-off-by: Lachlan McIlroy

    David Chinner
     
  • xfs_trans_reserve() reports errors that should not be ignored. For
    example, a shutdown filesystem will report errors through
    xfs_trans_reserve() to prevent further changes from being attempted on a
    damaged filesystem. Catch and propagate all error conditions from
    xfs_trans_reserve().

    SGI-PV: 980084
    SGI-Modid: xfs-linux-melb:xfs-kern:30794a

    Signed-off-by: David Chinner
    Signed-off-by: Niv Sardi
    Signed-off-by: Lachlan McIlroy

    David Chinner
     
  • __FUNCTION__ is gcc-specific, use __func__

    SGI-PV: 976035
    SGI-Modid: xfs-linux-melb:xfs-kern:30775a

    Signed-off-by: Harvey Harrison
    Signed-off-by: David Chinner
    Signed-off-by: Lachlan McIlroy

    Harvey Harrison
     
  • Most VN_RELE calls either directly contain a XFS_ITOV or have the
    corresponding xfs_inode already in scope. Use the IRELE helper instead of
    VN_RELE to clarify the code. With a little more work we can kill VN_RELE
    altogether and define IRELE in terms of iput directly.

    SGI-PV: 976035
    SGI-Modid: xfs-linux-melb:xfs-kern:30710a

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

    Christoph Hellwig
     
  • When pdflush is writing back inodes, it can get stuck on inode cluster
    buffers that are currently under I/O. This occurs when we write data to
    multiple inodes in the same inode cluster at the same time.

    Effectively, delayed allocation marks the inode dirty during the data
    writeback. Hence if the inode cluster was flushed during the writeback of
    the first inode, the writeback of the second inode will block waiting for
    the inode cluster write to complete before writing it again for the newly
    dirtied inode.

    Basically, we want to avoid this from happening so we don't block pdflush
    and slow down all of writeback. Hence we introduce a non-blocking async
    inode flush flag that pdflush uses. If this flag is set, we use
    non-blocking operations (e.g. try locks) whereever we can to avoid
    blocking or extra I/O being issued.

    SGI-PV: 970925
    SGI-Modid: xfs-linux-melb:xfs-kern:30501a

    Signed-off-by: David Chinner
    Signed-off-by: Lachlan McIlroy

    David Chinner
     

10 Apr, 2008

1 commit


07 Feb, 2008

7 commits

  • A problem was reported where a system panicked in log recovery due to a
    corrupt log record. The cause of the corruption is not known but this
    change will at least prevent a crash for this specific scenario. Log
    recovery definitely needs some more work in this area.

    SGI-PV: 974151
    SGI-Modid: xfs-linux-melb:xfs-kern:30318a

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

    Lachlan McIlroy
     
  • Sparse trips over the locking order in xlog_recover_do_efd_trans() when
    xfs_trans_delete_ail() drops the ail lock. Because the unlock is
    conditional, we need to either annotate with a "fake unlock" or change the
    structure of the code so sparse thinks the function always unlocks.

    Reordering the code makes it simpler, so do that.

    SGI-PV: 972755
    SGI-Modid: xfs-linux-melb:xfs-kern:30003a

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

    David Chinner
     
  • These are mostly locking annotations, marking things static, casts where
    needed and declaring stuff in header files.

    SGI-PV: 971186
    SGI-Modid: xfs-linux-melb:xfs-kern:30002a

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

    David Chinner
     
  • Mostly trivial conversion with one exceptions: h_num_logops was kept in
    native endian previously and only converted to big endian in xlog_sync,
    but we always keep it big endian now. With todays cpus fast byteswap
    instructions that's not an issue but the new variant keeps the code clean
    and maintainable.

    SGI-PV: 971186
    SGI-Modid: xfs-linux-melb:xfs-kern:29821a

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

    Christoph Hellwig
     
  • - the various assign lsn macros are replaced by a single inline,
    xlog_assign_lsn, which is equivalent to ASSIGN_ANY_LSN_HOST except
    for a more sane calling convention. ASSIGN_LSN_DISK is replaced
    by xlog_assign_lsn and a manual bytespap, and ASSIGN_LSN by the same,
    except we pass the cycle and block arguments explicitly instead of a
    log paramter. The latter two variants only had 2, respectively one
    user anyway.
    - the GET_CYCLE is replaced by a xlog_get_cycle inline with exactly the
    same calling conventions.
    - GET_CLIENT_ID is replaced by xlog_get_client_id which leaves away
    the unused arch argument. Instead of conditional defintions
    depending on host endianess we now do an unconditional swap and shift
    then, which generates equal code.
    - the unused XLOG_SET macro is removed.

    SGI-PV: 971186
    SGI-Modid: xfs-linux-melb:xfs-kern:29820a

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

    Christoph Hellwig
     
  • - the various assign lsn macros are replaced by a single inline,
    xlog_assign_lsn, which is equivalent to ASSIGN_ANY_LSN_HOST except
    for a more sane calling convention. ASSIGN_LSN_DISK is replaced
    by xlog_assign_lsn and a manual bytespap, and ASSIGN_LSN by the same,
    except we pass the cycle and block arguments explicitly instead of a
    log paramter. The latter two variants only had 2, respectively one
    user anyway.
    - the GET_CYCLE is replaced by a xlog_get_cycle inline with exactly the
    same calling conventions.
    - GET_CLIENT_ID is replaced by xlog_get_client_id which leaves away
    the unused arch argument. Instead of conditional defintions
    depending on host endianess we now do an unconditional swap and shift
    then, which generates equal code.
    - the unused XLOG_SET macro is removed.

    SGI-PV: 971186
    SGI-Modid: xfs-linux-melb:xfs-kern:29819a

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

    Christoph Hellwig
     
  • SGI-PV: 970382
    SGI-Modid: xfs-linux-melb:xfs-kern:29739a

    Signed-off-by: Donald Douwsma
    Signed-off-by: Eric Sandeen
    Signed-off-by: Tim Shimmin

    Donald Douwsma
     

16 Oct, 2007

1 commit


15 Oct, 2007

2 commits

  • Creates a new xfs_dsb_t that is __be annotated and keeps xfs_sb_t for the
    incore one. xfs_xlatesb is renamed to xfs_sb_to_disk and only handles the
    incore -> disk conversion. A new helper xfs_sb_from_disk handles the other
    direction and doesn't need the slightly hacky table-driven approach
    because we only ever read the full sb from disk.

    The handling of shared r/o filesystems has been buggy on little endian
    system and fixing this required shuffling around of some code in that
    area.

    SGI-PV: 968563
    SGI-Modid: xfs-linux-melb:xfs-kern:29477a

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

    Christoph Hellwig
     
  • Biggest bit is duplicating the dinode structure so we have one annotated for
    native endianess and one for disk endianess. The other significant change
    is that xfs_xlate_dinode_core is split into one helper per direction to
    allow for proper annotations, everything else is trivial.

    As a sidenode splitting out the incore dinode means we can move it into
    xfs_inode.h in a later patch and severely improving on the include hell in
    xfs.

    SGI-PV: 968563
    SGI-Modid: xfs-linux-melb:xfs-kern:29476a

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

    Christoph Hellwig
     

01 Oct, 2007

1 commit


20 Sep, 2007

1 commit

  • The new xlog_recover_do_reg_buffer checks call be16_to_cpu on di_gen which
    is a 32bit value so sparse rightly complains. Fortunately the warning is
    harmless because we don't care for the value, but only whether it's
    non-NULL. Due to that fact we can simply kill the endian swaps on this and
    the previous di_mode check entirely.

    SGI-PV: 969656
    SGI-Modid: xfs-linux-melb:xfs-kern:29709a

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

    Christoph Hellwig