1. 05 Feb, 2007 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Fix DIO deadlock · c7b33834
      Steven Whitehouse authored
      This patch fixes Red Hat bugzilla #212627 in which a deadlock occurs
      due to trying to take the i_mutex while holding a glock. The correct
      locking order is defined as i_mutex -> glock in all cases.
      I've left dealing with allocating writes. I know that we need to do
      that, but for now this should do the trick. We don't need to take the
      i_mutex on write, because the VFS has already taken it for us. On read
      we don't need it since the glock is enough protection. The reason that
      I've made some of the checks into a separate function is that we'll need
      to do the checks again in the allocating write case eventually, so this
      is partly in preparation for this. Likewise the return value test of !=
      1 might look a bit odd and thats because we'll need a third return value
      in case of requiring an allocation.
      I've made the change to deferred mode on the glock to ensure flushing
      read caches on other nodes. I notice that (using blktrace to look at
      whats going on) we appear to do a better job of large I/Os than ext3
      after this patch (in terms of not splitting up the I/Os).
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      Cc: Wendy Cheng <wcheng@redhat.com>
  2. 30 Nov, 2006 7 commits
  3. 03 Nov, 2006 1 commit
  4. 20 Oct, 2006 1 commit
  5. 12 Oct, 2006 3 commits
  6. 02 Oct, 2006 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Remove uneeded endian conversion · 48516ced
      Steven Whitehouse authored
      In many places GFS2 was calling the endian conversion routines
      for an inode even when only a single field, or a few fields might
      have changed. As a result we were copying lots of data needlessly.
      This patch replaces those calls with conversion of just the
      required fields in each case. This should be faster and easier
      to understand. There are still other places which suffer from this
      problem, but this is a start in the right direction.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
  7. 25 Sep, 2006 1 commit
  8. 21 Sep, 2006 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Tidy up meta_io code · 7276b3b0
      Steven Whitehouse authored
      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
      Updated gfs2_meta_indirect_buffer to be a bit more efficient and
      hopefully also be a bit easier to read.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
  9. 20 Sep, 2006 1 commit
  10. 19 Sep, 2006 1 commit
  11. 18 Sep, 2006 3 commits
    • Steven Whitehouse's avatar
      [GFS2] Tweek unlock test in readpage() · 07903c02
      Steven Whitehouse authored
      This make the unlock test a bit simpler.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
    • Russell Cattelan's avatar
      [GFS2] Fix for mmap() bug in readpage · dc41aeed
      Russell Cattelan authored
      Fix for Red Hat bz 205307. Don't need to lock in readpage if
      the higher level code has already grabbed the lock.
      Signed-off-by: default avatarRussell Cattelan <cattelan@redhat.com>
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
    • Steven Whitehouse's avatar
      [GFS2] Map multiple blocks at once where possible · 7a6bbacb
      Steven Whitehouse authored
      This is a tidy up of the GFS2 bmap code. The main change is that the
      bh is passed to gfs2_block_map allowing the flags to be set directly
      rather than having to repeat that code several times in ops_address.c.
      At the same time, the extent mapping code from gfs2_extent_map has
      been moved into gfs2_block_map. This allows all calls to gfs2_block_map
      to map extents in the case that no allocation is taking place. As a
      result reads and non-allocating writes should be faster. A quick test
      with postmark appears to support this.
      There is a limit on the number of blocks mapped in a single bmap
      call in that it will only ever map blocks which are pointed to
      from a single pointer block. So in other words, it will never try
      to do additional i/o in order to satisfy read-ahead. The maximum
      number of blocks is thus somewhat less than 512 (the GFS2 4k block
      size minus the header divided by sizeof(u64)). I've further limited
      the mapping of "normal" blocks to 32 blocks (to avoid extra work)
      since readpages() will currently read a maximum of 32 blocks ahead (128k).
      Some further work will probably be needed to set a suitable value
      for DIO as well, but for now thats left at the maximum 512 (see
      There is probably a lot more that can be done to improve bmap for GFS2,
      but this is a good first step.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
  12. 04 Sep, 2006 3 commits
  13. 01 Sep, 2006 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Update copyright, tidy up incore.h · e9fc2aa0
      Steven Whitehouse authored
      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: default avatarSteven Whitehouse <swhiteho@redhat.com>
  14. 31 Aug, 2006 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Fix releasepage bug (fixes direct i/o writes) · 623d9355
      Steven Whitehouse authored
      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: default avatarSteven Whitehouse <swhiteho@redhat.com>
  15. 24 Aug, 2006 1 commit
  16. 18 Aug, 2006 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Fix leak of gfs2_bufdata · 15d00c0b
      Steven Whitehouse authored
      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: default avatarSteven Whitehouse <swhiteho@redhat.com>
  17. 08 Aug, 2006 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Fix lack of buffers in writepage bug · f4387149
      Steven Whitehouse authored
      In some cases we can enter write page without there being buffers
      attached to the page. In this case the function to add gfs2_bufdata
      to the buffers fails sliently causing further failures down the
      This fix ensures that we always add buffers in writepage if they
      didn't already exist (mmap is one way to trigger this).
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
  18. 04 Aug, 2006 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Fix lock ordering bug in page fault path · 59a1cc6b
      Steven Whitehouse authored
      Mmapped files were able to trigger a lock ordering bug. Private
      maps do not need to take the glock so early on. Shared maps do
      unfortunately, however we can get around that by adding a flag
      into the flags for the struct gfs2_file. This only works because
      we are taking an exclusive lock at this point, so we know that
      nobody else can be racing with us.
      Fixes Red Hat bugzilla: #201196
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
  19. 26 Jul, 2006 2 commits
  20. 25 Jul, 2006 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Alter direct I/O path · a9e5f4d0
      Steven Whitehouse authored
      As per comments received, alter the GFS2 direct I/O path so that
      it uses the standard read functions "out of the box". Needs a
      small change to one of the VFS functions. This reduces the size
      of the code quite a lot and also removes the need for one new export.
      Some more work remains to be done, but this is the bones of the
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
  21. 11 Jul, 2006 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Add generation number · 4340fe62
      Steven Whitehouse authored
      This adds a generation number for the eventual use of NFS to the
      ondisk inode. Its backward compatible with the current code since
      it doesn't really matter what the generation number is to start with,
      and indeed since its set to zero, due to it being taken from padding
      in both the inode and rgrp header, it should be fine.
      The eventual plan is to use this rather than no_formal_ino in the
      NFS filehandles. At that point no_formal_ino will be unused.
      At the same time we also add a releasepages call back to the
      "normal" address space for gfs2 inodes. Also I've removed a
      one-linrer function thats not required any more.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
  22. 10 Jul, 2006 1 commit
  23. 05 Jul, 2006 1 commit
  24. 03 Jul, 2006 1 commit
  25. 14 Jun, 2006 1 commit
    • Steven Whitehouse's avatar
      [GFS2] Fix unlinked file handling · feaa7bba
      Steven Whitehouse authored
      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
      There are a number of future possible optimisations and clean ups
      which have been made possible by this patch.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
  26. 18 May, 2006 2 commits