1. 22 5月, 2012 7 次提交
    • N
      md/bitmap: record the space available for the bitmap in the superblock. · 1dff2b87
      NeilBrown 提交于
      Now that bitmaps can grow and shrink it is best if we record
      how much space is available.  This means that when
      we reduce the size of the bitmap we won't "lose" the space
      for late when we might want to increase the size of the bitmap
      again.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      1dff2b87
    • N
      md/bitmap: add bitmap_resize function to allow bitmap resizing. · d60b479d
      NeilBrown 提交于
      This function will allocate the new data structures and copy
      bits across from old to new, allowing for the possibility that the
      chunksize has changed.
      
      Use the same function for performing the initial allocation
      of the structures.  This improves test coverage.
      
      When bitmap_resize is used to resize an existing bitmap, it
      only copies '1' bits in, not '0' bits.
      So when allocating the bitmap, ensure everything is initialised
      to ZERO.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      d60b479d
    • N
      md/bitmap: create a 'struct bitmap_counts' substructure of 'struct bitmap' · 40cffcc0
      NeilBrown 提交于
      The new "struct bitmap_counts" contains all the fields that are
      related to counting the number of active writes in each bitmap chunk.
      
      Having this separate will make it easier to change the chunksize
      or overall size of a bitmap atomically.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      40cffcc0
    • N
      md/bitmap: use set_bit, test_bit, etc for operation on bitmap->flags. · b405fe91
      NeilBrown 提交于
      We currently use '&' and '|' which isn't the norm in the kernel
      and doesn't allow easy atomicity.
      So change to bit numbers and {set,clear,test}_bit.
      This allows us to remove a spinlock/unlock (which was dubious anyway)
      and some other simplifications.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      b405fe91
    • N
      md/bitmap: store bytes in file rather than just in last page. · 9b1215c1
      NeilBrown 提交于
      This number is more generally useful, and bytes-in-last-page is
      easily extracted from it.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      9b1215c1
    • N
      md/bitmap: move some fields of 'struct bitmap' into a 'storage' substruct. · 1ec885cd
      NeilBrown 提交于
      This new 'struct bitmap_storage' reflects the external storage of the
      bitmap.
      Having this clearly defined will make it easier to change the storage
      used while the array is active.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      1ec885cd
    • N
      md/bitmap: disentangle two different 'pending' flags. · bf07bb7d
      NeilBrown 提交于
      There are two different 'pending' concepts in the handling of the
      write intent bitmap.
      
      Firstly, a 'page' from the bitmap (which container PAGE_SIZE*8 bits)
      may have changes (bits cleared) that should be written in due course.
      There is no hurry for these and the page will transition from
      PENDING to NEEDWRITE and will then be written, though if it ever
      becomes DIRTY it will be written much sooner and PENDING will be
      cleared.
      
      Secondly, a page of counters - which contains PAGE_SIZE/2 counters, one
      for each bit, can usefully have a 'pending' flag which indicates if
      any of the counters are low (2 or 1) and ready to be processed by
      bitmap_daemon_work().  If this flag is clear we can skip the whole
      page.
      
      These two concepts are currently combined in the bitmap-file flag.
      This causes a tighter connection between the counters and the bitmap
      file than I would like - as I want to add some flexibility to the
      bitmap file.
      
      So introduce a new flag with the page-of-counters, and rewrite
      bitmap_daemon_work() so that it handles the two different 'pending'
      concepts separately.
      
      This also allows us to clear BITMAP_PAGE_PENDING when we write out
      a dirty page, which may occasionally reduce the number of times we
      write a page.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      bf07bb7d
  2. 04 5月, 2012 1 次提交
  3. 19 3月, 2012 3 次提交
  4. 11 10月, 2011 1 次提交
  5. 27 7月, 2011 1 次提交
  6. 09 6月, 2011 1 次提交
  7. 31 3月, 2011 1 次提交
  8. 28 10月, 2010 1 次提交
  9. 26 7月, 2010 2 次提交
  10. 18 5月, 2010 2 次提交
    • N
      md/raid1: delay reads that could overtake behind-writes. · e555190d
      NeilBrown 提交于
      When a raid1 array is configured to support write-behind
      on some devices, it normally only reads from other devices.
      If all devices are write-behind (because the rest have failed)
      it is possible for a read request to be serviced before a
      behind-write request, which would appear as data corruption.
      
      So when forced to read from a WriteMostly device, wait for any
      write-behind to complete, and don't start any more behind-writes.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      e555190d
    • P
      md: expose max value of behind writes counter · 696fcd53
      Paul Clements 提交于
      Keep track of the maximum number of concurrent write-behind requests
      for an md array and exposed this number in sysfs at
         md/bitmap/max_backlog_used
      
      Writing any value to this file will clear it.
      
      This allows userspace to be involved in tuning bitmap/backlog.
      Signed-off-by: NPaul Clements <paul.clements@steeleye.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      696fcd53
  11. 14 12月, 2009 3 次提交
  12. 31 3月, 2009 1 次提交
  13. 28 6月, 2008 1 次提交
    • N
      Improve setting of "events_cleared" for write-intent bitmaps. · a0da84f3
      Neil Brown 提交于
      When an array is degraded, bits in the write-intent bitmap are not
      cleared, so that if the missing device is re-added, it can be synced
      by only updated those parts of the device that have changed since
      it was removed.
      
      The enable this a 'events_cleared' value is stored. It is the event
      counter for the array the last time that any bits were cleared.
      
      Sometimes - if a device disappears from an array while it is 'clean' -
      the events_cleared value gets updated incorrectly (there are subtle
      ordering issues between updateing events in the main metadata and the
      bitmap metadata) resulting in the missing device appearing to require
      a full resync when it is re-added.
      
      With this patch, we update events_cleared precisely when we are about
      to clear a bit in the bitmap.  We record events_cleared when we clear
      the bit internally, and copy that to the superblock which is written
      out before the bit on storage.  This makes it more "obviously correct".
      
      We also need to update events_cleared when the event_count is going
      backwards (as happens on a dirty->clean transition of a non-degraded
      array).
      
      Thanks to Mike Snitzer for identifying this problem and testing early
      "fixes".
      
      Cc:  "Mike Snitzer" <snitzer@gmail.com>
      Signed-off-by: NNeil Brown <neilb@suse.de>
      a0da84f3
  14. 25 5月, 2008 1 次提交
  15. 05 3月, 2008 1 次提交
  16. 07 2月, 2008 1 次提交
    • N
      md: Update md bitmap during resync. · b47490c9
      NeilBrown 提交于
      Currently an md array with a write-intent bitmap does not updated that bitmap
      to reflect successful partial resync.  Rather the entire bitmap is updated
      when the resync completes.
      
      This is because there is no guarentee that resync requests will complete in
      order, and tracking each request individually is unnecessarily burdensome.
      
      However there is value in regularly updating the bitmap, so add code to
      periodically pause while all pending sync requests complete, then update the
      bitmap.  Doing this only every few seconds (the same as the bitmap update
      time) does not notciably affect resync performance.
      
      [snitzer@gmail.com: export bitmap_cond_end_sync]
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Cc: "Mike Snitzer" <snitzer@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b47490c9
  17. 17 10月, 2007 1 次提交
  18. 18 7月, 2007 1 次提交
    • N
      md: change bitmap_unplug and others to void functions · 4ad13663
      NeilBrown 提交于
      bitmap_unplug only ever returns 0, so it may as well be void.  Two callers try
      to print a message if it returns non-zero, but that message is already printed
      by bitmap_file_kick.
      
      write_page returns an error which is not consistently checked.  It always
      causes BITMAP_WRITE_ERROR to be set on an error, and that can more
      conveniently be checked.
      
      When the return of write_page is checked, an error causes bitmap_file_kick to
      be called - so move that call into write_page - and protect against recursive
      calls into bitmap_file_kick.
      
      bitmap_update_sb returns an error that is never checked.
      
      So make these 'void' and be consistent about checking the bit.
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4ad13663
  19. 24 5月, 2007 1 次提交
  20. 10 2月, 2007 1 次提交
    • N
      [PATCH] md: avoid possible BUG_ON in md bitmap handling · da6e1a32
      Neil Brown 提交于
      md/bitmap tracks how many active write requests are pending on blocks
      associated with each bit in the bitmap, so that it knows when it can clear
      the bit (when count hits zero).
      
      The counter has 14 bits of space, so if there are ever more than 16383, we
      cannot cope.
      
      Currently the code just calles BUG_ON as "all" drivers have request queue
      limits much smaller than this.
      
      However is seems that some don't.  Apparently some multipath configurations
      can allow more than 16383 concurrent write requests.
      
      So, in this unlikely situation, instead of calling BUG_ON we now wait
      for the count to drop down a bit.  This requires a new wait_queue_head,
      some waiting code, and a wakeup call.
      
      Tested by limiting the counter to 20 instead of 16383 (writes go a lot slower
      in that case...).
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      da6e1a32
  21. 22 10月, 2006 1 次提交
  22. 03 10月, 2006 1 次提交
    • P
      [PATCH] md: new sysfs interface for setting bits in the write-intent-bitmap · 9b1d1dac
      Paul Clements 提交于
      Add a new sysfs interface that allows the bitmap of an array to be dirtied.
      The interface is write-only, and is used as follows:
      
      echo "1000" > /sys/block/md2/md/bitmap
      
      (dirty the bit for chunk 1000 [offset 0] in the in-memory and on-disk
      bitmaps of array md2)
      
      echo "1000-2000" > /sys/block/md1/md/bitmap
      
      (dirty the bits for chunks 1000-2000 in md1's bitmap)
      
      This is useful, for example, in cluster environments where you may need to
      combine two disjoint bitmaps into one (following a server failure, after a
      secondary server has taken over the array).  By combining the bitmaps on
      the two servers, a full resync can be avoided (This was discussed on the
      list back on March 18, 2005, "[PATCH 1/2] md bitmap bug fixes" thread).
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9b1d1dac
  23. 27 6月, 2006 2 次提交
    • N
      [PATCH] md/bitmap: change md/bitmap file handling to use bmap to file blocks · d785a06a
      NeilBrown 提交于
      If md is asked to store a bitmap in a file, it tries to hold onto the page
      cache pages for that file, manipulate them directly, and call a cocktail of
      operations to write the file out.  I don't believe this is a supportable
      approach.
      
      This patch changes the approach to use the same approach as swap files.  i.e.
      bmap is used to enumerate all the block address of parts of the file and we
      write directly to those blocks of the device.
      
      swapfile only uses parts of the file that provide a full pages at contiguous
      addresses.  We don't have that luxury so we have to cope with pages that are
      non-contiguous in storage.  To handle this we attach buffers to each page, and
      store the addresses in those buffers.
      
      With this approach the pagecache may contain data which is inconsistent with
      what is on disk.  To alleviate the problems this can cause, md invalidates the
      pagecache when releasing the file.  If the file is to be examined while the
      array is active (a non-critical but occasionally useful function), O_DIRECT io
      must be used.  And new version of mdadm will have support for this.
      
      This approach simplifies a lot of code:
       - we no longer need to keep a list of pages which we need to wait for,
         as the b_endio function can keep track of how many outstanding
         writes there are.  This saves a mempool.
       - -EAGAIN returns from write_page are no longer possible (not sure if
          they ever were actually).
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d785a06a
    • N
      [PATCH] md/bitmap: remove bitmap writeback daemon · 0b79ccf0
      NeilBrown 提交于
      md/bitmap currently has a separate thread to wait for writes to the bitmap
      file to complete (as we cannot get a callback on that action).
      
      However this isn't needed as bitmap_unplug is called from process context and
      waits for the writeback thread to do it's work.  The same result can be
      achieved by doing the waiting directly in bitmap_unplug.
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      0b79ccf0
  24. 09 11月, 2005 1 次提交
  25. 10 9月, 2005 1 次提交
  26. 05 8月, 2005 1 次提交
  27. 16 7月, 2005 1 次提交