1. 14 11月, 2012 2 次提交
    • M
      [SCSI] sd: Implement support for WRITE SAME · 5db44863
      Martin K. Petersen 提交于
      Implement support for WRITE SAME(10) and WRITE SAME(16) in the SCSI disk
      driver.
      
       - We set the default maximum to 0xFFFF because there are several
         devices out there that only support two-byte block counts even with
         WRITE SAME(16). We only enable transfers bigger than 0xFFFF if the
         device explicitly reports MAXIMUM WRITE SAME LENGTH in the BLOCK
         LIMITS VPD.
      
       - max_write_same_blocks can be overriden per-device basis in sysfs.
      
       - The UNMAP discovery heuristics remain unchanged but the discard
         limits are tweaked to match the "real" WRITE SAME commands.
      
       - In the error handling logic we now distinguish between WRITE SAME
         with and without UNMAP set.
      
      The discovery process heuristics are:
      
       - If the device reports a SCSI level of SPC-3 or greater we'll issue
         READ SUPPORTED OPERATION CODES to find out whether WRITE SAME(16) is
         supported. If that's the case we will use it.
      
       - If the device supports the block limits VPD and reports a MAXIMUM
         WRITE SAME LENGTH bigger than 0xFFFF we will use WRITE SAME(16).
      
       - Otherwise we will use WRITE SAME(10) unless the target LBA is beyond
         0xFFFFFFFF or the block count exceeds 0xFFFF.
      
       - no_write_same is set for ATA, FireWire and USB.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NMike Snitzer <snitzer@redhat.com>
      Reviewed-by: NJeff Garzik <jgarzik@redhat.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      5db44863
    • M
      [SCSI] Add a report opcode helper · 3c6bdaea
      Martin K. Petersen 提交于
      The REPORT SUPPORTED OPERATION CODES command can be used to query
      whether a given opcode is supported by a device. Add a helper function
      that allows us to look up commands.
      
      We only issue RSOC if the device reports compliance with SPC-3 or
      later. But to err on the side of caution we disable the command for ATA,
      FireWire and USB.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Acked-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      3c6bdaea
  2. 22 5月, 2012 4 次提交
  3. 29 3月, 2012 1 次提交
  4. 11 3月, 2012 1 次提交
  5. 23 2月, 2012 4 次提交
    • C
      firewire: sbp2: Fix SCSI sense data mangling · 6503de65
      Chris Boot 提交于
      SCSI sense data in SBP-2/3 is carried in an unusual format that means we
      have to un-mangle it on our end before we pass it to the SCSI subsystem.
      Currently our un-mangling code doesn't quite follow the SBP-2 standard
      in that we always assume Current and never Deferred error types, we
      never set the VALID bit, and we mishandle the FILEMARK, EOM and ILI
      bits.
      
      This patch fixes the sense un-mangling to correctly handle those and
      follow the spec.
      Signed-off-by: NChris Boot <bootc@bootc.net>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      6503de65
    • C
      firewire: sbp2: Ignore SBP-2 targets on the local node · 74044563
      Chris Boot 提交于
      The firewire-sbp2 module tries to login to an SBP-2/3 target even when
      it is running on the local node, which fails because of the inability to
      fetch data from DMA mapped regions using firewire transactions on the
      local node. It also doesn't make much sense to have the initiator and
      target on the same node, so this patch prevents this behaviour.
      Signed-off-by: NChris Boot <bootc@bootc.net>
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (changed the comment)
      74044563
    • C
      firewire: sbp2: Take into account Unit_Unique_ID · 8ff6a757
      Chris Boot 提交于
      If the target's unit directory contains a Unit_Unique_ID entry, we
      should use that as the target's GUID for identification purposes. The
      SBP-2 standards document says:
      
      "Although the node unique ID (EUI-64) present in the bus information
      block is sufficient to uniquely identify nodes attached to Serial Bus,
      it is insufficient to identify a target when a vendor implements a
      device with multiple Serial Bus node connections. In this case initiator
      software requires information by which a particular target may be
      uniquely identified, regardless of the Serial Bus access path used."
      
      [ IEEE T10 P1155D Revision 4, Section 7.6 (page 51) ] and
      [ IEEE T10 P1467D Revision 5, Section 7.9 (page 74) ]
      Signed-off-by: NChris Boot <bootc@bootc.net>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      8ff6a757
    • S
      firewire: sbp2: identify to driver core as "firewire_sbp2", not "sbp2" · 0c22ecde
      Stefan Richter 提交于
      Commit eba9ebaa "firewire: sbp2: use dev_printk API" changed
      messages from e.g.
          firewire_sbp2: fw3.0: logged in to LUN 0000 (0 retries)
      to
          sbp2 fw3.0: logged in to LUN 0000 (0 retries)
      because the driver calls itself as "sbp2" when registering with driver
      core and with SCSI core.  This is of course confusing, so switch to the
      name "firewire_sbp2" for driver core in order to match what lsmod and
      /sys/module/ show.  So we are back to
          firewire_sbp2 fw3.0: logged in to LUN 0000 (0 retries)
      in the kernel log.
      
      This also changes
          /sys/bus/firewire/drivers/sbp2
          /sys/bus/firewire/devices/fw3.0/driver -> [...]/sbp2
          /sys/module/firewire_sbp2/drivers/firewire:sbp2
      to
          /sys/bus/firewire/drivers/firewire_sbp2
          /sys/bus/firewire/devices/fw3.0/driver -> [...]/firewire_sbp2
          /sys/module/firewire_sbp2/drivers/firewire:firewire_sbp2
      
      but "cat /sys/class/scsi_host/host27/proc_name" stays "sbp2" just in
      case that proc_name is used by any userland.
      
      The transport detection in lsscsi is not affected.  (Tested with lsscsi
      version 0.25.)  Udev's /dev/disk/by-id and by-path symlinks are not
      affected either.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      0c22ecde
  6. 16 1月, 2012 1 次提交
  7. 13 1月, 2012 1 次提交
  8. 09 10月, 2011 1 次提交
  9. 17 9月, 2011 3 次提交
    • S
      firewire: sbp2: fold two functions into one · 32ce38f4
      Stefan Richter 提交于
      sbp2_release_target() is folded into its primary user, sbp2_remove().
      The only other caller, a failure path in sbp2_probe(), now uses
      sbp2_remove().  This adds unnecessary cancel_delayed_work_sync() calls
      to that failure path but results in less code and text.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      32ce38f4
    • S
      firewire: sbp2: move some code to more sensible places · b2af07b6
      Stefan Richter 提交于
      Implement sbp2_queue_work(), which is now a very simple accessor to one
      of the struct sbp2_logical_unit members, right after the definition of
      struct sbp2_logical_unit.
      
      Put the sbp2_reconnect() implementation right after the sbp2_login()
      implementation.  They are both part of the SBP-2 access protocol.
      
      Implement the driver methods sbp2_probe(), spp2_update(), sbp2_remove()
      in this order, reflecting the lifetime of an SBP-2 target.
      
      Place the sbp2_release_target() implementation right next to
      sbp2_remove() which is its primary user, and after sbp2_probe() which is
      the counterpart to sbp2_release_target().
      
      There are no changes to the implementations here, or at least not meant
      to be.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      b2af07b6
    • S
      firewire: sbp2: remove obsolete reference counting · 6ff8147d
      Stefan Richter 提交于
      Since commit 0278ccd9 "firewire: sbp2:
      fix panic after rmmod with slow targets", the lifetime of an sbp2_target
      instance does no longer extent past the return of sbp2_remove().
      Therefore it is no longer necessary to call fw_unit_get/put() and
      fw_device_get/put() in sbp2_probe/remove().
      
      Furthermore, said commit also ensures that lu->work is not going to be
      executed or requeued at a time when the sbp2_target is no longer in use.
      Hence there is no need for sbp2_target reference counting for lu->work.
      
      Other concurrent contexts:
      
        - Processes which access the sysfs of the SCSI host device or of one
          of its subdevices are safe because these interfaces are all removed
          by scsi_remove_device/host() in sbp2_release_target().
      
        - SBP-2 command block ORB transactions are finished when
          scsi_remove_device() in sbp2_release_target() returns.
      
        - SBP-2 management ORB transactions are finished when
          cancel_delayed_work_sync(&lu->work) before sbp2_release_target()
          returns.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      6ff8147d
  10. 23 8月, 2011 1 次提交
    • C
      firewire: sbp2: fix panic after rmmod with slow targets · 0278ccd9
      Chris Boot 提交于
      If firewire-sbp2 starts a login to a target that doesn't complete ORBs
      in a timely manner (and has to retry the login), and the module is
      removed before the operation times out, you end up with a null-pointer
      dereference and a kernel panic.
      
      [SR:  This happens because sbp2_target_get/put() do not maintain
      module references.  scsi_device_get/put() do, but at occasions like
      Chris describes one, nobody holds a reference to an SBP-2 sdev.]
      
      This patch cancels pending work for each unit in sbp2_remove(), which
      hopefully means there are no extra references around that prevent us
      from unloading. This fixes my crash.
      Signed-off-by: NChris Boot <bootc@bootc.net>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      0278ccd9
  11. 11 5月, 2011 3 次提交
    • S
      firewire: sbp2: parallelize login, reconnect, logout · 105e53f8
      Stefan Richter 提交于
      The struct sbp2_logical_unit.work items can all be executed in parallel
      but are not reentrant.  Furthermore, reconnect or re-login work must be
      executed in a WQ_MEM_RECLAIM workqueue.
      
      Hence replace the old single-threaded firewire-sbp2 workqueue by a
      concurrency-managed but non-reentrant workqueue with rescuer.
      firewire-core already maintains one, hence use this one.
      
      In earlier versions of this change, I observed occasional failures of
      parallel INQUIRY to an Initio INIC-2430 FireWire 800 to dual IDE bridge.
      More testing indicates that parallel INQUIRY is not actually a problem,
      but too quick successions of logout and login + INQUIRY, e.g. a quick
      sequence of cable plugout and plugin, can result in failed INQUIRY.
      This does not seem to be something that should or could be addressed by
      serialization.
      
      Another dual-LU device to which I currently have access to, an
      OXUF924DSB FireWire 800 to dual SATA bridge with firmware from MacPower,
      has been successfully tested with this too.
      
      This change is beneficial to environments with two or more FireWire
      storage devices, especially if they are located on the same bus.
      Management tasks that should be performed as soon and as quickly as
      possible, especially reconnect, are no longer held up by tasks on other
      devices that may take a long time, especially login with INQUIRY and sd
      or sr driver probe.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      105e53f8
    • S
      firewire: sbp2: octlet AT payloads can be stack-allocated · 81bf52d8
      Stefan Richter 提交于
      We do not need slab allocations for ORB pointer write transactions
      anymore in order to satisfy streaming DMA mapping constraints, thanks to
      commit da28947e "firewire: ohci: avoid separate DMA mapping for
      small AT payloads".
      
      (Besides, the slab-allocated buffers that firewire-sbp2 used to provide
      for 8-byte write requests were still not fully portable since they
      shared a cacheline with unrelated CPU-accessed data.)
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      81bf52d8
    • S
      firewire: sbp2: omit Scsi_Host lock from queuecommand · b75ca5ea
      Stefan Richter 提交于
      firewire-sbp2 already takes care for internal serialization where
      required (ORB list accesses), and it does not use cmd->serial_number
      internally.  Hence it is safe to not grab the shost lock around
      queuecommand.
      
      While we are at housekeeping, drop a redundant struct member:
      sbp2_command_orb.done is set once in a hot path and dereferenced once in
      a hot path.  We can as well dereference sbp2_command_orb.cmd->scsi_done
      instead.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      b75ca5ea
  12. 20 3月, 2011 1 次提交
  13. 17 11月, 2010 1 次提交
    • J
      SCSI host lock push-down · f281233d
      Jeff Garzik 提交于
      Move the mid-layer's ->queuecommand() invocation from being locked
      with the host lock to being unlocked to facilitate speeding up the
      critical path for drivers who don't need this lock taken anyway.
      
      The patch below presents a simple SCSI host lock push-down as an
      equivalent transformation.  No locking or other behavior should change
      with this patch.  All existing bugs and locking orders are preserved.
      
      Additionally, add one parameter to queuecommand,
      	struct Scsi_Host *
      and remove one parameter from queuecommand,
      	void (*done)(struct scsi_cmnd *)
      
      Scsi_Host* is a convenient pointer that most host drivers need anyway,
      and 'done' is redundant to struct scsi_cmnd->scsi_done.
      
      Minimal code disturbance was attempted with this change.  Most drivers
      needed only two one-line modifications for their host lock push-down.
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      Acked-by: NJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f281233d
  14. 20 8月, 2010 2 次提交
    • S
      firewire: sbp2: fix stall with "Unsolicited response" · a481e97d
      Stefan Richter 提交于
      Fix I/O stalls with some 4-bay RAID enclosures which are based on
      OXUF936QSE:
        - Onnto dataTale RSM4QO, old firmware (not anymore with current
          firmware),
        - inXtron Hydra Super-S LCM, old as well as current firmware
      when used in RAID-5 mode, perhaps also in other RAID modes.
      
      The stalls happen during heavy or moderate disk traffic in periods that
      are a multiple of 5 minutes, roughly twice per hour.  They are caused
      by the target responding too late to an ORB_Pointer register write:
      The target responds after Split_Timeout, hence firewire-core cancels
      the transaction, and firewire-sbp2 fails the SCSI request.  The SCSI
      core retries the request, that fails again (and again), hence SCSI core
      calls firewire-sbp2's abort handler (and even the Management_Agent
      register write in the abort handler has the transaction timeout
      problem).
      
      During all that, the process which issued the I/O is stalled in I/O
      wait state.
      
      Meanwhile, the target actually acts on the first failed SCSI request:
      It responds to the ORB_Pointer write later (seen in the kernel log as
      "firewire_core: Unsolicited response") and also finishes the SCSI
      request with proper status (seen in the kernel log as "firewire_sbp2:
      status write for unknown orb").
      
      So let's just ignore RCODE_CANCELLED in the transaction callback and
      wait for the target to complete the ORB nevertheless.  This requires
      a small modification is sbp2_cancel_orbs(); it now needs to call
      orb->callback() regardless whether fw_cancel_transaction() found the
      transaction unfinished or finished.
      
      A different solution is to increase Split_Timeout on the local node.
      (Tested: 2000ms timeout; maybe 1000ms or something like that works too.
      200ms is insufficient.  Standard is 100ms.)  However, I rather not do
      this because any software on any node could change the Split_Timeout to
      something unsuitable.  Or such a large Split_Timeout may be undesirable
      for other purposes.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      a481e97d
    • S
      firewire: sbp2: fix memory leak in sbp2_cancel_orbs or at send error · 6c74340b
      Stefan Richter 提交于
      When an ORB was canceled (Command ORB i.e. SCSI request timed out, or
      Management ORB timed out), or there was a send error in the initial
      transaction, we missed to drop one of the ORB's references and thus
      leaked memory.
      
      Background:
      In total, we hold 3 references to each Operation Request Block:
        - 1 during sbp2_scsi_queuecommand() or sbp2_send_management_orb()
          respectively,
        - 1 for the duration of the write transaction to the ORB_Pointer or
          Management_Agent register of the target,
        - 1 for as long as the ORB stays within the lu->orb_list, until
          the ORB is unlinked from the list and the orb->callback was
          executed.
      
      The latter one of these 3 references is finished
        - normally by sbp2_status_write() when the target wrote status
          for a pending ORB,
        - or by sbp2_cancel_orbs() in case of an ORB time-out,
        - or by complete_transaction() in case of a send error.
      Of them, the latter two lacked the kref_put.
      
      Add the missing kref_put()s.  Add comments to the gets and puts of
      references for transaction callbacks and ORB callbacks so that it is
      easier to see what is supposed to happen.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      6c74340b
  15. 21 6月, 2010 1 次提交
    • S
      firewire: remove an unused function argument · 33e553fe
      Stefan Richter 提交于
      void (*fw_address_callback_t)(..., int speed, ...) is the speed that a
      remote node chose to transmit a request to us.  In case of split
      transactions, firewire-core will transmit the response at that speed.
      
      Upper layer drivers on the other hand (firewire-net, -sbp2, firedtv, and
      userspace drivers) cannot do anything useful with that speed datum,
      except log it for debug purposes.  But data that is merely potentially
      (not even actually) used for debug purposes does not belong into the API.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      33e553fe
  16. 19 6月, 2010 1 次提交
  17. 26 2月, 2010 1 次提交
  18. 30 12月, 2009 1 次提交
  19. 15 10月, 2009 2 次提交
    • S
      firewire: normalize style of queue_work wrappers · 9fb551bf
      Stefan Richter 提交于
      A few stylistic changes to unify some code patterns in the subsystem:
      
        - The similar queue_delayed_work helpers fw_schedule_bm_work,
          schedule_iso_resource, and sbp2_queue_work now have the same call
          convention.
        - Two conditional calls of schedule_iso_resource are factored into
          another small helper.
        - An sbp2_target_get helper is added as counterpart to
          sbp2_target_put.
      
      Object size of firewire-core is decreased a little bit, object size of
      firewire-sbp2 remains unchanged.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      9fb551bf
    • S
      firewire: sbp2: provide fallback if mgt_ORB_timeout is missing · eaf76e0d
      Stefan Richter 提交于
      The Unit_Characteristics entry of an SBP-2 unit directory is not
      mandatory as far as I can tell.  If it is missing, we would probably
      fail to log in into the target because firewire-sbp2 would not wait for
      status after it sent the login request.
      
      The fix moves the cleanup of tgt->mgt_orb_timeout into a place where it
      is executed exactly once before login, rather than 0..n times depending
      on the target's config ROM.  With targets with one or more
      Unit_Characteristics entries, the result is the same as before.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      eaf76e0d
  20. 12 9月, 2009 2 次提交
  21. 05 9月, 2009 1 次提交
  22. 03 7月, 2009 1 次提交
  23. 07 6月, 2009 1 次提交
  24. 05 6月, 2009 3 次提交
    • S
      firewire: rename source files · e71d31da
      Stefan Richter 提交于
      The source files of firewire-core, firewire-ohci, firewire-sbp2, i.e.
       "drivers/firewire/fw-*.c"
      are renamed to
       "drivers/firewire/core-*.c",
       "drivers/firewire/ohci.c",
       "drivers/firewire/sbp2.c".
      
      The old fw- prefix was redundant to the directory name.  The new core-
      prefix distinguishes the files according to which driver they belong to.
      
      This change comes a little late, but still before further firewire
      drivers are added as anticipated RSN.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e71d31da
    • S
      firewire: reorganize header files · 77c9a5da
      Stefan Richter 提交于
      The three header files of firewire-core, i.e.
       "drivers/firewire/fw-device.h",
       "drivers/firewire/fw-topology.h",
       "drivers/firewire/fw-transaction.h",
      are replaced by
       "drivers/firewire/core.h",
       "include/linux/firewire.h".
      
      The latter includes everything which a firewire high-level driver (like
      firewire-sbp2) needs besides linux/firewire-constants.h, while core.h
      contains the rest which is needed by firewire-core itself and by low-
      level drivers (card drivers) like firewire-ohci.
      
      High-level drivers can now also reside outside of drivers/firewire
      without having to add drivers/firewire to the header file search path in
      makefiles.  At least the firedtv driver will be such a driver.
      
      I also considered to spread the contents of core.h over several files,
      one for each .c file where the respective implementation resides.  But
      it turned out that most core .c files will end up including most of the
      core .h files.  Also, the combined core.h isn't unreasonably big, and it
      will lose more of its contents to linux/firewire.h anyway soon when more
      firewire drivers are added.  (IP-over-1394, firedtv, and there are plans
      for one or two more.)
      
      Furthermore, fw-ohci.h is renamed to ohci.h.  The name of core.h and
      ohci.h is chosen with regard to name changes of the .c files in a
      follow-up change.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      77c9a5da
    • S
      firewire: clean up includes · e8ca9702
      Stefan Richter 提交于
      Include required headers which were only indirectly included.
      Remove unused includes and an unused constant.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e8ca9702