1. 23 12月, 2009 1 次提交
    • S
      kfifo: move struct kfifo in place · 45465487
      Stefani Seibold 提交于
      This is a new generic kernel FIFO implementation.
      
      The current kernel fifo API is not very widely used, because it has to
      many constrains.  Only 17 files in the current 2.6.31-rc5 used it.
      FIFO's are like list's a very basic thing and a kfifo API which handles
      the most use case would save a lot of development time and memory
      resources.
      
      I think this are the reasons why kfifo is not in use:
      
       - The API is to simple, important functions are missing
       - A fifo can be only allocated dynamically
       - There is a requirement of a spinlock whether you need it or not
       - There is no support for data records inside a fifo
      
      So I decided to extend the kfifo in a more generic way without blowing up
      the API to much.  The new API has the following benefits:
      
       - Generic usage: For kernel internal use and/or device driver.
       - Provide an API for the most use case.
       - Slim API: The whole API provides 25 functions.
       - Linux style habit.
       - DECLARE_KFIFO, DEFINE_KFIFO and INIT_KFIFO Macros
       - Direct copy_to_user from the fifo and copy_from_user into the fifo.
       - The kfifo itself is an in place member of the using data structure, this save an
         indirection access and does not waste the kernel allocator.
       - Lockless access: if only one reader and one writer is active on the fifo,
         which is the common use case, no additional locking is necessary.
       - Remove spinlock - give the user the freedom of choice what kind of locking to use if
         one is required.
       - Ability to handle records. Three type of records are supported:
         - Variable length records between 0-255 bytes, with a record size
           field of 1 bytes.
         - Variable length records between 0-65535 bytes, with a record size
           field of 2 bytes.
         - Fixed size records, which no record size field.
       - Preserve memory resource.
       - Performance!
       - Easy to use!
      
      This patch:
      
      Since most users want to have the kfifo as part of another object,
      reorganize the code to allow including struct kfifo in another data
      structure.  This requires changing the kfifo_alloc and kfifo_init
      prototypes so that we pass an existing kfifo pointer into them.  This
      patch changes the implementation and all existing users.
      
      [akpm@linux-foundation.org: fix warning]
      Signed-off-by: NStefani Seibold <stefani@seibold.net>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Acked-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      Acked-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      45465487
  2. 17 12月, 2009 1 次提交
  3. 16 12月, 2009 2 次提交
  4. 13 12月, 2009 4 次提交
    • A
      [SCSI] 3w-9xxx fix bug in sgl loading · 53ca3535
      adam radford 提交于
      This small patch fixes a bug in the 3w-9xxx driver where it would load
      an invalid sgl address in the ioctl path even if request length was zero.
      Signed-off-by: NAdam Radford <aradford@gmail.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      53ca3535
    • V
      [SCSI] fcoe, libfc: adds enable/disable for fcoe interface · 55a66d3c
      Vasu Dev 提交于
      This is to allow fcoemon util to enable or disable a fcoe interface
      according to DCB link state change.
      
      Adds sysfs module param enable and disable for this and also
      updates existing other module param description to be consistent
      and more accurate since older description had double "fcoe" word
      with less meaningful netdev reference to user space.
      
      Adds code to ignore redundant fc_lport_enter_reset handling for a
      already disabled fcoe interface by checking LPORT_ST_DISABLED
      or LPORT_ST_LOGO states, this also prevents lport state transition
      on link flap on a disabled interface.
      
      Above changes required lport state transition to get out of
      disabled or logo state on call to fc_fabric_login.
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      55a66d3c
    • C
      [SCSI] libfc: reduce hold time on SCSI host lock · c1ecb90a
      Chris Leech 提交于
      Introduce a new lock to protect the list of fc_fcp_pkt structs in libfc
      instead of using the host lock.  This reduces the contention of this heavily
      used lock, and I see up to a 25% performance gain in CPU bound small I/O
      tests when scaling out across multiple quad-core CPUs.
      
      The big win is in removing the host lock from the completion path
      completely, as it does not need to be held around the call to scsi_done.
      Signed-off-by: NChris Leech <christopher.leech@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      c1ecb90a
    • A
      [SCSI] libfc: remote port gets stuck in restart state without really restarting · 5543c72e
      Abhijeet Joglekar 提交于
      We ran into a scenario where a remote port goes into RESTART state, but
      never gets added to scsi transport. The running vmcore showed the following:
      a) Port was in RESTART state
      b) rdata->event was STOP
      c) no work gets scheduled for the remote work to fc_rport_work
      
      After this point, shut/no-shut of the remote port did not cause the port
      to get re-discovered. The port would move betwen DELETE and RESTART states,
      but the event would always be STOP, no work would get scheduled to
      fc_rport_work and the port would not get added to scsi_transport.
      
      The problem is that rdata->event is not set to NONE after a port is
      restarted. After this point, no more work gets scheduled for the remote port
      since new work is scheduled only if rdata->event is non-NONE. So, the event
      and state keep changing, but fc_rport_work does not get scheduled to actually
      handle the event.
      
      Here's a transition of states that explains the above observation:
      
      ) Port is first in READY State, event is NONE
      
      2) RSCN on shut, port goes to DELETED, event is stop
      
      3) Before fc_rport_work runs, RSCN on no-shut, port goes to RESTART, event is
      still STOP
      
      4) fc_rport_work gets scheduled, removes the port from transport, sees state
      as RESTART, begins the PLOGI state machine, event remains as STOP (event NOT
      changed to NONE, this is the bug)
      
      5) Plogi state machine completes, port state goes to READY, event goes to
      READY, but no work is scheduled since event was STOP (non-NONE) before.
      Fc_rport_work is not scheduled, port remains in READY state, but is not added
      to transport.
      
      Things are broken at this point. Libfc rport is ready, but no transport rport
      created.
      
      6) now a shut causes port state to change to DELETE, event to change to STOP,
      no work gets scheduled
      
      7) no-shut causes port state to change to RESTART, event remains at STOP,
      no work gets scheduled
      
      (6) and (7) now get repeated everytime we do shut/no-shut. No way to get out
      of this state. Fcc reset does not help too.
      
      Only way to get out is to load/unload module.
      
      Fix is to set rdata->event to NONE while processing the STOP/LOGO/FAILED
      events, inside the discovery and rport locks.
      Signed-off-by: NAbhijeet Joglekar <abjoglek@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      5543c72e
  5. 11 12月, 2009 8 次提交
  6. 10 12月, 2009 24 次提交