1. 15 3月, 2017 1 次提交
  2. 27 1月, 2017 1 次提交
  3. 06 1月, 2017 1 次提交
  4. 15 3月, 2016 1 次提交
  5. 15 12月, 2015 3 次提交
    • B
      gfs2: change gfs2 readdir cookie · 471f3db2
      Benjamin Marzinski 提交于
      gfs2 currently returns 31 bits of filename hash as a cookie that readdir
      uses for an offset into the directory.  When there are a large number of
      directory entries, the likelihood of a collision goes up way too
      quickly.  GFS2 will now return cookies that are guaranteed unique for a
      while, and then fail back to using 30 bits of filename hash.
      Specifically, the directory leaf blocks are divided up into chunks based
      on the minimum size of a gfs2 directory entry (48 bytes). Each entry's
      cookie is based off the chunk where it starts, in the linked list of
      leaf blocks that it hashes to (there are 131072 hash buckets). Directory
      entries will have unique names until they take reach chunk 8192.
      Assuming the largest filenames possible, and the least efficient spacing
      possible, this new method will still be able to return unique names when
      the previous method has statistically more than a 99% chance of a
      collision.  The non-unique names it fails back to are guaranteed to not
      collide with the unique names.
      
      unique cookies will be in this format:
      - 1 bit "0" to make sure the the returned cookie is positive
      - 17 bits for the hash table index
      - 1 bit for the mode "0"
      - 13 bits for the offset
      
      non-unique cookies will be in this format:
      - 1 bit "0" to make sure the the returned cookie is positive
      - 17 bits for the hash table index
      - 1 bit for the mode "1"
      - 13 more bits of the name hash
      
      Another benefit of location based cookies, is that once a directory's
      exhash table is fully extended (so that multiple hash table indexs do
      not use the same leaf blocks), gfs2 can skip sorting the directory
      entries until it reaches the non-unique ones, and then it only needs to
      sort these. This provides a significant speed up for directory reads of
      very large directories.
      
      The only issue is that for these cookies to continue to point to the
      correct entry as files are added and removed from the directory, gfs2
      must keep the entries at the same offset in the leaf block when they are
      split (see my previous patch). This means that until all the nodes in a
      cluster are running with code that will split the directory leaf blocks
      this way, none of the nodes can use the new cookie code. To deal with
      this, gfs2 now has the mount option loccookie, which, if set, will make
      it return these new location based cookies.  This option must not be set
      until all nodes in the cluster are at least running this version of the
      kernel code, and you have guaranteed that there are no outstanding
      cookies required by other software, such as NFS.
      
      gfs2 uses some of the extra space at the end of the gfs2_dirent
      structure to store the calculated readdir cookies. This keeps us from
      needing to allocate a seperate array to hold these values.  gfs2
      recomputes the cookie stored in de_cookie for every readdir call.  The
      time it takes to do so is small, and if gfs2 expected this value to be
      saved on disk, the new code wouldn't work correctly on filesystems
      created with an earlier version of gfs2.
      
      One issue with adding de_cookie to the union in the gfs2_dirent
      structure is that it caused the union to align itself to a 4 byte
      boundary, instead of its previous 2 byte boundary. This changed the
      offset of de_rahead. To solve that, I pulled de_rahead out of the union,
      since it does not need to be there.
      Signed-off-by: NBenjamin Marzinski <bmarzins@redhat.com>
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      471f3db2
    • B
      GFS2: Reduce size of incore inode · b58bf407
      Bob Peterson 提交于
      This patch makes no functional changes. Its goal is to reduce the
      size of the gfs2 inode in memory by rearranging structures and
      changing the size of some variables within the structure.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      b58bf407
    • B
      GFS2: Make rgrp reservations part of the gfs2_inode structure · a097dc7e
      Bob Peterson 提交于
      Before this patch, multi-block reservation structures were allocated
      from a special slab. This patch folds the structure into the gfs2_inode
      structure. The disadvantage is that the gfs2_inode needs more memory,
      even when a file is opened read-only. The advantages are: (a) we don't
      need the special slab and the extra time it takes to allocate and
      deallocate from it. (b) we no longer need to worry that the structure
      exists for things like quota management. (c) This also allows us to
      remove the calls to get_write_access and put_write_access since we
      know the structure will exist.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      a097dc7e
  6. 24 11月, 2015 1 次提交
    • B
      GFS2: Extract quota data from reservations structure (revert 5407e242) · b54e9a0b
      Bob Peterson 提交于
      This patch basically reverts the majority of patch 5407e242.
      That patch eliminated the gfs2_qadata structure in favor of just
      using the reservations structure. The problem with doing that is that
      it increases the size of the reservations structure. That is not an
      issue until it comes time to fold the reservations structure into the
      inode in memory so we know it's always there. By separating out the
      quota structure again, we aren't punishing the non-quota users by
      making all the inodes bigger, requiring more slab space. This patch
      creates a new slab area to allocate the quota stuff so it's managed
      a little more sanely.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      b54e9a0b
  7. 17 11月, 2015 1 次提交
  8. 30 10月, 2015 1 次提交
  9. 04 9月, 2015 3 次提交
  10. 19 6月, 2015 1 次提交
    • B
      GFS2: Don't add all glocks to the lru · e7ccaf5f
      Bob Peterson 提交于
      The glocks used for resource groups often come and go hundreds of
      thousands of times per second. Adding them to the lru list just
      adds unnecessary contention for the lru_lock spin_lock, especially
      considering we're almost certainly going to re-use the glock and
      take it back off the lru microseconds later. We never want the
      glock shrinker to cull them anyway. This patch adds a new bit in
      the glops that determines which glock types get put onto the lru
      list and which ones don't.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Acked-by: NSteven Whitehouse <swhiteho@redhat.com>
      e7ccaf5f
  11. 03 6月, 2015 1 次提交
    • A
      gfs2: limit quota log messages · 9cde2898
      Abhi Das 提交于
      This patch makes the quota subsystem only report once that a
      particular user/group has exceeded their allotted quota.
      
      Previously, it was possible for a program to continuously try
      exceeding quota (despite receiving EDQUOT) and in turn trigger
      gfs2 to issue a kernel log message about quota exceed. In theory,
      this could get out of hand and flood the log and the filesystem
      hosting the log files.
      Signed-off-by: NAbhi Das <adas@redhat.com>
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      9cde2898
  12. 19 3月, 2015 2 次提交
    • A
      gfs2: allow quota_check and inplace_reserve to return available blocks · 25435e5e
      Abhi Das 提交于
      struct gfs2_alloc_parms is passed to gfs2_quota_check() and
      gfs2_inplace_reserve() with ap->target containing the number of
      blocks being requested for allocation in the current operation.
      
      We add a new field to struct gfs2_alloc_parms called 'allowed'.
      gfs2_quota_check() and gfs2_inplace_reserve() return the max
      blocks allowed by quota and the max blocks allowed by the chosen
      rgrp respectively in 'allowed'.
      
      A new field 'min_target', when non-zero, tells gfs2_quota_check()
      and gfs2_inplace_reserve() to not return -EDQUOT/-ENOSPC when
      there are atleast 'min_target' blocks allowable/available. The
      assumption is that the caller is ok with just 'min_target' blocks
      and will likely proceed with allocating them.
      Signed-off-by: NAbhi Das <adas@redhat.com>
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Acked-by: NSteven Whitehouse <swhiteho@redhat.com>
      25435e5e
    • A
      gfs2: perform quota checks against allocation parameters · b8fbf471
      Abhi Das 提交于
      Use struct gfs2_alloc_parms as an argument to gfs2_quota_check()
      and gfs2_quota_lock_check() to check for quota violations while
      accounting for the new blocks requested by the current operation
      in ap->target.
      
      Previously, the number of new blocks requested during an operation
      were not accounted for during quota_check and would allow these
      operations to exceed quota. This was not very apparent since most
      operations allocated only 1 block at a time and quotas would get
      violated in the next operation. i.e. quota excess would only be by
      1 block or so. With fallocate, (where we allocate a bunch of blocks
      at once) the quota excess is non-trivial and is addressed by this
      patch.
      Signed-off-by: NAbhi Das <adas@redhat.com>
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Acked-by: NSteven Whitehouse <swhiteho@redhat.com>
      b8fbf471
  13. 17 11月, 2014 1 次提交
    • B
      GFS2: update freeze code to use freeze/thaw_super on all nodes · 2e60d768
      Benjamin Marzinski 提交于
      The current gfs2 freezing code is considerably more complicated than it
      should be because it doesn't use the vfs freezing code on any node except
      the one that begins the freeze.  This is because it needs to acquire a
      cluster glock before calling the vfs code to prevent a deadlock, and
      without the new freeze_super and thaw_super hooks, that was impossible. To
      deal with the issue, gfs2 had to do some hacky locking tricks to make sure
      that a frozen node couldn't be holding on a lock it needed to do the
      unfreeze ioctl.
      
      This patch makes use of the new hooks to simply the gfs2 locking code. Now,
      all the nodes in the cluster freeze and thaw in exactly the same way. Every
      node in the cluster caches the freeze glock in the shared state.  The new
      freeze_super hook allows the freezing node to grab this freeze glock in
      the exclusive state without first calling the vfs freeze_super function.
      All the nodes in the cluster see this lock change, and call the vfs
      freeze_super function. The vfs locking code guarantees that the nodes can't
      get stuck holding the glocks necessary to unfreeze the system.  To
      unfreeze, the freezing node uses the new thaw_super hook to drop the freeze
      glock. Again, all the nodes notice this, reacquire the glock in shared mode
      and call the vfs thaw_super function.
      Signed-off-by: NBenjamin Marzinski <bmarzins@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      2e60d768
  14. 04 11月, 2014 1 次提交
  15. 11 9月, 2014 1 次提交
  16. 03 6月, 2014 1 次提交
  17. 14 5月, 2014 1 次提交
    • B
      GFS2: remove transaction glock · 24972557
      Benjamin Marzinski 提交于
      GFS2 has a transaction glock, which must be grabbed for every
      transaction, whose purpose is to deal with freezing the filesystem.
      Aside from this involving a large amount of locking, it is very easy to
      make the current fsfreeze code hang on unfreezing.
      
      This patch rewrites how gfs2 handles freezing the filesystem. The
      transaction glock is removed. In it's place is a freeze glock, which is
      cached (but not held) in a shared state by every node in the cluster
      when the filesystem is mounted. This lock only needs to be grabbed on
      freezing, and actions which need to be safe from freezing, like
      recovery.
      
      When a node wants to freeze the filesystem, it grabs this glock
      exclusively.  When the freeze glock state changes on the nodes (either
      from shared to unlocked, or shared to exclusive), the filesystem does a
      special log flush.  gfs2_log_flush() does all the work for flushing out
      the and shutting down the incore log, and then it tries to grab the
      freeze glock in a shared state again.  Since the filesystem is stuck in
      gfs2_log_flush, no new transaction can start, and nothing can be written
      to disk. Unfreezing the filesytem simply involes dropping the freeze
      glock, allowing gfs2_log_flush() to grab and then release the shared
      lock, so it is cached for next time.
      
      However, in order for the unfreezing ioctl to occur, gfs2 needs to get a
      shared lock on the filesystem root directory inode to check permissions.
      If that glock has already been grabbed exclusively, fsfreeze will be
      unable to get the shared lock and unfreeze the filesystem.
      
      In order to allow the unfreeze, this patch makes gfs2 grab a shared lock
      on the filesystem root directory during the freeze, and hold it until it
      unfreezes the filesystem.  The functions which need to grab a shared
      lock in order to allow the unfreeze ioctl to be issued now use the lock
      grabbed by the freeze code instead.
      
      The freeze and unfreeze code take care to make sure that this shared
      lock will not be dropped while another process is using it.
      Signed-off-by: NBenjamin Marzinski <bmarzins@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      24972557
  18. 31 3月, 2014 1 次提交
  19. 07 3月, 2014 1 次提交
  20. 03 3月, 2014 1 次提交
    • S
      GFS2: Clean up journal extent mapping · b50f227b
      Steven Whitehouse 提交于
      This patch fixes a long standing issue in mapping the journal
      extents. Most journals will consist of only a single extent,
      and although the cache took account of that by merging extents,
      it did not actually map large extents, but instead was doing a
      block by block mapping. Since the journal was only being mapped
      on mount, this was not normally noticeable.
      
      With the updated code, it is now possible to use the same extent
      mapping system during journal recovery (which will be added in a
      later patch). This will allow checking of the integrity of the
      journal before any reply of the journal content is attempted. For
      this reason the code is moving to bmap.c, since it will be used
      more widely in due course.
      
      An exercise left for the reader is to compare the new function
      gfs2_map_journal_extents() with gfs2_write_alloc_required()
      
      Additionally, should there be a failure, the error reporting is
      also updated to show more detail about what went wrong.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      b50f227b
  21. 25 2月, 2014 2 次提交
    • S
      GFS2: Move log buffer accounting to transaction · 022ef4fe
      Steven Whitehouse 提交于
      Now we have a master transaction into which other transactions
      are merged, the accounting can be done using this master
      transaction. We no longer require the superblock fields which
      were being used for this function.
      
      In addition, this allows for a clean up in calc_reserved()
      making it rather easier understand. Also, by reducing the
      number of variables used to track the buffers being added
      and removed from the journal, a number of error checks are
      now no longer required.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      022ef4fe
    • S
      GFS2: Move log buffer lists into transaction · d69a3c65
      Steven Whitehouse 提交于
      Over time, we hope to be able to improve the concurrency available
      in the log code. This is one small step towards that, by moving
      the buffer lists from the super block, and into the transaction
      structure, so that each transaction builds its own buffer lists.
      
      At transaction commit time, the buffer lists are merged into
      the currently accumulating transaction. That transaction then
      is passed into the before and after commit functions at journal
      flush time. Thus there should be no change in overall behaviour
      yet.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      d69a3c65
  22. 21 2月, 2014 1 次提交
  23. 16 1月, 2014 1 次提交
    • S
      GFS2: Don't use ENOBUFS when ENOMEM is the correct error code · ac3beb6a
      Steven Whitehouse 提交于
      Al Viro has tactfully pointed out that we are using the incorrect
      error code in some cases. This patch fixes that, and also removes
      the (unused) return value for glock dumping.
      
      >        * gfs2_iget() - ENOBUFS instead of ENOMEM.  ENOBUFS is
      > "No buffer space available (POSIX.1 (XSI STREAMS option))" and since
      > we don't support STREAMS it's probably fair game, but... what the hell?
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      ac3beb6a
  24. 15 1月, 2014 3 次提交
    • S
      GFS2: Move quota bitmap operations under their own lock · 2d9e7230
      Steven Whitehouse 提交于
      Gradually, the global qd_lock is being used for less and less.
      After this patch it will only be used for the per super block
      list whose purpose is to allow syncing of changes back to the
      master quota file from the local quota changes file. Fixing
      up that process to make it more efficient will be the subject
      of a later patch, however this patch removes another barrier
      to doing that.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Abhijith Das <adas@redhat.com>
      2d9e7230
    • S
      GFS2: Clean up quota slot allocation · ee2411a8
      Steven Whitehouse 提交于
      Quota slot allocation has historically used a vector of pages
      and a set of homegrown find/test/set/clear bit functions. Since
      the size of the bitmap is likely to be based on the default
      qc file size, thats a couple of pages at most. So we ought
      to be able to allocate that as a single chunk, with a vmalloc
      fallback, just in case of memory fragmentation.
      
      We are then able to use the kernel's own find/test/set/clear
      bit functions, rather than rolling our own.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Abhijith Das <adas@redhat.com>
      ee2411a8
    • S
      GFS2: Use RCU/hlist_bl based hash for quotas · c754fbbb
      Steven Whitehouse 提交于
      Prior to this patch, GFS2 kept all the quotas for each
      super block in a single linked list. This is rather slow
      when there are large numbers of quotas.
      
      This patch introduces a hlist_bl based hash table, similar
      to the one used for glocks. The initial look up of the quota
      is now lockless in the case where it is already cached,
      although we still have to take the per quota spinlock in
      order to bump the ref count. Either way though, this is a
      big improvement on what was there before.
      
      The qd_lock and the per super block list is preserved, for
      the time being. However it is intended that since this is no
      longer used for its original role, it should be possible to
      shrink the number of items on that list in due course and
      remove the requirement to take qd_lock in qd_get.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Abhijith Das <adas@redhat.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      c754fbbb
  25. 03 1月, 2014 3 次提交
    • S
      GFS2: Use only a single address space for rgrps · 70d4ee94
      Steven Whitehouse 提交于
      Prior to this patch, GFS2 had one address space for each rgrp,
      stored in the glock. This patch changes them to use a single
      address space in the super block. This therefore saves
      (sizeof(struct address_space) * nr_of_rgrps) bytes of memory
      and for large filesystems, that can be significant.
      
      It would be nice to be able to do something similar and merge
      the inode metadata address space into the same global
      address space. However, that is rather more complicated as the
      on-disk location doesn't have a 1:1 mapping with the inodes in
      general. So while it could be done, it will be a more complicated
      operation as it requires changing a lot more code paths.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      70d4ee94
    • S
      GFS2: Use range based functions for rgrp sync/invalidation · 7005c3e4
      Steven Whitehouse 提交于
      Each rgrp header is represented as a single extent on disk, so we
      can calculate the position within the address space, since we are
      using address spaces mapped 1:1 to the disk. This means that it
      is possible to use the range based versions of filemap_fdatawrite/wait
      and for invalidating the page cache.
      
      Our eventual intent is to then be able to merge the address spaces
      used for rgrps into a single address space, rather than to have
      one for each glock, saving memory and reducing complexity.
      
      Since during umount, the rgrp structures are disposed of before
      the glocks, we need to store the extent information in the glock
      so that is is available for a final invalidation. This patch uses
      a field which is otherwise unused in rgrp glocks to do that, so
      that we do not have to expand the size of a glock.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      7005c3e4
    • B
      GFS2: Implement a "rgrp has no extents longer than X" scheme · 5ea5050c
      Bob Peterson 提交于
      With the preceding patch, we started accepting block reservations
      smaller than the ideal size, which requires a lot more parsing of the
      bitmaps. To reduce the amount of bitmap searching, this patch
      implements a scheme whereby each rgrp keeps track of the point
      at this multi-block reservations will fail.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      5ea5050c
  26. 04 11月, 2013 2 次提交
  27. 15 10月, 2013 1 次提交
    • S
      GFS2: Use lockref for glocks · e66cf161
      Steven Whitehouse 提交于
      Currently glocks have an atomic reference count and also a spinlock
      which covers various internal fields, such as the state. This intent of
      this patch is to replace the spinlock and the atomic reference count
      with a lockref structure. This contains a spinlock which we can continue
      to use as before, and a reference counter which is used in conjuction
      with the spinlock to replace the previous atomic counter.
      
      As a result of this there are some new rules for reference counting on
      glocks. We need to distinguish between reference count changes under
      gl_spin (which are now just increment or decrement of the new counter,
      provided the count cannot hit zero) and those which are outside of
      gl_spin, but which now take gl_spin internally.
      
      The conversion is relatively straight forward. There is probably some
      further clean up which can be done, but the priority at this stage is to
      make the change in as simple a manner as possible.
      
      A consequence of this change is that the reference count is being
      decoupled from the lru list processing. This should allow future
      adoption of the lru_list code with glocks in due course.
      
      The reason for using the "dead" state and not just relying on 0 being
      the "invalid state" is so that in due course 0 ref counts can be
      allowable. The intent is to eventually be able to remove the ref count
      changes which are currently hidden away in state_change().
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      e66cf161
  28. 04 10月, 2013 2 次提交
    • S
      GFS2: Protect quota sync generation · e46c772d
      Steven Whitehouse 提交于
      Now that gfs2_quota_sync can be potentially called from multiple
      threads, we should protect this bit of code, and the sync generation
      number in particular in order to ensure that there are no races
      when syncing quotas.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Abhijith Das <adas@redhat.com>
      e46c772d
    • S
      GFS2: Remove obsolete quota tunable · bef292a7
      Steven Whitehouse 提交于
      There is no need for a paramater which relates to the internals
      of quota to be exposed to users. The only possible use would be
      to turn it up so large that the memory allocation fails. So lets
      remove it and set it to a sensible value which ensures that we
      don't ask for multipage allocations.
      
      Currently the size of struct gfs2_holder means that the caluclated
      value is identical to the previous default value, so there should
      be no functional change.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Abhijith Das <adas@redhat.com>
      bef292a7