1. 12 6月, 2009 1 次提交
    • S
      GFS2: Add tracepoints · 63997775
      Steven Whitehouse 提交于
      This patch adds the ability to trace various aspects of the GFS2
      filesystem. The trace points are divided into three groups,
      glocks, logging and bmap. These points have been chosen because
      they allow inspection of the major internal functions of GFS2
      and they are also generic enough that they are unlikely to need
      any major changes as the filesystem evolves.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      63997775
  2. 11 5月, 2009 1 次提交
  3. 24 3月, 2009 1 次提交
    • S
      GFS2: Merge lock_dlm module into GFS2 · f057f6cd
      Steven Whitehouse 提交于
      This is the big patch that I've been working on for some time
      now. There are many reasons for wanting to make this change
      such as:
       o Reducing overhead by eliminating duplicated fields between structures
       o Simplifcation of the code (reduces the code size by a fair bit)
       o The locking interface is now the DLM interface itself as proposed
         some time ago.
       o Fewer lookups of glocks when processing replies from the DLM
       o Fewer memory allocations/deallocations for each glock
       o Scope to do further optimisations in the future (but this patch is
         more than big enough for now!)
      
      Please note that (a) this patch relates to the lock_dlm module and
      not the DLM itself, that is still a separate module; and (b) that
      we retain the ability to build GFS2 as a standalone single node
      filesystem with out requiring the DLM.
      
      This patch needs a lot of testing, hence my keeping it I restarted
      my -git tree after the last merge window. That way, this has the maximum
      exposure before its merged. This is (modulo a few minor bug fixes) the
      same patch that I've been posting on and off the the last three months
      and its passed a number of different tests so far.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      f057f6cd
  4. 31 3月, 2008 2 次提交
  5. 25 1月, 2008 2 次提交
    • S
      [GFS2] Don't add glocks to the journal · 2bcd610d
      Steven Whitehouse 提交于
      The only reason for adding glocks to the journal was to keep track
      of which locks required a log flush prior to release. We add a
      flag to the glock to allow this check to be made in a simpler way.
      
      This reduces the size of a glock (by 12 bytes on i386, 24 on x86_64)
      and means that we can avoid extra work during the journal flush.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      2bcd610d
    • S
      [GFS2] Split gfs2_writepage into three cases · 9ff8ec32
      Steven Whitehouse 提交于
      This patch splits gfs2_writepage into separate functions for each of
      the three cases: writeback, ordered and journalled. As a result
      it becomes a lot easier to see what each one is doing. The common
      code is moved into gfs2_writepage_common.
      
      This fixes a performance bug where we were doing more work than
      strictly required in the ordered write case.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      9ff8ec32
  6. 10 10月, 2007 8 次提交
    • S
      [GFS2] Clean up journaled data writing · 16615be1
      Steven Whitehouse 提交于
      This patch cleans up the code for writing journaled data into the log.
      It also removes the need to allocate a small "tag" structure for each
      block written into the log. Instead we just keep count of the outstanding
      I/O so that we can be sure that its all been written at the correct time.
      Another result of this patch is that a number of ll_rw_block() calls
      have become submit_bh() calls, closing some races at the same time.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      16615be1
    • S
      [GFS2] Clean up gfs2_trans_add_revoke() · 1ad38c43
      Steven Whitehouse 提交于
      The following alters gfs2_trans_add_revoke() to take a struct
      gfs2_bufdata as an argument. This eliminates the memory allocation which
      was previously required by making use of the already existing struct
      gfs2_bufdata. It makes some sanity checks to ensure that the
      gfs2_bufdata has been removed from all the lists before its recycled as
      a revoke structure. This saves one memory allocation and one free per
      revoke structure.
      
      Also as a result, and to simplify the locking, since there is no longer
      any blocking code in gfs2_trans_add_revoke() we must hold the log lock
      whenever this function is called. This reduces the amount of times we
      take and unlock the log lock.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      1ad38c43
    • S
      [GFS2] Use slab operations for all gfs2_bufdata allocations · 0820ab51
      Steven Whitehouse 提交于
      The old revoke structure was allocated using kalloc/kfree but
      there is a slab cache for gfs2_bufdata, so we should use that
      now that the structures have been converted.
      
      This is part two of the patch series to merge the revoke
      and gfs2_bufdata structures.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      0820ab51
    • S
      [GFS2] Replace revoke structure with bufdata structure · 82e86087
      Steven Whitehouse 提交于
      Both the revoke structure and the bufdata structure are quite similar.
      They are basically small tags which are put on lists. In addition to
      which the revoke structure is always allocated when there is a bufdata
      structure which is (or can be) freed. As such it should be possible to
      reduce the number of frees and allocations by using the same structure
      for both purposes.
      
      This patch is the first step along that path. It replaces existing uses
      of the revoke structure with the bufdata structure.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      82e86087
    • S
      [GFS2] Clean up ordered write code · d7b616e2
      Steven Whitehouse 提交于
      The following patch removes the ordered write processing from
      databuf_lo_before_commit() and moves it to log.c. This has the effect of
      greatly simplyfying databuf_lo_before_commit() and well as potentially
      making the ordered write code more efficient.
      
      As a side effect of this, its now possible to remove ordered buffers
      from the ordered buffer list at any time, so we now make use of this in
      invalidatepage and releasepage to ensure timely release of these
      buffers.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      d7b616e2
    • S
      [GFS2] Move pin/unpin into lops.c, clean up locking · 9b9107a5
      Steven Whitehouse 提交于
      gfs2_pin and gfs2_unpin are only used in lops.c, despite being
      defined in meta_io.c, so this patch moves them into lops.c and
      makes them static. At the same time, its possible to clean up
      the locking in the buf and databuf _lo_add() functions so that
      we only need to grab the spinlock once. Also we have to move
      lock_buffer() around the _lo_add() functions since we can't
      do that in gfs2_pin() any more since we hold the spinlock
      for the duration of that function.
      
      As a result, the code shrinks by 12 lines and we do far fewer
      operations when adding buffers to the log. It also makes the
      code somewhat easier to read & understand.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      9b9107a5
    • B
      [GFS2] Patch to protect sd_log_num_jdata · ec217e0e
      Bob Peterson 提交于
      This is a patch to GFS2 to protect sd_log_num_jdata with the
      gfs2_log_lock.  Without this patch, there is a timing window
      where you can get hit the following assert from function
      gfs2_log_flush():
      
      gfs2_assert_withdraw(sdp,
      			sdp->sd_log_num_buf + sdp->sd_log_num_jdata ==
      			sdp->sd_log_commited_buf +
      			sdp->sd_log_commited_databuf);
      
      I've tested it on my roth cluster and it fixes the problem.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      ec217e0e
    • B
      [GFS2] Move some code inside the log lock · 905d2aef
      Bob Peterson 提交于
      This is the first of five patches for bug #248176:
      
      There were still some critical variables being manipulated outside
      the log_lock spinlock.  That usually resulted in a hang.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      905d2aef
  7. 14 8月, 2007 1 次提交
    • B
      [GFS2] soft lockup detected in databuf_lo_before_commit · bdcb8856
      Bob Peterson 提交于
      This is part 2 of the patch for bug #245832, part 1 of which is already
      in the git tree.
      
      The problem was that sdp->sd_log_num_databuf was not always being
      protected by the gfs2_log_lock spinlock, but the sd_log_le_databuf
      (which it is supposed to reflect) was protected.  That meant there
      was a timing window during which gfs2_log_flush called
      databuf_lo_before_commit and the count didn't match what was
      really on the linked list in that window.  So when it ran out of
      items on the linked list, it decremented total_dbuf from 0 to -1 and
      thus never left the "while(total_dbuf)" loop.
      
      The solution is to protect the variable sdp->sd_log_num_databuf so
      that the value will always match the contents of the linked list,
      and therefore the number will never go negative, and therefore, the
      loop will be exited properly.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      bdcb8856
  8. 09 7月, 2007 4 次提交
    • R
      [GFS2] Addendum to the journaled file/unmount patch · 773ed1a0
      Robert Peterson 提交于
      This patch is an addendum to the previous journaled file/unmount patch.
      It fixes a problem discovered during testing.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      773ed1a0
    • R
      [GFS2] assertion failure after writing to journaled file, umount · 2332c443
      Robert Peterson 提交于
      This patch passes all my nasty tests that were causing the code to
      fail under one circumstance or another.  Here is a complete summary
      of all changes from today's git tree, in order of appearance:
      
      1. There are now separate variables for metadata buffer accounting.
      2. Variable sd_log_num_hdrs is no longer needed, since the header
         accounting is taken care of by the reserve/refund sequence.
      3. Fixed a tiny grammatical problem in a comment.
      4. Added a new function "calc_reserved" to calculate the reserved
         log space.  This isn't entirely necessary, but it has two benefits:
         First, it simplifies the gfs2_log_refund function greatly.
         Second, it allows for easier debugging because I could sprinkle the
         code with calls to this function to make sure the accounting is
         proper (by adding asserts and printks) at strategic point of the code.
      5. In log_pull_tail there apparently was a kludge to fix up the
         accounting based on a "pull" parameter.  The buffer accounting is
         now done properly, so the kludge was removed.
      6. File sync operations were making a call to gfs2_log_flush that
         writes another journal header.  Since that header was unplanned
         for (reserved) by the reserve/refund sequence, the free space had
         to be decremented so that when log_pull_tail gets called, the free
         space is be adjusted properly.  (Did I hear you call that a kludge?
         well, maybe, but a lot more justifiable than the one I removed).
      7. In the gfs2_log_shutdown code, it optionally syncs the log by
         specifying the PULL parameter to log_write_header.  I'm not sure
         this is necessary anymore.  It just seems to me there could be
         cases where shutdown is called while there are outstanding log
         buffers.
      8. In the (data)buf_lo_before_commit functions, I changed some offset
         values from being calculated on the fly to being constants.	That
         simplified some code and we might as well let the compiler do the
         calculation once rather than redoing those cycles at run time.
      9. This version has my rewritten databuf_lo_add function.
         This version is much more like its predecessor, buf_lo_add, which
         makes it easier to understand.  Again, this might not be necessary,
         but it seems as if this one works as well as the previous one,
         maybe even better, so I decided to leave it in.
      10. In databuf_lo_before_commit, a previous data corruption problem
         was caused by going off the end of the buffer.  The proper solution
         is to have the proper limit in place, rather than stopping earlier.
         (Thus my previous attempt to fix it is wrong).
         If you don't wrap the buffer, you're stopping too early and that
         causes more log buffer accounting problems.
      11. In lops.h there are two new (previously mentioned) constants for
         figuring out the data offset for the journal buffers.
      12. There are also two new functions, buf_limit and databuf_limit to
         calculate how many entries will fit in the buffer.
      13. In function gfs2_meta_wipe, it needs to distinguish between pinned
         metadata buffers and journaled data buffers for proper journal buffer
         accounting.	It can't use the JDATA gfs2_inode flag because it's
         sometimes passed the "real" inode and sometimes the "metadata
         inode" and the inode flags will be random bits in a metadata
         gfs2_inode.	It needs to base its decision on which was passed in.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      2332c443
    • R
      [GFS2] Journaled file write/unstuff bug · 8fb68595
      Robert Peterson 提交于
      This patch is for bugzilla bug 283162, which uncovered a number of
      bugs pertaining to writing to files that have the journaled bit on.
      These bugs happen most often when writing to the meta_fs because
      the files are always journaled.  So operations like gfs2_grow were
      particularly vulnerable, although many of the problems could be
      recreated with normal files after setting the journaled bit on.
      The problems fixed are:
      
      -GFS2 wasn't ever writing unstuffed journaled data blocks to their
       in-place location on disk. Now it does.
      
      -If you unmounted too quickly after doing IO to a journaled file,
       GFS2 was crashing because you would discard a buffer whose bufdata
       was still on the active items list.  GFS2 now deals with this
       gracefully.
      
      -GFS2 was losing track of the bufdata for journaled data blocks,
       and it wasn't getting freed, causing an error when you tried to
       unmount the module.  GFS2 now frees all the bufdata structures.
      
      -There was a memory corruption occurring because GFS2 wrote
       twice as many log entries for journaled buffers.
      
      -It was occasionally trying to write journal headers in buffers
       that weren't currently mapped.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NBenjamin Marzinski <bmarzins@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      8fb68595
    • B
      [GFS2] fix jdata issues · ddf4b426
      Benjamin Marzinski 提交于
      This is a patch for the first three issues of RHBZ #238162
      
      The first issue is that when you allocate a new page for a file, it will not
      start off uptodate. This makes sense, since you haven't written anything to that
      part of the file yet.  Unfortunately, gfs2_pin() checks to make sure that the
      buffers are uptodate.  The solution to this is to mark the buffers uptodate in
      gfs2_commit_write(), after they have been zeroed out and have the data written
      into them.  I'm pretty confident with this fix, although it's not completely
      obvious that there is no problem with marking the buffers uptodate here.
      
      The second issue is simply that you can try to pin a data buffer that is already
      on the incore log, and thus, already pinned. This patch checks to see if this
      buffer is already on the log, and exits databuf_lo_add() if it is, just like
      buf_lo_add() does.
      
      The third issue is that gfs2_log_flush() doesn't do it's block accounting
      correctly.  Both metadata and journaled data are logged, but gfs2_log_flush()
      only compares the number of metadata blocks with the number of blocks to commit
      to the ondisk journal.  This patch also counts the journaled data blocks.
      Signed-off-by: NBenjamin Marzinski <bmarzins@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      ddf4b426
  9. 01 5月, 2007 1 次提交
    • B
      [GFS2] Fix log entry list corruption · 68835625
      Benjamin Marzinski 提交于
      When glock_lo_add and rg_lo_add attempt to add an element to the log, they
      check to see if has already been added before locking the log. If another
      process adds that element to the log in this window between the check and
      locking the log, the element will be added to the list twice. This causes
      the log element list to become corrupted in such a way that the log element
      can never be successfully removed from the list. This patch pulls the
      list_empty() check inside the log lock, to remove this window.
      Signed-off-by: NBenjamin E. Marzinski <bmarzins@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      68835625
  10. 06 2月, 2007 1 次提交
    • S
      [GFS2] Fix list corruption in lops.c · 8bd95727
      Steven Whitehouse 提交于
      The patch below appears to fix the list corruption that we are seeing on
      occasion. Although the transaction structure is private to a single
      thread, when the queued structures are dismantled during an in-core
      commit, its possible for a different thread to be trying to add the same
      structure to another, new, transaction at the same time.
      
      To avoid this, this patch takes the log spinlock during this operation.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      8bd95727
  11. 30 11月, 2006 2 次提交
  12. 13 10月, 2006 1 次提交
  13. 25 9月, 2006 1 次提交
  14. 22 9月, 2006 1 次提交
    • S
      [GFS2] Tidy up meta_io code · 7276b3b0
      Steven Whitehouse 提交于
      Fix a bug in the directory reading code, where we might have dereferenced
      a NULL pointer in case of OOM. Updated the directory code to use the new
      & improved version of gfs2_meta_ra() which now returns the first block
      that was being read. Previously it was releasing it requiring following
      code to grab the block again at each point it was called.
      
      Also turned off readahead on directory lookups since we are reading a
      hash table, and therefore reading the entries in order is very
      unlikely. Readahead is still used for all other calls to the
      directory reading function (e.g. when growing the hash table).
      
      Removed the DIO_START constant. Everywhere this was used, it was
      used to unconditionally start i/o aside from a couple of places, so
      I've removed it and made the couple of exceptions to this rule into
      separate functions.
      
      Also hunted through the other DIO flags and removed them as arguments
      from functions which were always called with the same combination of
      arguments.
      
      Updated gfs2_meta_indirect_buffer to be a bit more efficient and
      hopefully also be a bit easier to read.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      7276b3b0
  15. 19 9月, 2006 1 次提交
  16. 06 9月, 2006 1 次提交
  17. 05 9月, 2006 3 次提交
  18. 01 9月, 2006 2 次提交
    • S
      [GFS2] Update copyright, tidy up incore.h · e9fc2aa0
      Steven Whitehouse 提交于
      As per comments from Jan Engelhardt <jengelh@linux01.gwdg.de> this
      updates the copyright message to say "version" in full rather than
      "v.2". Also incore.h has been updated to remove forward structure
      declarations which are not required.
      
      The gfs2_quota_lvb structure has now had endianess annotations added
      to it. Also quota.c has been updated so that we now store the
      lvb data locally in endian independant format to avoid needing
      a structure in host endianess too. As a result the endianess
      conversions are done as required at various points and thus the
      conversion routines in lvb.[ch] are no longer required. I've
      moved the one remaining constant in lvb.h thats used into lm.h
      and removed the unused lvb.[ch].
      
      I have not changed the HIF_ constants. That is left to a later patch
      which I hope will unify the gh_flags and gh_iflags fields of the
      struct gfs2_holder.
      
      Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      e9fc2aa0
    • S
      [GFS2] Fix releasepage bug (fixes direct i/o writes) · 623d9355
      Steven Whitehouse 提交于
      This patch fixes three main bugs. Firstly the direct i/o get_block
      was returning the wrong return code in certain cases. Secondly, the
      GFS2's releasepage function was not dealing with cases when clean,
      ordered buffers were found still queued on a transaction (which can
      happen depending on the ordering of journal flushes). Thirdly, the
      journaling code itself needed altering to take account of the
      after effects of removing the clean ordered buffers from the transactions
      before a journal flush.
      
      The releasepage bug did also show up under "normal" buffered i/o
      as well, so its not just a fix for direct i/o. In fact its not
      normally used in the direct i/o path at all, except when flushing
      existing buffers after performing a direct i/o write, but that was
      the code path that led us to spot this.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      623d9355
  19. 23 8月, 2006 1 次提交
  20. 22 8月, 2006 1 次提交
  21. 19 8月, 2006 1 次提交
    • S
      [GFS2] Fix leak of gfs2_bufdata · 15d00c0b
      Steven Whitehouse 提交于
      This fixes a memory leak of struct gfs2_bufdata and also some
      problems in the ordered write handling code. It needs a bit
      more testing, but I believe that the reference counting of
      ordered write buffers should now be correct.
      
      This is aimed at fixing Red Hat bugzilla: #201028 and #201082
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      15d00c0b
  22. 19 6月, 2006 2 次提交
  23. 15 6月, 2006 1 次提交
    • S
      [GFS2] Fix unlinked file handling · feaa7bba
      Steven Whitehouse 提交于
      This patch fixes the way we have been dealing with unlinked,
      but still open files. It removes all limits (other than memory
      for inodes, as per every other filesystem) on numbers of these
      which we can support on GFS2. It also means that (like other
      fs) its the responsibility of the last process to close the file
      to deallocate the storage, rather than the person who did the
      unlinking. Note that with GFS2, those two events might take place
      on different nodes.
      
      Also there are a number of other changes:
      
       o We use the Linux inode subsystem as it was intended to be
      used, wrt allocating GFS2 inodes
       o The Linux inode cache is now the point which we use for
      local enforcement of only holding one copy of the inode in
      core at once (previous to this we used the glock layer).
       o We no longer use the unlinked "special" file. We just ignore it
      completely. This makes unlinking more efficient.
       o We now use the 4th block allocation state. The previously unused
      state is used to track unlinked but still open inodes.
       o gfs2_inoded is no longer needed
       o Several fields are now no longer needed (and removed) from the in
      core struct gfs2_inode
       o Several fields are no longer needed (and removed) from the in core
      superblock
      
      There are a number of future possible optimisations and clean ups
      which have been made possible by this patch.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      feaa7bba