1. 10 10月, 2007 1 次提交
    • N
      Merge blk_recount_segments into blk_recalc_rq_segments · 9dfa5283
      NeilBrown 提交于
      blk_recalc_rq_segments calls blk_recount_segments on each bio,
      then does some extra calculations to handle segments that overlap
      two bios.
      
      If we merge the code from blk_recount_segments into
      blk_recalc_rq_segments, we can process the whole request one bio_vec
      at a time, and not need the messy cross-bio calculations.
      
      Then blk_recount_segments can be implemented by calling
      blk_recalc_rq_segments, passing it a simple on-stack request which
      stores just the bio.
      Signed-off-by: NNeil Brown <neilb@suse.de>
      
      diff .prev/block/ll_rw_blk.c ./block/ll_rw_blk.c
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      9dfa5283
  2. 15 9月, 2007 1 次提交
  3. 13 9月, 2007 1 次提交
    • J
      Fix race with shared tag queue maps · f3da54ba
      Jens Axboe 提交于
      There's a race condition in blk_queue_end_tag() for shared tag maps,
      users include stex (promise supertrak thingy) and qla2xxx.  The former
      at least has reported bugs in this area, not sure why we haven't seen
      any for the latter.  It could be because the window is narrow and that
      other conditions in the qla2xxx code hide this.  It's a real bug,
      though, as the stex smp users can attest.
      
      We need to ensure two things - the tag bit clearing needs to happen
      AFTER we cleared the tag pointer, as the tag bit clearing/setting is
      what protects this map.  Secondly, we need to ensure that the visibility
      of the tag pointer and tag bit clear are ordered properly.
      
      [ I removed the SMP barriers - "test_and_clear_bit()" already implies
        all the required barriers.  -- Linus ]
      
      Also see http://bugzilla.kernel.org/show_bug.cgi?id=7842Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f3da54ba
  4. 12 8月, 2007 1 次提交
  5. 24 7月, 2007 1 次提交
  6. 20 7月, 2007 1 次提交
    • P
      mm: Remove slab destructors from kmem_cache_create(). · 20c2df83
      Paul Mundt 提交于
      Slab destructors were no longer supported after Christoph's
      c59def9f change. They've been
      BUGs for both slab and slub, and slob never supported them
      either.
      
      This rips out support for the dtor pointer from kmem_cache_create()
      completely and fixes up every single callsite in the kernel (there were
      about 224, not including the slab allocator definitions themselves,
      or the documentation references).
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      20c2df83
  7. 18 7月, 2007 1 次提交
  8. 16 7月, 2007 4 次提交
  9. 10 7月, 2007 2 次提交
    • T
      [BLOCK] drop unnecessary bvec rewinding from flush_dry_bio_endio · f4b09303
      Tejun Heo 提交于
      Barrier bios are completed twice - once after the barrier write itself
      is done and again after the whole sequence is complete.
      flush_dry_bio_endio() is for the first completion.  It doesn't really
      complete the bio.  It rewinds bvec and resets bio so that it can be
      completed again when the whole barrier sequence is complete.
      
      The bvec rewinding code has the following problems.
      
      1. The rewinding code is wrong because filesystems may pass bvec with
         non zero bv_offset.
      
      2. The block layer doesn't guarantee anything about the state of
         bvec array on request completion.  bv_offset and len are updated
         iff __end_that_request_first() completes the bvec partially.
      
      Because of #2, #1 doesn't really matter (nobody cares whether bvec is
      re-wound correctly or not) but then again by not doing unwinding at
      all, we'll always give back the same bvec to the caller as full bvec
      completion doesn't alter bvecs and the final completion is always full
      completion.
      
      Drop unnecessary rewinding code.
      
      This is spotted by Neil Brown.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      f4b09303
    • J
      blk_hw_contig_segment(): bad segment size checks · 32eef964
      Jens Axboe 提交于
      Two bugs in there:
      
      - The virt oversize check should use the current bio hardware back
        size and the next bio front size, not the same bio. Spotted by
        Neil Brown.
      
      - The segment size check should add hw front sizes, not total bio
        sizes. Spotted by James Bottomley
      Acked-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      Acked-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      32eef964
  10. 16 6月, 2007 1 次提交
    • T
      block: always requeue !fs requests at the front · bc90ba09
      Tejun Heo 提交于
      SCSI marks internal commands with REQ_PREEMPT and push it at the front
      of the request queue using blk_execute_rq().  When entering suspended
      or frozen state, SCSI devices are quiesced using
      scsi_device_quiesce().  In quiesced state, only REQ_PREEMPT requests
      are processed.  This is how SCSI blocks other requests out while
      suspending and resuming.  As all internal commands are pushed at the
      front of the queue, this usually works.
      
      Unfortunately, this interacts badly with ordered requeueing.  To
      preserve request order on requeueing (due to busy device, active EH or
      other failures), requests are sorted according to ordered sequence on
      requeue if IO barrier is in progress.
      
      The following sequence deadlocks.
      
      1. IO barrier sequence issues.
      
      2. Suspend requested.  Queue is quiesced with part or all of IO
         barrier sequence at the front.
      
      3. During suspending or resuming, SCSI issues internal command which
         gets deferred and requeued for some reason.  As the command is
         issued after the IO barrier in #1, ordered requeueing code puts the
         request after IO barrier sequence.
      
      4. The device is ready to process requests again but still is in
         quiesced state and the first request of the queue isn't
         REQ_PREEMPT, so command processing is deadlocked -
         suspending/resuming waits for the issued request to complete while
         the request can't be processed till device is put back into
         running state by resuming.
      
      This can be fixed by always putting !fs requests at the front when
      requeueing.
      
      The following thread reports this deadlock.
      
        http://thread.gmane.org/gmane.linux.kernel/537473Signed-off-by: NTejun Heo <htejun@gmail.com>
      Acked-by: NDavid Greaves <david@dgreaves.com>
      Acked-by: NJeff Garzik <jeff@garzik.org>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      bc90ba09
  11. 16 5月, 2007 1 次提交
  12. 11 5月, 2007 1 次提交
    • N
      When stacked block devices are in-use (e.g. md or dm), the recursive calls · d89d8796
      Neil Brown 提交于
      to generic_make_request can use up a lot of space, and we would rather they
      didn't.
      
      As generic_make_request is a void function, and as it is generally not
      expected that it will have any effect immediately, it is safe to delay any
      call to generic_make_request until there is sufficient stack space
      available.
      
      As ->bi_next is reserved for the driver to use, it can have no valid value
      when generic_make_request is called, and as __make_request implicitly
      assumes it will be NULL (ELEVATOR_BACK_MERGE fork of switch) we can be
      certain that all callers set it to NULL.  We can therefore safely use
      bi_next to link pending requests together, providing we clear it before
      making the real call.
      
      So, we choose to allow each thread to only be active in one
      generic_make_request at a time.  If a subsequent (recursive) call is made,
      the bio is linked into a per-thread list, and is handled when the active
      call completes.
      
      As the list of pending bios is per-thread, there are no locking issues to
      worry about.
      
      I say above that it is "safe to delay any call...".  There are, however,
      some behaviours of a make_request_fn which would make it unsafe.  These
      include any behaviour that assumes anything will have changed after a
      recursive call to generic_make_request.
      
      These could include:
       - waiting for that call to finish and call it's bi_end_io function.
         md use to sometimes do this (marking the superblock dirty before
         completing a write) but doesn't any more
       - inspecting the bio for fields that generic_make_request might
         change, such as bi_sector or bi_bdev.  It is hard to see a good
         reason for this, and I don't think anyone actually does it.
       - inspecing the queue to see if, e.g. it is 'full' yet.  Again, I
         think this is very unlikely to be useful, or to be done.
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: <dm-devel@redhat.com>
      
      Alasdair G Kergon <agk@redhat.com> said:
      
       I can see nothing wrong with this in principle.
      
       For device-mapper at the moment though it's essential that, while the bio
       mappings may now get delayed, they still get processed in exactly
       the same order as they were passed to generic_make_request().
      
       My main concern is whether the timing changes implicit in this patch
       will make the rare data-corrupting races in the existing snapshot code
       more likely. (I'm working on a fix for these races, but the unfinished
       patch is already several hundred lines long.)
      
       It would be helpful if some people on this mailing list would test
       this patch in various scenarios and report back.
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      d89d8796
  13. 10 5月, 2007 3 次提交
  14. 09 5月, 2007 2 次提交
  15. 30 4月, 2007 1 次提交
  16. 18 4月, 2007 1 次提交
    • A
      [SCSI] sg: cap reserved_size values at max_sectors · 44ec9542
      Alan Stern 提交于
      This patch (as857) modifies the SG_GET_RESERVED_SIZE and
      SG_SET_RESERVED_SIZE ioctls in the sg driver, capping the values at
      the device's request_queue's max_sectors value.  This will permit
      cdrecord to obtain a legal value for the maximum transfer length,
      fixing Bugzilla #7026.
      
      The patch also caps the initial reserved_size value.  There's no
      reason to have a reserved buffer larger than max_sectors, since it
      would be impossible to use the extra space.
      
      The corresponding ioctls in the block layer are modified similarly,
      and the initial value for the reserved_size is set as large as
      possible.  This will effectively make it default to max_sectors.
      Note that the actual value is meaningless anyway, since block devices
      don't have a reserved buffer.
      
      Finally, the BLKSECTGET ioctl is added to sg, so that there will be a
      uniform way for users to determine the actual max_sectors value for
      any raw SCSI transport.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Acked-by: NDouglas Gilbert <dougg@torque.net>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      44ec9542
  17. 27 3月, 2007 1 次提交
    • V
      block: blk_max_pfn is somtimes wrong · f772b3d9
      Vasily Tarasov 提交于
      There is a small problem in handling page bounce.
      
      At the moment blk_max_pfn equals max_pfn, which is in fact not maximum
      possible _number_ of a page frame, but the _amount_ of page frames.  For
      example for the 32bit x86 node with 4Gb RAM, max_pfn = 0x100000, but not
      0xFFFF.
      
      request_queue structure has a member q->bounce_pfn and queue needs bounce
      pages for the pages _above_ this limit.  This routine is handled by
      blk_queue_bounce(), where the following check is produced:
      
      	if (q->bounce_pfn >= blk_max_pfn)
      		return;
      
      Assume, that a driver has set q->bounce_pfn to 0xFFFF, but blk_max_pfn
      equals 0x10000.  In such situation the check above fails and for each bio
      we always fall down for iterating over pages tied to the bio.
      
      I want to notice, that for quite a big range of device drivers (ide, md,
      ...) such problem doesn't happen because they use BLK_BOUNCE_ANY for
      bounce_pfn.  BLK_BOUNCE_ANY is defined as blk_max_pfn << PAGE_SHIFT, and
      then the check above doesn't fail.  But for other drivers, which obtain
      reuired value from drivers, it fails.  For example sata_nv uses
      ATA_DMA_MASK or dev->dma_mask.
      
      I propose to use (max_pfn - 1) for blk_max_pfn.  And the same for
      blk_max_low_pfn.  The patch also cleanses some checks related with
      bounce_pfn.
      Signed-off-by: NVasily Tarasov <vtaras@openvz.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      f772b3d9
  18. 10 2月, 2007 1 次提交
    • N
      [PATCH] md: fix various bugs with aligned reads in RAID5 · 387bb173
      Neil Brown 提交于
      It is possible for raid5 to be sent a bio that is too big for an underlying
      device.  So if it is a READ that we pass stright down to a device, it will
      fail and confuse RAID5.
      
      So in 'chunk_aligned_read' we check that the bio fits within the parameters
      for the target device and if it doesn't fit, fall back on reading through
      the stripe cache and making lots of one-page requests.
      
      Note that this is the earliest time we can check against the device because
      earlier we don't have a lock on the device, so it could change underneath
      us.
      
      Also, the code for handling a retry through the cache when a read fails has
      not been tested and was badly broken.  This patch fixes that code.
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Cc: "Kai" <epimetreus@fastmail.fm>
      Cc: <stable@suse.de>
      Cc: <org@suse.de>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      387bb173
  19. 23 12月, 2006 1 次提交
  20. 19 12月, 2006 5 次提交
  21. 13 12月, 2006 1 次提交
  22. 12 12月, 2006 1 次提交
    • B
      [PATCH] remove blk_queue_activity_fn · 2b02a179
      Boaz Harrosh 提交于
      While working on bidi support at struct request level
      I have found that blk_queue_activity_fn is actually never used.
      The only user is in ide-probe.c with this code:
      
      	/* enable led activity for disk drives only */
      	if (drive->media == ide_disk && hwif->led_act)
      		blk_queue_activity_fn(q, hwif->led_act, drive);
      
      And led_act is never initialized anywhere.
      (Looking back at older kernels it was used in the PPC arch, but was removed around 2.6.18)
      Unless it is all for future use off course.
      (this patch is against linux-2.6-block.git as off 2006/12/4)
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      2b02a179
  23. 11 12月, 2006 1 次提交
  24. 09 12月, 2006 1 次提交
    • A
      [PATCH] fault-injection capability for disk IO · c17bb495
      Akinobu Mita 提交于
      This patch provides fault-injection capability for disk IO.
      
      Boot option:
      
      fail_make_request=<probability>,<interval>,<space>,<times>
      
      	<interval> -- specifies the interval of failures.
      
      	<probability> -- specifies how often it should fail in percent.
      
      	<space> -- specifies the size of free space where disk IO can be issued
      		   safely in bytes.
      
      	<times> -- specifies how many times failures may happen at most.
      
      Debugfs:
      
      /debug/fail_make_request/interval
      /debug/fail_make_request/probability
      /debug/fail_make_request/specifies
      /debug/fail_make_request/times
      
      Example:
      
      	fail_make_request=10,100,0,-1
      	echo 1 > /sys/blocks/hda/hda1/make-it-fail
      
      generic_make_request() on /dev/hda1 fails once per 10 times.
      
      Cc: Jens Axboe <axboe@suse.de>
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      c17bb495
  25. 08 12月, 2006 2 次提交
  26. 01 12月, 2006 1 次提交
  27. 22 11月, 2006 1 次提交
    • D
      WorkStruct: Pass the work_struct pointer instead of context data · 65f27f38
      David Howells 提交于
      Pass the work_struct pointer to the work function rather than context data.
      The work function can use container_of() to work out the data.
      
      For the cases where the container of the work_struct may go away the moment the
      pending bit is cleared, it is made possible to defer the release of the
      structure by deferring the clearing of the pending bit.
      
      To make this work, an extra flag is introduced into the management side of the
      work_struct.  This governs auto-release of the structure upon execution.
      
      Ordinarily, the work queue executor would release the work_struct for further
      scheduling or deallocation by clearing the pending bit prior to jumping to the
      work function.  This means that, unless the driver makes some guarantee itself
      that the work_struct won't go away, the work function may not access anything
      else in the work_struct or its container lest they be deallocated..  This is a
      problem if the auxiliary data is taken away (as done by the last patch).
      
      However, if the pending bit is *not* cleared before jumping to the work
      function, then the work function *may* access the work_struct and its container
      with no problems.  But then the work function must itself release the
      work_struct by calling work_release().
      
      In most cases, automatic release is fine, so this is the default.  Special
      initiators exist for the non-auto-release case (ending in _NAR).
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      65f27f38
  28. 04 11月, 2006 1 次提交