[SCSI] fusion: update LSI headers

2005-09-07 Thread Linux Kernel Mailing List
tree a4fa0be9b769b57075a7bff9b5f55ec96c8132d1
parent 69218ee5186aded6c78e12e083e073d000ff2e9b
author Christoph Hellwig [EMAIL PROTECTED] Thu, 18 Aug 2005 16:24:26 +0200
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:48:39 
-0500

[SCSI] fusion: update LSI headers

Acked by: Moore, Eric Dean [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/message/fusion/lsi/mpi.h   |   19 ++
 drivers/message/fusion/lsi/mpi_cnfg.h  |   85 +---
 drivers/message/fusion/lsi/mpi_history.txt |   67 ++---
 drivers/message/fusion/lsi/mpi_init.h  |  203 -
 drivers/message/fusion/lsi/mpi_ioc.h   |   11 +
 drivers/message/fusion/lsi/mpi_targ.h  |   74 ++
 6 files changed, 415 insertions(+), 44 deletions(-)

diff --git a/drivers/message/fusion/lsi/mpi.h b/drivers/message/fusion/lsi/mpi.h
--- a/drivers/message/fusion/lsi/mpi.h
+++ b/drivers/message/fusion/lsi/mpi.h
@@ -6,7 +6,7 @@
  *  Title:  MPI Message independent structures and definitions
  *  Creation Date:  July 27, 2000
  *
- *mpi.h Version:  01.05.07
+ *mpi.h Version:  01.05.08
  *
  *  Version History
  *  ---
@@ -71,6 +71,9 @@
  *  03-11-05  01.05.07  Removed function codes for SCSI IO 32 and
  *  TargetAssistExtended requests.
  *  Removed EEDP IOCStatus codes.
+ *  06-24-05  01.05.08  Added function codes for SCSI IO 32 and
+ *  TargetAssistExtended requests.
+ *  Added EEDP IOCStatus codes.
  *  --
  */
 
@@ -101,7 +104,7 @@
 /* Note: The major versions of 0xe0 through 0xff are reserved */
 
 /* versioning for this MPI header set */
-#define MPI_HEADER_VERSION_UNIT (0x09)
+#define MPI_HEADER_VERSION_UNIT (0x0A)
 #define MPI_HEADER_VERSION_DEV  (0x00)
 #define MPI_HEADER_VERSION_UNIT_MASK(0xFF00)
 #define MPI_HEADER_VERSION_UNIT_SHIFT   (8)
@@ -292,10 +295,13 @@
 #define MPI_FUNCTION_DIAG_BUFFER_POST   (0x1D)
 #define MPI_FUNCTION_DIAG_RELEASE   (0x1E)
 
+#define MPI_FUNCTION_SCSI_IO_32 (0x1F)
+
 #define MPI_FUNCTION_LAN_SEND   (0x20)
 #define MPI_FUNCTION_LAN_RECEIVE(0x21)
 #define MPI_FUNCTION_LAN_RESET  (0x22)
 
+#define MPI_FUNCTION_TARGET_ASSIST_EXTENDED (0x23)
 #define MPI_FUNCTION_TARGET_CMD_BUF_BASE_POST   (0x24)
 #define MPI_FUNCTION_TARGET_CMD_BUF_LIST_POST   (0x25)
 
@@ -681,6 +687,15 @@ typedef struct _MSG_DEFAULT_REPLY
 #define MPI_IOCSTATUS_SCSI_EXT_TERMINATED   (0x004C)
 
 //
+/*  For use by SCSI Initiator and SCSI Target end-to-end data protection*/
+//
+
+#define MPI_IOCSTATUS_EEDP_GUARD_ERROR  (0x004D)
+#define MPI_IOCSTATUS_EEDP_REF_TAG_ERROR(0x004E)
+#define MPI_IOCSTATUS_EEDP_APP_TAG_ERROR(0x004F)
+
+
+//
 /*  SCSI Target values  */
 //
 
diff --git a/drivers/message/fusion/lsi/mpi_cnfg.h 
b/drivers/message/fusion/lsi/mpi_cnfg.h
--- a/drivers/message/fusion/lsi/mpi_cnfg.h
+++ b/drivers/message/fusion/lsi/mpi_cnfg.h
@@ -6,7 +6,7 @@
  *  Title:  MPI Config message, structures, and Pages
  *  Creation Date:  July 27, 2000
  *
- *mpi_cnfg.h Version:  01.05.08
+ *mpi_cnfg.h Version:  01.05.09
  *
  *  Version History
  *  ---
@@ -232,6 +232,23 @@
  *  New physical mapping mode in SAS IO Unit Page 2.
  *  Added CONFIG_PAGE_SAS_ENCLOSURE_0.
  *  Added Slot and Enclosure fields to SAS Device Page 0.
+ *  06-24-05  01.05.09  Added EEDP defines to IOC Page 1.
+ *  Added more RAID type defines to IOC Page 2.
+ *  Added Port Enable Delay settings to BIOS Page 1.
+ *  Added Bad Block Table Full define to RAID Volume Page 
0.
+ *  Added Previous State defines to RAID Physical Disk
+ *  Page 0.
+ *  Added Max Sata Targets define for DiscoveryStatus field
+ *  of SAS IO Unit Page 0.
+ *  Added Device Self Test to Control Flags of SAS IO Unit
+ *  Page 1.
+ *  Added Direct Attach Starting Slot Number define for SAS
+ *  IO Unit Page 2.
+ *  Added new fields in SAS Device Page 2 for enclosure
+ *  mapping.
+ *  Added OwnerDevHandle and Flags field to SAS PHY 

[SCSI] embryonic RAID class

2005-09-07 Thread Linux Kernel Mailing List
tree 68c2724e2dbda8a8581592583af0d538b63db244
parent 2b7d6a8cb9718fc1d9e826201b64909c44a915f4
author James Bottomley [EMAIL PROTECTED] Wed, 17 Aug 2005 04:27:34 -0500
committer James Bottomley [EMAIL PROTECTED](none) Wed, 31 Aug 2005 08:48:51 
-0500

[SCSI] embryonic RAID class

The idea behind a RAID class is to provide a uniform interface to all
RAID subsystems (both hardware and software) in the kernel.

To do that, I've made this class a transport class that's entirely
subsystem independent (although the matching routines have to match per
subsystem, as you'll see looking at the code).  I put it in the scsi
subdirectory purely because I needed somewhere to play with it, but it's
not a scsi specific module.

I used a fusion raid card as the test bed for this; with that kind of
card, this is the type of class output you get:

[EMAIL PROTECTED] ls -l /sys/class/raid_devices/20\:0\:0\:0/
total 0
lrwxrwxrwx  1 root root 0 Aug 16 17:21 component-0 - 
../../../devices/pci:80/:80:04.0/host20/target20:1:0/20:1:0:0/
lrwxrwxrwx  1 root root 0 Aug 16 17:21 component-1 - 
../../../devices/pci:80/:80:04.0/host20/target20:1:1/20:1:1:0/
lrwxrwxrwx  1 root root 0 Aug 16 17:21 device - 
../../../devices/pci:80/:80:04.0/host20/target20:0:0/20:0:0:0/
-r--r--r--  1 root root 16384 Aug 16 17:21 level
-r--r--r--  1 root root 16384 Aug 16 17:21 resync
-r--r--r--  1 root root 16384 Aug 16 17:21 state

So it's really simple: for a SCSI device representing a hardware raid,
it shows the raid level, the array state, the resync % complete (if the
state is resyncing) and the underlying components of the RAID (these are
exposed in fusion on the virtual channel 1).

As you can see, this type of information can be exported by almost
anything, including software raid.

The more difficult trick, of course, is going to be getting it to
perform configuration type actions with writable attributes.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/Kconfig   |6 +
 drivers/scsi/Makefile  |2 
 drivers/scsi/raid_class.c  |  250 +
 include/linux/raid_class.h |   59 ++
 4 files changed, 317 insertions(+)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1,5 +1,11 @@
 menu SCSI device support
 
+config RAID_ATTRS
+   tristate RAID Transport Class
+   default n
+   ---help---
+ Provides RAID
+
 config SCSI
tristate SCSI device support
---help---
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -22,6 +22,8 @@ subdir-$(CONFIG_PCMCIA)   += pcmcia
 
 obj-$(CONFIG_SCSI) += scsi_mod.o
 
+obj-$(CONFIG_RAID_ATTRS)   += raid_class.o
+
 # --- NOTE ORDERING HERE ---
 # For kernel non-modular link, transport attributes need to
 # be initialised before drivers
diff --git a/drivers/scsi/raid_class.c b/drivers/scsi/raid_class.c
new file mode 100644
--- /dev/null
+++ b/drivers/scsi/raid_class.c
@@ -0,0 +1,250 @@
+/*
+ * RAID Attributes
+ */
+#include linux/init.h
+#include linux/module.h
+#include linux/list.h
+#include linux/raid_class.h
+#include scsi/scsi_device.h
+#include scsi/scsi_host.h
+
+#define RAID_NUM_ATTRS 3
+
+struct raid_internal {
+   struct raid_template r;
+   struct raid_function_template *f;
+   /* The actual attributes */
+   struct class_device_attribute private_attrs[RAID_NUM_ATTRS];
+   /* The array of null terminated pointers to attributes 
+* needed by scsi_sysfs.c */
+   struct class_device_attribute *attrs[RAID_NUM_ATTRS + 1];
+};
+
+struct raid_component {
+   struct list_head node;
+   struct device *dev;
+   int num;
+};
+
+#define to_raid_internal(tmpl) container_of(tmpl, struct raid_internal, r)
+
+#define tc_to_raid_internal(tcont) ({  \
+   struct raid_template *r =   \
+   container_of(tcont, struct raid_template, raid_attrs);  \
+   to_raid_internal(r);\
+})
+
+#define ac_to_raid_internal(acont) ({  \
+   struct transport_container *tc =\
+   container_of(acont, struct transport_container, ac);\
+   tc_to_raid_internal(tc);\
+})
+
+#define class_device_to_raid_internal(cdev) ({ \
+   struct attribute_container *ac =\
+   attribute_container_classdev_to_container(cdev);\
+   ac_to_raid_internal(ac);\
+})
+   
+
+static int raid_match(struct attribute_container *cont, struct device *dev)
+{
+   /* We have to look for every subsystem that could house
+* emulated RAID devices, so 

[SCSI] attribute container final klist fixes

2005-09-07 Thread Linux Kernel Mailing List
tree ad08bea9651332c41192cd7e019692a1e1e103bf
parent 53c165e0a6c8a4ff7df316557528fa7a52d20711
author James Bottomley [EMAIL PROTECTED] Sun, 28 Aug 2005 19:13:17 -0500
committer James Bottomley [EMAIL PROTECTED](none) Wed, 31 Aug 2005 08:44:32 
-0500

[SCSI] attribute container final klist fixes

Since the attribute container deletes from a klist while it's walking
it, it is vulnerable to the problem (and fix) here:

http://marc.theaimsgroup.com/?l=linux-scsim=112485448830217

The attached fixes this (but won't compile without the above).

It also fixes the logical reversal in the traversal loop which meant
that we were never actually traversing the loop to hit this bug in the
first place.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/base/attribute_container.c |   24 
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/base/attribute_container.c 
b/drivers/base/attribute_container.c
--- a/drivers/base/attribute_container.c
+++ b/drivers/base/attribute_container.c
@@ -27,6 +27,21 @@ struct internal_container {
struct class_device classdev;
 };
 
+static void internal_container_klist_get(struct klist_node *n)
+{
+   struct internal_container *ic =
+   container_of(n, struct internal_container, node);
+   class_device_get(ic-classdev);
+}
+
+static void internal_container_klist_put(struct klist_node *n)
+{
+   struct internal_container *ic =
+   container_of(n, struct internal_container, node);
+   class_device_put(ic-classdev);
+}
+
+
 /**
  * attribute_container_classdev_to_container - given a classdev, return the 
container
  *
@@ -57,7 +72,8 @@ int
 attribute_container_register(struct attribute_container *cont)
 {
INIT_LIST_HEAD(cont-node);
-   klist_init(cont-containers);
+   klist_init(cont-containers,internal_container_klist_get,
+  internal_container_klist_put);

down(attribute_container_mutex);
list_add_tail(cont-node, attribute_container_list);
@@ -163,8 +179,8 @@ attribute_container_add_device(struct de
 #define klist_for_each_entry(pos, head, member, iter) \
for (klist_iter_init(head, iter); (pos = ({ \
struct klist_node *n = klist_next(iter); \
-   n ? ({ klist_iter_exit(iter) ; NULL; }) : \
-   container_of(n, typeof(*pos), member);\
+   n ? container_of(n, typeof(*pos), member) : \
+   ({ klist_iter_exit(iter) ; NULL; }); \
}) ) != NULL; )

 
@@ -206,7 +222,7 @@ attribute_container_remove_device(struct
klist_for_each_entry(ic, cont-containers, node, iter) {
if (dev != ic-classdev.dev)
continue;
-   klist_remove(ic-node);
+   klist_del(ic-node);
if (fn)
fn(cont, dev, ic-classdev);
else {
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


This patch fixes in st.c the bug in the signed/unsigned int comparison

2005-09-07 Thread Linux Kernel Mailing List
tree 4f003966a42737e4ba347589ff15f460072597c5
parent 61a7afa2c476a3be261cf88a95b0dea0c3bd29d4
author James Bottomley [EMAIL PROTECTED](none) Thu, 01 Sep 2005 04:27:22 -0400
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:45:59 
-0500

This patch fixes in st.c the bug in the signed/unsigned int comparison
reported by Doug Gilbert and fixed by him in sg.c (see [PATCH] sg direct
io/mmap oops). Doug fixed the comparison in sg.c. This fix for st.c does not
touch the comparison but makes both arguments signed to remove the
problem. The new code is adapted from linux/fs/bio.c.

Signed-off-by: Kai Makisara [EMAIL PROTECTED]

Rejections fixed up and

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/st.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -17,7 +17,7 @@
Last modified: 18-JAN-1998 Richard Gooch [EMAIL PROTECTED] Devfs support
  */
 
-static char *verstr = 20050802;
+static char *verstr = 20050830;
 
 #include linux/module.h
 
@@ -,12 +,12 @@ static int st_map_user_pages(struct scat
 static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int 
max_pages, 
  unsigned long uaddr, size_t count, int rw)
 {
+   unsigned long end = (uaddr + count + PAGE_SIZE - 1)  PAGE_SHIFT;
+   unsigned long start = uaddr  PAGE_SHIFT;
+   const int nr_pages = end - start;
int res, i, j;
-   unsigned int nr_pages;
struct page **pages;
 
-   nr_pages = ((uaddr  ~PAGE_MASK) + count + ~PAGE_MASK)  PAGE_SHIFT;
-
/* User attempted Overflow! */
if ((uaddr + count)  uaddr)
return -EINVAL;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aacraid: bad BUG_ON fix

2005-09-07 Thread Linux Kernel Mailing List
tree 0cec7672a87b0becb254e67482c69074594943cb
parent deb92b7ee98e8e580cafaa63bd1edbe6646877bc
author Mark Haverkamp [EMAIL PROTECTED] Thu, 01 Sep 2005 22:19:23 -0700
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:46:06 
-0500

[SCSI] aacraid: bad BUG_ON fix

This was noticed by Doug Bazamic and the fix found by Mark Salyzyn at
Adaptec.

There was an error in the BUG_ON() statement that validated the
calculated fib size which can cause the driver to panic.

Signed-off-by: Mark Haverkamp [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aacraid/aachba.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -972,7 +972,7 @@ static int aac_read(struct scsi_cmnd * s
fibsize = sizeof(struct aac_read64) + 
((le32_to_cpu(readcmd-sg.count) - 1) * 
 sizeof (struct sgentry64));
-   BUG_ON (fibsize  (sizeof(struct hw_fib) - 
+   BUG_ON (fibsize  (dev-max_fib_size - 
sizeof(struct aac_fibhdr)));
/*
 *  Now send the Fib to the adapter
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] qla2xxx: Use dma_get_required_mask() in determining the 'ideal' DMA mask.

2005-09-07 Thread Linux Kernel Mailing List
tree bca4f0b98ae82020f001a1681954624c761c2865
parent c6678e0cfb41b029c3600c54b5bb65954de1230a
author Andrew Vasquez [EMAIL PROTECTED] Sat, 27 Aug 2005 09:08:00 -0700
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:53:02 
-0500

[SCSI] qla2xxx: Use dma_get_required_mask() in determining the 'ideal' DMA mask.

In order to efficiently utilise the ISP's IOCB
request-queue, use the dma_get_required_mask() function to
determine the use of command-type 2 or 3 IOCBs when queueing
SCSI commands.  This applies to ISP2[123]xx chips only, as
the ISP24xx uses command-type 7 IOCBs which use 64bit DSDs.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_os.c |   33 ++---
 1 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1113,36 +1113,23 @@ qla2xxx_slave_destroy(struct scsi_device
 static void
 qla2x00_config_dma_addressing(scsi_qla_host_t *ha)
 {
-   /* Assume 32bit DMA address */
+   /* Assume a 32bit DMA mask. */
ha-flags.enable_64bit_addressing = 0;
 
-   /*
-* Given the two variants pci_set_dma_mask(), allow the compiler to
-* assist in setting the proper dma mask.
-*/
-   if (sizeof(dma_addr_t)  4) {
-   if (pci_set_dma_mask(ha-pdev, DMA_64BIT_MASK) == 0) {
+   if (!dma_set_mask(ha-pdev-dev, DMA_64BIT_MASK)) {
+   /* Any upper-dword bits set? */
+   if (MSD(dma_get_required_mask(ha-pdev-dev)) 
+   !pci_set_consistent_dma_mask(ha-pdev, DMA_64BIT_MASK)) {
+   /* Ok, a 64bit DMA mask is applicable. */
ha-flags.enable_64bit_addressing = 1;
ha-isp_ops.calc_req_entries = qla2x00_calc_iocbs_64;
ha-isp_ops.build_iocbs = qla2x00_build_scsi_iocbs_64;
-
-   if (pci_set_consistent_dma_mask(ha-pdev,
-   DMA_64BIT_MASK)) {
-   qla_printk(KERN_DEBUG, ha,
-   Failed to set 64 bit PCI consistent mask; 
-   using 32 bit.\n);
-   pci_set_consistent_dma_mask(ha-pdev,
-   DMA_32BIT_MASK);
-   }
-   } else {
-   qla_printk(KERN_DEBUG, ha,
-   Failed to set 64 bit PCI DMA mask, falling back 
-   to 32 bit MASK.\n);
-   pci_set_dma_mask(ha-pdev, DMA_32BIT_MASK);
+   return;
}
-   } else {
-   pci_set_dma_mask(ha-pdev, DMA_32BIT_MASK);
}
+
+   dma_set_mask(ha-pdev-dev, DMA_32BIT_MASK);
+   pci_set_consistent_dma_mask(ha-pdev, DMA_32BIT_MASK);
 }
 
 static int
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] correct attribute_container list usage

2005-09-07 Thread Linux Kernel Mailing List
tree 354c599a07c45c71da2b848a90bbe4a98c42d333
parent 51490c89f95b8581782e9baa855da166441852be
author James Bottomley [EMAIL PROTECTED] Mon, 22 Aug 2005 20:06:19 -0500
committer James Bottomley [EMAIL PROTECTED](none) Wed, 31 Aug 2005 08:44:20 
-0500

[SCSI] correct attribute_container list usage

One of the changes in the attribute_container code in the scsi-misc tree
was to add a lock to protect the list of devices per container.  This,
unfortunately, leads to potential scheduling while atomic problems if
there's a sleep in the function called by a trigger.

The correct solution is to use the kernel klist infrastructure instead
which allows lockless traversal of a list.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/base/attribute_container.c  |   51 
 include/linux/attribute_container.h |4 +-
 2 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/drivers/base/attribute_container.c 
b/drivers/base/attribute_container.c
--- a/drivers/base/attribute_container.c
+++ b/drivers/base/attribute_container.c
@@ -22,7 +22,7 @@
 /* This is a private structure used to tie the classdev and the
  * container .. it should never be visible outside this file */
 struct internal_container {
-   struct list_head node;
+   struct klist_node node;
struct attribute_container *cont;
struct class_device classdev;
 };
@@ -57,8 +57,7 @@ int
 attribute_container_register(struct attribute_container *cont)
 {
INIT_LIST_HEAD(cont-node);
-   INIT_LIST_HEAD(cont-containers);
-   spin_lock_init(cont-containers_lock);
+   klist_init(cont-containers);

down(attribute_container_mutex);
list_add_tail(cont-node, attribute_container_list);
@@ -78,13 +77,13 @@ attribute_container_unregister(struct at
 {
int retval = -EBUSY;
down(attribute_container_mutex);
-   spin_lock(cont-containers_lock);
-   if (!list_empty(cont-containers))
+   spin_lock(cont-containers.k_lock);
+   if (!list_empty(cont-containers.k_list))
goto out;
retval = 0;
list_del(cont-node);
  out:
-   spin_unlock(cont-containers_lock);
+   spin_unlock(cont-containers.k_lock);
up(attribute_container_mutex);
return retval;

@@ -143,7 +142,6 @@ attribute_container_add_device(struct de
continue;
}
memset(ic, 0, sizeof(struct internal_container));
-   INIT_LIST_HEAD(ic-node);
ic-cont = cont;
class_device_initialize(ic-classdev);
ic-classdev.dev = get_device(dev);
@@ -154,13 +152,22 @@ attribute_container_add_device(struct de
fn(cont, dev, ic-classdev);
else
attribute_container_add_class_device(ic-classdev);
-   spin_lock(cont-containers_lock);
-   list_add_tail(ic-node, cont-containers);
-   spin_unlock(cont-containers_lock);
+   klist_add_tail(ic-node, cont-containers);
}
up(attribute_container_mutex);
 }
 
+/* FIXME: can't break out of this unless klist_iter_exit is also
+ * called before doing the break
+ */
+#define klist_for_each_entry(pos, head, member, iter) \
+   for (klist_iter_init(head, iter); (pos = ({ \
+   struct klist_node *n = klist_next(iter); \
+   n ? ({ klist_iter_exit(iter) ; NULL; }) : \
+   container_of(n, typeof(*pos), member);\
+   }) ) != NULL; )
+   
+
 /**
  * attribute_container_remove_device - make device eligible for removal.
  *
@@ -187,18 +194,19 @@ attribute_container_remove_device(struct
 
down(attribute_container_mutex);
list_for_each_entry(cont, attribute_container_list, node) {
-   struct internal_container *ic, *tmp;
+   struct internal_container *ic;
+   struct klist_iter iter;
 
if (attribute_container_no_classdevs(cont))
continue;
 
if (!cont-match(cont, dev))
continue;
-   spin_lock(cont-containers_lock);
-   list_for_each_entry_safe(ic, tmp, cont-containers, node) {
+
+   klist_for_each_entry(ic, cont-containers, node, iter) {
if (dev != ic-classdev.dev)
continue;
-   list_del(ic-node);
+   klist_remove(ic-node);
if (fn)
fn(cont, dev, ic-classdev);
else {
@@ -206,7 +214,6 @@ attribute_container_remove_device(struct
class_device_unregister(ic-classdev);
}
}
-   spin_unlock(cont-containers_lock);
}
up(attribute_container_mutex);
 }
@@ -232,7 +239,8 @@ 

[SCSI] qla2xxx: Add FDMI support.

2005-09-07 Thread Linux Kernel Mailing List
tree 74bb0b787d9feb1499ed2eafb2aa5a4317b6d3b5
parent ad3e0edaceb9771be7ffbd7aa24fb444a7ed85bf
author Andrew Vasquez [EMAIL PROTECTED] Sat, 27 Aug 2005 09:08:30 -0700
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:53:07 
-0500

[SCSI] qla2xxx: Add FDMI support.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_dbg.h  |7 
 drivers/scsi/qla2xxx/qla_def.h  |  151 ++
 drivers/scsi/qla2xxx/qla_gbl.h  |4 
 drivers/scsi/qla2xxx/qla_gs.c   |  564 
 drivers/scsi/qla2xxx/qla_init.c |6 
 drivers/scsi/qla2xxx/qla_isr.c  |2 
 drivers/scsi/qla2xxx/qla_mbx.c  |2 
 drivers/scsi/qla2xxx/qla_os.c   |   10 
 8 files changed, 741 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h
--- a/drivers/scsi/qla2xxx/qla_dbg.h
+++ b/drivers/scsi/qla2xxx/qla_dbg.h
@@ -81,6 +81,7 @@
 #define DEBUG2_3_11(x)  do {x;} while (0);
 #define DEBUG2_9_10(x)do {x;} while (0);
 #define DEBUG2_11(x)do {x;} while (0);
+#define DEBUG2_13(x)do {x;} while (0);
 #else
 #define DEBUG2(x)  do {} while (0);
 #endif
@@ -169,8 +170,14 @@
 
 #if defined(QL_DEBUG_LEVEL_13)
 #define DEBUG13(x)  do {x;} while (0)
+#if !defined(DEBUG2_13)
+#define DEBUG2_13(x)do {x;} while(0)
+#endif
 #else
 #define DEBUG13(x) do {} while (0)
+#if !defined(QL_DEBUG_LEVEL_2)
+#define DEBUG2_13(x)   do {} while(0)
+#endif
 #endif
 
 #if defined(QL_DEBUG_LEVEL_14)
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -214,6 +214,7 @@
  * valid range of an N-PORT id is 0 through 0x7ef.
  */
 #define NPH_LAST_HANDLE0x7ef
+#define NPH_MGMT_SERVER0x7fa   /*  FA */
 #define NPH_SNS0x7fc   /*  FC */
 #define NPH_FABRIC_CONTROLLER  0x7fd   /*  FD */
 #define NPH_F_PORT 0x7fe   /*  FE */
@@ -1131,10 +1132,7 @@ typedef struct {
 
uint8_t link_down_timeout;
 
-   uint8_t adapter_id_0[4];
-   uint8_t adapter_id_1[4];
-   uint8_t adapter_id_2[4];
-   uint8_t adapter_id_3[4];
+   uint8_t adapter_id[16];
 
uint8_t alt1_boot_node_name[WWN_SIZE];
uint16_t alt1_boot_lun_number;
@@ -1728,6 +1726,8 @@ typedef struct fc_port {
 
 #define CT_REJECT_RESPONSE 0x8001
 #define CT_ACCEPT_RESPONSE 0x8002
+#define CT_REASON_CANNOT_PERFORM   0x09
+#define CT_EXPL_ALREADY_REGISTERED 0x10
 
 #define NS_N_PORT_TYPE 0x01
 #define NS_NL_PORT_TYPE0x02
@@ -1769,6 +1769,100 @@ typedef struct fc_port {
 #defineRSNN_NN_REQ_SIZE (16 + 8 + 1 + 255)
 #defineRSNN_NN_RSP_SIZE 16
 
+/*
+ * HBA attribute types.
+ */
+#define FDMI_HBA_ATTR_COUNT9
+#define FDMI_HBA_NODE_NAME 1
+#define FDMI_HBA_MANUFACTURER  2
+#define FDMI_HBA_SERIAL_NUMBER 3
+#define FDMI_HBA_MODEL 4
+#define FDMI_HBA_MODEL_DESCRIPTION 5
+#define FDMI_HBA_HARDWARE_VERSION  6
+#define FDMI_HBA_DRIVER_VERSION7
+#define FDMI_HBA_OPTION_ROM_VERSION8
+#define FDMI_HBA_FIRMWARE_VERSION  9
+#define FDMI_HBA_OS_NAME_AND_VERSION   0xa
+#define FDMI_HBA_MAXIMUM_CT_PAYLOAD_LENGTH 0xb
+
+struct ct_fdmi_hba_attr {
+   uint16_t type;
+   uint16_t len;
+   union {
+   uint8_t node_name[WWN_SIZE];
+   uint8_t manufacturer[32];
+   uint8_t serial_num[8];
+   uint8_t model[16];
+   uint8_t model_desc[80];
+   uint8_t hw_version[16];
+   uint8_t driver_version[32];
+   uint8_t orom_version[16];
+   uint8_t fw_version[16];
+   uint8_t os_version[128];
+   uint8_t max_ct_len[4];
+   } a;
+};
+
+struct ct_fdmi_hba_attributes {
+   uint32_t count;
+   struct ct_fdmi_hba_attr entry[FDMI_HBA_ATTR_COUNT];
+};
+
+/*
+ * Port attribute types.
+ */
+#define FDMI_PORT_ATTR_COUNT   5
+#define FDMI_PORT_FC4_TYPES1
+#define FDMI_PORT_SUPPORT_SPEED2
+#define FDMI_PORT_CURRENT_SPEED3
+#define FDMI_PORT_MAX_FRAME_SIZE   4
+#define FDMI_PORT_OS_DEVICE_NAME   5
+#define FDMI_PORT_HOST_NAME6
+
+struct ct_fdmi_port_attr {
+   uint16_t type;
+   uint16_t len;
+   union {
+   uint8_t fc4_types[32];
+   uint32_t sup_speed;
+   uint32_t cur_speed;
+   uint32_t max_frame_size;
+   uint8_t os_dev_name[32];
+   uint8_t host_name[32];
+   } a;
+};
+
+/*
+ * Port Attribute Block.
+ */
+struct ct_fdmi_port_attributes {
+   uint32_t count;
+   struct ct_fdmi_port_attr 

[SCSI] qla2xxx: Simplify redundant target/device reset logic.

2005-09-07 Thread Linux Kernel Mailing List
tree b0ee920f4720316004729a54a9bd0b8725a4b078
parent f7d289f62e2ea911ecb710015efd45c687fa81ce
author Andrew Vasquez [EMAIL PROTECTED] Sat, 27 Aug 2005 09:08:50 -0700
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:53:10 
-0500

[SCSI] qla2xxx: Simplify redundant target/device reset logic.

Remove redundant qla2x00_target_reset() function in favour of
the equivalent qla2x00_device_reset().  Update callers of
old function.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_gbl.h |3 --
 drivers/scsi/qla2xxx/qla_mbx.c |   52 -
 drivers/scsi/qla2xxx/qla_os.c  |2 -
 3 files changed, 1 insertion(+), 56 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -148,9 +148,6 @@ qla2x00_abort_target(fc_port_t *);
 #endif
 
 extern int
-qla2x00_target_reset(scsi_qla_host_t *, struct fc_port *);
-
-extern int
 qla2x00_get_adapter_id(scsi_qla_host_t *, uint16_t *, uint8_t *, uint8_t *,
 uint8_t *, uint16_t *);
 
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -984,58 +984,6 @@ qla2x00_abort_target(fc_port_t *fcport)
 #endif
 
 /*
- * qla2x00_target_reset
- * Issue target reset mailbox command.
- *
- * Input:
- * ha = adapter block pointer.
- * TARGET_QUEUE_LOCK must be released.
- * ADAPTER_STATE_LOCK must be released.
- *
- * Returns:
- * qla2x00 local function return status code.
- *
- * Context:
- * Kernel context.
- */
-int
-qla2x00_target_reset(scsi_qla_host_t *ha, struct fc_port *fcport)
-{
-   int rval;
-   mbx_cmd_t mc;
-   mbx_cmd_t *mcp = mc;
-
-   DEBUG11(printk(qla2x00_target_reset(%ld): entered.\n, ha-host_no);)
-
-   if (atomic_read(fcport-state) != FCS_ONLINE)
-   return 0;
-
-   mcp-mb[0] = MBC_TARGET_RESET;
-   if (HAS_EXTENDED_IDS(ha))
-   mcp-mb[1] = fcport-loop_id;
-   else
-   mcp-mb[1] = fcport-loop_id  8;
-   mcp-mb[2] = ha-loop_reset_delay;
-   mcp-out_mb = MBX_2|MBX_1|MBX_0;
-   mcp-in_mb = MBX_0;
-   mcp-tov = 30;
-   mcp-flags = 0;
-   rval = qla2x00_mailbox_command(ha, mcp);
-
-   if (rval != QLA_SUCCESS) {
-   /*EMPTY*/
-   DEBUG2_3_11(printk(qla2x00_target_reset(%ld): failed=%x.\n,
-   ha-host_no, rval);)
-   } else {
-   /*EMPTY*/
-   DEBUG11(printk(qla2x00_target_reset(%ld): done.\n,
-   ha-host_no);)
-   }
-
-   return rval;
-}
-
-/*
  * qla2x00_get_adapter_id
  * Get adapter ID and topology.
  *
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1022,7 +1022,7 @@ qla2x00_loop_reset(scsi_qla_host_t *ha)
if (fcport-port_type != FCT_TARGET)
continue;
 
-   status = qla2x00_target_reset(ha, fcport);
+   status = qla2x00_device_reset(ha, fcport);
if (status != QLA_SUCCESS)
break;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] qla2xxx: Correct domain/area exclusion logic.

2005-09-07 Thread Linux Kernel Mailing List
tree 56dab7cac14ba96a1d1bb0a93ca5405e7a29a4a6
parent cca5335caf2d19ef8bd6b833445d2c6ca652a89b
author Andrew Vasquez [EMAIL PROTECTED] Sat, 27 Aug 2005 09:08:40 -0700
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:53:08 
-0500

[SCSI] qla2xxx: Correct domain/area exclusion logic.

In an FL topology, limit port recognition to those devices
not within the same area and domain of the ISP.  The
firmware will recogonize such devices during local-loop
discovery.

Some devices may respond to a PLOGI before they have
completed their fabric login or they may not be a public
device. In this case they will report:

domain == 00
area == 00
alpa == XX

which is valid. Exclude such devices from local loop
discovery.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_init.c |9 -
 1 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1900,7 +1900,8 @@ qla2x00_configure_local_loop(scsi_qla_ho
continue;
 
/* Bypass if not same domain and area of adapter. */
-   if (area != ha-d_id.b.area || domain != ha-d_id.b.domain)
+   if (area  domain 
+   (area != ha-d_id.b.area || domain != ha-d_id.b.domain))
continue;
 
/* Bypass invalid local loop ID. */
@@ -2400,6 +2401,12 @@ qla2x00_find_all_fabric_devs(scsi_qla_ho
if (new_fcport-d_id.b24 == ha-d_id.b24)
continue;
 
+   /* Bypass if same domain and area of adapter. */
+   if (((new_fcport-d_id.b24  0x00) ==
+   (ha-d_id.b24  0x00))  ha-current_topology ==
+   ISP_CFG_FL)
+   continue;
+
/* Bypass reserved domain fields. */
if ((new_fcport-d_id.b.domain  0xf0) == 0xf0)
continue;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] qla2xxx: Remove RISC pause/release barriers during flash manipulation.

2005-09-07 Thread Linux Kernel Mailing List
tree cf1d51ebf17aefcc9f7508af03c02d2fc39d755c
parent 06c22bd13f4eb55e291d5a31280b2ae5a70ad00d
author Andrew Vasquez [EMAIL PROTECTED] Sat, 27 Aug 2005 09:09:10 -0700
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:53:23 
-0500

[SCSI] qla2xxx: Remove RISC pause/release barriers during flash manipulation.

Remove unnecessary RISC pause/release barriers during
ISP24xx flash manipulation.  The ISP24xx can arbitrate flash
access requests during RISC executions.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_sup.c |   34 --
 1 files changed, 34 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -468,21 +468,12 @@ qla24xx_read_flash_data(scsi_qla_host_t 
 uint32_t dwords)
 {
uint32_t i;
-   struct device_reg_24xx __iomem *reg = ha-iobase-isp24;
-
-   /* Pause RISC. */
-   WRT_REG_DWORD(reg-hccr, HCCRX_SET_RISC_PAUSE);
-   RD_REG_DWORD(reg-hccr);   /* PCI Posting. */
 
/* Dword reads to flash. */
for (i = 0; i  dwords; i++, faddr++)
dwptr[i] = cpu_to_le32(qla24xx_read_flash_dword(ha,
flash_data_to_access_addr(faddr)));
 
-   /* Release RISC pause. */
-   WRT_REG_DWORD(reg-hccr, HCCRX_REL_RISC_PAUSE);
-   RD_REG_DWORD(reg-hccr);   /* PCI Posting. */
-
return dwptr;
 }
 
@@ -532,10 +523,6 @@ qla24xx_write_flash_data(scsi_qla_host_t
 
ret = QLA_SUCCESS;
 
-   /* Pause RISC. */
-   WRT_REG_DWORD(reg-hccr, HCCRX_SET_RISC_PAUSE);
-   RD_REG_DWORD(reg-hccr);   /* PCI Posting. */
-
qla24xx_get_flash_manufacturer(ha, man_id, flash_id);
DEBUG9(printk(%s(%ld): Flash man_id=%d flash_id=%d\n, __func__,
ha-host_no, man_id, flash_id));
@@ -599,10 +586,6 @@ qla24xx_write_flash_data(scsi_qla_host_t
RD_REG_DWORD(reg-ctrl_status)  ~CSRX_FLASH_ENABLE);
RD_REG_DWORD(reg-ctrl_status);/* PCI Posting. */
 
-   /* Release RISC pause. */
-   WRT_REG_DWORD(reg-hccr, HCCRX_REL_RISC_PAUSE);
-   RD_REG_DWORD(reg-hccr);   /* PCI Posting. */
-
return ret;
 }
 
@@ -630,11 +613,6 @@ qla24xx_read_nvram_data(scsi_qla_host_t 
 {
uint32_t i;
uint32_t *dwptr;
-   struct device_reg_24xx __iomem *reg = ha-iobase-isp24;
-
-   /* Pause RISC. */
-   WRT_REG_DWORD(reg-hccr, HCCRX_SET_RISC_PAUSE);
-   RD_REG_DWORD(reg-hccr);   /* PCI Posting. */
 
/* Dword reads to flash. */
dwptr = (uint32_t *)buf;
@@ -642,10 +620,6 @@ qla24xx_read_nvram_data(scsi_qla_host_t 
dwptr[i] = cpu_to_le32(qla24xx_read_flash_dword(ha,
nvram_data_to_access_addr(naddr)));
 
-   /* Release RISC pause. */
-   WRT_REG_DWORD(reg-hccr, HCCRX_REL_RISC_PAUSE);
-   RD_REG_DWORD(reg-hccr);   /* PCI Posting. */
-
return buf;
 }
 
@@ -690,10 +664,6 @@ qla24xx_write_nvram_data(scsi_qla_host_t
 
ret = QLA_SUCCESS;
 
-   /* Pause RISC. */
-   WRT_REG_DWORD(reg-hccr, HCCRX_SET_RISC_PAUSE);
-   RD_REG_DWORD(reg-hccr);   /* PCI Posting. */
-
/* Enable flash write. */
WRT_REG_DWORD(reg-ctrl_status,
RD_REG_DWORD(reg-ctrl_status) | CSRX_FLASH_ENABLE);
@@ -728,9 +698,5 @@ qla24xx_write_nvram_data(scsi_qla_host_t
RD_REG_DWORD(reg-ctrl_status)  ~CSRX_FLASH_ENABLE);
RD_REG_DWORD(reg-ctrl_status);/* PCI Posting. */
 
-   /* Release RISC pause. */
-   WRT_REG_DWORD(reg-hccr, HCCRX_REL_RISC_PAUSE);
-   RD_REG_DWORD(reg-hccr);   /* PCI Posting. */
-
return ret;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] qla2xxx: Remove redundant call to pci_unmap_sg().

2005-09-07 Thread Linux Kernel Mailing List
tree b05ad75c24e50a3a177dd988814430e454615682
parent c32c4cb9fbe3bdc2a90c6eaae5ae30521d4ba9fc
author Andrew Vasquez [EMAIL PROTECTED] Sat, 27 Aug 2005 09:09:20 -0700
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:53:28 
-0500

[SCSI] qla2xxx: Remove redundant call to pci_unmap_sg().

In a corner-case failure where the request-q does not
contain enough entries for a given request, pci_unmap_sg()
would be called twice.  Remove direct call and let the
failure-path logic handle the unmapping.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_iocb.c |6 +-
 1 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -810,12 +810,8 @@ qla24xx_start_scsi(srb_t *sp)
ha-req_q_cnt = ha-request_q_length -
(ha-req_ring_index - cnt);
}
-   if (ha-req_q_cnt  (req_cnt + 2)) {
-   if  (cmd-use_sg)
-   pci_unmap_sg(ha-pdev, sg, cmd-use_sg,
-   cmd-sc_data_direction);
+   if (ha-req_q_cnt  (req_cnt + 2))
goto queuing_error;
-   }
 
/* Build command packet. */
ha-current_outstanding_cmd = handle;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] qla2xxx: Add change_queue_depth/type() API support.

2005-09-07 Thread Linux Kernel Mailing List
tree dcb5d6a63ad4e1d88cfd58fca6ebfec4710cc998
parent 131736d34ebc3251d79ddfd08a5e57a3e86decd4
author Andrew Vasquez [EMAIL PROTECTED] Sat, 27 Aug 2005 09:09:30 -0700
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:53:40 
-0500

[SCSI] qla2xxx: Add change_queue_depth/type() API support.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_os.c |   29 +
 1 files changed, 29 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -111,6 +111,9 @@ static int qla2xxx_eh_host_reset(struct 
 static int qla2x00_loop_reset(scsi_qla_host_t *ha);
 static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *);
 
+static int qla2x00_change_queue_depth(struct scsi_device *, int);
+static int qla2x00_change_queue_type(struct scsi_device *, int);
+
 static struct scsi_host_template qla2x00_driver_template = {
.module = THIS_MODULE,
.name   = qla2xxx,
@@ -125,6 +128,8 @@ static struct scsi_host_template qla2x00
 
.slave_alloc= qla2xxx_slave_alloc,
.slave_destroy  = qla2xxx_slave_destroy,
+   .change_queue_depth = qla2x00_change_queue_depth,
+   .change_queue_type  = qla2x00_change_queue_type,
.this_id= -1,
.cmd_per_lun= 3,
.use_clustering = ENABLE_CLUSTERING,
@@ -151,6 +156,8 @@ static struct scsi_host_template qla24xx
 
.slave_alloc= qla2xxx_slave_alloc,
.slave_destroy  = qla2xxx_slave_destroy,
+   .change_queue_depth = qla2x00_change_queue_depth,
+   .change_queue_type  = qla2x00_change_queue_type,
.this_id= -1,
.cmd_per_lun= 3,
.use_clustering = ENABLE_CLUSTERING,
@@ -1109,6 +1116,28 @@ qla2xxx_slave_destroy(struct scsi_device
sdev-hostdata = NULL;
 }
 
+static int
+qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth)
+{
+   scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
+   return sdev-queue_depth;
+}
+
+static int
+qla2x00_change_queue_type(struct scsi_device *sdev, int tag_type)
+{
+   if (sdev-tagged_supported) {
+   scsi_set_tag_type(sdev, tag_type);
+   if (tag_type)
+   scsi_activate_tcq(sdev, sdev-queue_depth);
+   else
+   scsi_deactivate_tcq(sdev, sdev-queue_depth);
+   } else
+   tag_type = 0;
+
+   return tag_type;
+}
+
 /**
  * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
  * @ha: HA context
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] qla2xxx: Add host attributes.

2005-09-07 Thread Linux Kernel Mailing List
tree 42b765edbab8add27554294c4065ad850d9d36e8
parent ce7e4af7f507c156c3fd3dbb41ffe4a77c700b54
author Andrew Vasquez [EMAIL PROTECTED] Sat, 27 Aug 2005 09:09:40 -0700
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:53:42 
-0500

[SCSI] qla2xxx: Add host attributes.

Export additional host information via the shost_attrs member in
the scsi_host template.  Attributes include: driver version,
firmware version, ISP serial number, ISP type, ISP product ID,
HBA model name, HBA model description, PCI interconnect
information, and HBA port state.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_attr.c |  132 
 drivers/scsi/qla2xxx/qla_gbl.h  |2 
 drivers/scsi/qla2xxx/qla_os.c   |2 
 3 files changed, 136 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -211,6 +211,138 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t 
sysfs_remove_bin_file(host-shost_gendev.kobj, sysfs_nvram_attr);
 }
 
+/* Scsi_Host attributes. */
+
+static ssize_t
+qla2x00_drvr_version_show(struct class_device *cdev, char *buf)
+{
+   return snprintf(buf, PAGE_SIZE, %s\n, qla2x00_version_str);
+}
+
+static ssize_t
+qla2x00_fw_version_show(struct class_device *cdev, char *buf)
+{
+   scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+   char fw_str[30];
+
+   return snprintf(buf, PAGE_SIZE, %s\n,
+   ha-isp_ops.fw_version_str(ha, fw_str));
+}
+
+static ssize_t
+qla2x00_serial_num_show(struct class_device *cdev, char *buf)
+{
+   scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+   uint32_t sn;
+
+   sn = ((ha-serial0  0x1f)  16) | (ha-serial2  8) | ha-serial1;
+   return snprintf(buf, PAGE_SIZE, %c%05d\n, 'A' + sn / 10,
+   sn % 10);
+}
+
+static ssize_t
+qla2x00_isp_name_show(struct class_device *cdev, char *buf)
+{
+   scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+   return snprintf(buf, PAGE_SIZE, %s\n, ha-brd_info-isp_name);
+}
+
+static ssize_t
+qla2x00_isp_id_show(struct class_device *cdev, char *buf)
+{
+   scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+   return snprintf(buf, PAGE_SIZE, %04x %04x %04x %04x\n,
+   ha-product_id[0], ha-product_id[1], ha-product_id[2],
+   ha-product_id[3]);
+}
+
+static ssize_t
+qla2x00_model_name_show(struct class_device *cdev, char *buf)
+{
+   scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+   return snprintf(buf, PAGE_SIZE, %s\n, ha-model_number);
+}
+
+static ssize_t
+qla2x00_model_desc_show(struct class_device *cdev, char *buf)
+{
+   scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+   return snprintf(buf, PAGE_SIZE, %s\n,
+   ha-model_desc ? ha-model_desc: );
+}
+
+static ssize_t
+qla2x00_pci_info_show(struct class_device *cdev, char *buf)
+{
+   scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+   char pci_info[30];
+
+   return snprintf(buf, PAGE_SIZE, %s\n,
+   ha-isp_ops.pci_info_str(ha, pci_info));
+}
+
+static ssize_t
+qla2x00_state_show(struct class_device *cdev, char *buf)
+{
+   scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
+   int len = 0;
+
+   if (atomic_read(ha-loop_state) == LOOP_DOWN ||
+   atomic_read(ha-loop_state) == LOOP_DEAD)
+   len = snprintf(buf, PAGE_SIZE, Link Down\n);
+   else if (atomic_read(ha-loop_state) != LOOP_READY ||
+   test_bit(ABORT_ISP_ACTIVE, ha-dpc_flags) ||
+   test_bit(ISP_ABORT_NEEDED, ha-dpc_flags))
+   len = snprintf(buf, PAGE_SIZE, Unknown Link State\n);
+   else {
+   len = snprintf(buf, PAGE_SIZE, Link Up - );
+
+   switch (ha-current_topology) {
+   case ISP_CFG_NL:
+   len += snprintf(buf + len, PAGE_SIZE-len, Loop\n);
+   break;
+   case ISP_CFG_FL:
+   len += snprintf(buf + len, PAGE_SIZE-len, FL_Port\n);
+   break;
+   case ISP_CFG_N:
+   len += snprintf(buf + len, PAGE_SIZE-len,
+   N_Port to N_Port\n);
+   break;
+   case ISP_CFG_F:
+   len += snprintf(buf + len, PAGE_SIZE-len, F_Port\n);
+   break;
+   default:
+   len += snprintf(buf + len, PAGE_SIZE-len, Loop\n);
+   break;
+   }
+   }
+   return len;
+}
+
+static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show,
+   NULL);
+static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL);
+static CLASS_DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL);
+static CLASS_DEVICE_ATTR(isp_name, 

[SCSI] qla2xxx: Remove bad call to fc_remove_host() during probe failure.

2005-09-07 Thread Linux Kernel Mailing List
tree 97823923b79d9c5545cf302b24ae4a0d9eee4057
parent afb046e2be724a90f21f7cf0ba50e328005bd038
author Andrew Vasquez [EMAIL PROTECTED] Sat, 27 Aug 2005 09:10:00 -0700
committer James Bottomley [EMAIL PROTECTED](none) Mon, 05 Sep 2005 05:53:50 
-0500

[SCSI] qla2xxx: Remove bad call to fc_remove_host() during probe failure.

fc_remove_host() should only be called after a scsi_host has
been successfully added via scsi_add_host() -- any failures
while qla2xxx probing would result in an incorrect call to
fc_remove_host() during cleanup.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_os.c |2 --
 1 files changed, 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1586,8 +1586,6 @@ int qla2x00_probe_one(struct pci_dev *pd
return 0;
 
 probe_failed:
-   fc_remove_host(ha-host);
-
qla2x00_free_device(ha);
 
scsi_host_put(host);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] fix SCSI_IOCTL_PROBE_HOST

2005-09-07 Thread Linux Kernel Mailing List
tree cefbe293f78922658232f44eafd17e29714bd9fe
parent 4869040512082b761de2d7c35975d01044f8bfea
author Christoph Hellwig [EMAIL PROTECTED] Tue, 06 Sep 2005 14:03:44 +0200
committer James Bottomley [EMAIL PROTECTED](none) Wed, 07 Sep 2005 03:25:16 
-0500

[SCSI] fix SCSI_IOCTL_PROBE_HOST

This returns always false with new-style drivers right now.  Make it
return always true instead, as a host must be present if we are able
to call the ioctl (without a host attached there would be no device
node to call on..)

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/scsi_ioctl.c |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -30,20 +30,20 @@
 
 #define MAX_BUF PAGE_SIZE
 
-/*
- * If we are told to probe a host, we will return 0 if  the host is not
- * present, 1 if the host is present, and will return an identifying
- * string at *arg, if arg is non null, filling to the length stored at
- * (int *) arg
+/**
+ * ioctl_probe  --  return host identification
+ * @host:  host to identify
+ * @buffer:userspace buffer for identification
+ *
+ * Return an identifying string at @buffer, if @buffer is non-NULL, filling
+ * to the length stored at * (int *) @buffer.
  */
-
 static int ioctl_probe(struct Scsi_Host *host, void __user *buffer)
 {
unsigned int len, slen;
const char *string;
-   int temp = host-hostt-present;
 
-   if (temp  buffer) {
+   if (buffer) {
if (get_user(len, (unsigned int __user *) buffer))
return -EFAULT;
 
@@ -59,7 +59,7 @@ static int ioctl_probe(struct Scsi_Host 
return -EFAULT;
}
}
-   return temp;
+   return 1;
 }
 
 /*
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] unexport scsi_add_timer/scsi_delete_timer

2005-09-07 Thread Linux Kernel Mailing List
tree 770c8c9e857bb4d0bf7c96d831e35f91f2e11f9e
parent c5478def7a3a2dba9ceda452c2aa3539514d30a9
author Christoph Hellwig [EMAIL PROTECTED] Tue, 06 Sep 2005 14:15:37 +0200
committer James Bottomley [EMAIL PROTECTED](none) Wed, 07 Sep 2005 03:26:37 
-0500

[SCSI] unexport scsi_add_timer/scsi_delete_timer

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 Documentation/scsi/scsi_mid_low_api.txt |   41 
 drivers/scsi/scsi_error.c   |2 -
 drivers/scsi/scsi_priv.h|3 ++
 include/scsi/scsi_eh.h  |3 --
 4 files changed, 3 insertions(+), 46 deletions(-)

diff --git a/Documentation/scsi/scsi_mid_low_api.txt 
b/Documentation/scsi/scsi_mid_low_api.txt
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -373,13 +373,11 @@ Summary:
scsi_activate_tcq - turn on tag command queueing
scsi_add_device - creates new scsi device (lu) instance
scsi_add_host - perform sysfs registration and SCSI bus scan.
-   scsi_add_timer - (re-)start timer on a SCSI command.
scsi_adjust_queue_depth - change the queue depth on a SCSI device
scsi_assign_lock - replace default host_lock with given lock
scsi_bios_ptable - return copy of block device's partition table
scsi_block_requests - prevent further commands being queued to given host
scsi_deactivate_tcq - turn off tag command queueing
-   scsi_delete_timer - cancel timer on a SCSI command.
scsi_host_alloc - return a new scsi_host instance whose refcount==1
scsi_host_get - increments Scsi_Host instance's refcount
scsi_host_put - decrements Scsi_Host instance's refcount (free if 0)
@@ -458,27 +456,6 @@ int scsi_add_host(struct Scsi_Host *shos
 
 
 /**
- * scsi_add_timer - (re-)start timer on a SCSI command.
- * @scmd:pointer to scsi command instance
- * @timeout: duration of timeout in jiffies
- * @complete: pointer to function to call if timeout expires
- *
- *  Returns nothing
- *
- *  Might block: no
- *
- *  Notes: Each scsi command has its own timer, and as it is added
- *  to the queue, we set up the timer. When the command completes, 
- *  we cancel the timer. An LLD can use this function to change
- *  the existing timeout value.
- *
- *  Defined in: drivers/scsi/scsi_error.c
- **/
-void scsi_add_timer(struct scsi_cmnd *scmd, int timeout, 
-void (*complete)(struct scsi_cmnd *))
-
-
-/**
  * scsi_adjust_queue_depth - allow LLD to change queue depth on a SCSI device
  * @sdev:   pointer to SCSI device to change queue depth on
  * @tagged: 0 - no tagged queuing
@@ -566,24 +543,6 @@ void scsi_deactivate_tcq(struct scsi_dev
 
 
 /**
- * scsi_delete_timer - cancel timer on a SCSI command.
- * @scmd:pointer to scsi command instance
- *
- *  Returns 1 if able to cancel timer else 0 (i.e. too late or already
- *  cancelled).
- *
- *  Might block: no [may in the future if it invokes del_timer_sync()]
- *
- *  Notes: All commands issued by upper levels already have a timeout
- *  associated with them. An LLD can use this function to cancel the
- *  timer.
- *
- *  Defined in: drivers/scsi/scsi_error.c
- **/
-int scsi_delete_timer(struct scsi_cmnd *scmd)
-
-
-/**
  * scsi_host_alloc - create a scsi host adapter instance and perform basic
  *   initialization.
  * @sht:pointer to scsi host template
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -116,7 +116,6 @@ void scsi_add_timer(struct scsi_cmnd *sc
 
add_timer(scmd-eh_timeout);
 }
-EXPORT_SYMBOL(scsi_add_timer);
 
 /**
  * scsi_delete_timer - Delete/cancel timer for a given function.
@@ -144,7 +143,6 @@ int scsi_delete_timer(struct scsi_cmnd *
 
return rtn;
 }
-EXPORT_SYMBOL(scsi_delete_timer);
 
 /**
  * scsi_times_out - Timeout function for normal scsi commands.
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -63,6 +63,9 @@ extern int __init scsi_init_devinfo(void
 extern void scsi_exit_devinfo(void);
 
 /* scsi_error.c */
+extern void scsi_add_timer(struct scsi_cmnd *, int,
+   void (*)(struct scsi_cmnd *));
+extern int scsi_delete_timer(struct scsi_cmnd *);
 extern void scsi_times_out(struct scsi_cmnd *cmd);
 extern int scsi_error_handler(void *host);
 extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -27,9 +27,6 @@ struct scsi_sense_hdr {   /* See SPC-3 se
 };
 
 
-extern void scsi_add_timer(struct scsi_cmnd *, int,
-   void (*)(struct scsi_cmnd *));
-extern int scsi_delete_timer(struct scsi_cmnd *);
 extern void scsi_report_bus_reset(struct Scsi_Host *, int);
 extern void scsi_report_device_reset(struct 

[SCSI] aic byteorder fixes after recent cleanup

2005-09-07 Thread Linux Kernel Mailing List
tree f8984ec42ce7ee2bcd01dab32ad89d89d3028830
parent b0825488a642cadcf39709961dde61440cb0731c
author Olaf Hering [EMAIL PROTECTED] Tue, 19 Jul 2005 22:04:24 +0200
committer James Bottomley [EMAIL PROTECTED](none) Sat, 30 Jul 2005 19:08:20 
-0500

[SCSI] aic byteorder fixes after recent cleanup

 aic doesnt work anymore after this change which appeared int 2.6.13-rc1:
 [SCSI] aic7xxx/aic79xx: remove useless byte order macro cruft

 2 files did not include byteorder.h, aic died with panic
 Unknown opcode encountered in seq program
 This patch fixes it for me.

Signed-off-by: Olaf Hering [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aic7xxx/aicasm/aicasm.c   |4 ++--
 drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h |8 +---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm.c 
b/drivers/scsi/aic7xxx/aicasm/aicasm.c
--- a/drivers/scsi/aic7xxx/aicasm/aicasm.c
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm.c
@@ -369,7 +369,7 @@ output_code()
 
fprintf(ofile, %s\t0x%02x, 0x%02x, 0x%02x, 0x%02x,
cur_instr == STAILQ_FIRST(seq_program) ?  : ,\n,
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
cur_instr-format.bytes[0],
cur_instr-format.bytes[1],
cur_instr-format.bytes[2],
@@ -613,7 +613,7 @@ output_listing(char *ifilename)
line++;
}
fprintf(listfile, %03x %02x%02x%02x%02x, instrptr,
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
cur_instr-format.bytes[0],
cur_instr-format.bytes[1],
cur_instr-format.bytes[2],
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h 
b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
@@ -42,8 +42,10 @@
  * $FreeBSD$
  */
 
+#include asm/byteorder.h
+
 struct ins_format1 {
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
uint32_timmediate   : 8,
source  : 9,
destination : 9,
@@ -61,7 +63,7 @@ struct ins_format1 {
 };
 
 struct ins_format2 {
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
uint32_tshift_control   : 8,
source  : 9,
destination : 9,
@@ -79,7 +81,7 @@ struct ins_format2 {
 };
 
 struct ins_format3 {
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
uint32_timmediate   : 8,
source  : 9,
address : 10,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] git-scsi-misc: drivers/scsi/ch.c: remove devfs stuff

2005-09-07 Thread Linux Kernel Mailing List
tree 6803ca890151a325b592d758572d3cc6abded524
parent 0a637a2cec724eeb4649f6d1c07026b72c39ad84
author Adrian Bunk [EMAIL PROTECTED] Wed, 27 Jul 2005 15:07:42 -0700
committer James Bottomley [EMAIL PROTECTED](none) Sat, 30 Jul 2005 19:08:21 
-0500

[SCSI] git-scsi-misc: drivers/scsi/ch.c: remove devfs stuff

It seems very unlikely that this driver will go into any stable kernel
before devfs will be removed.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/ch.c |4 
 1 files changed, 4 deletions(-)

diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -20,7 +20,6 @@
 #include linux/interrupt.h
 #include linux/blkdev.h
 #include linux/completion.h
-#include linux/devfs_fs_kernel.h
 #include linux/ioctl32.h
 #include linux/compat.h
 #include linux/chio.h/* here are all the ioctls */
@@ -940,8 +939,6 @@ static int ch_probe(struct device *dev)
if (init)
ch_init_elem(ch);
 
-   devfs_mk_cdev(MKDEV(SCSI_CHANGER_MAJOR,ch-minor),
- S_IFCHR | S_IRUGO | S_IWUGO, ch-name);
class_device_create(ch_sysfs_class,
MKDEV(SCSI_CHANGER_MAJOR,ch-minor),
dev, s%s, ch-name);
@@ -974,7 +971,6 @@ static int ch_remove(struct device *dev)
 
class_device_destroy(ch_sysfs_class,
 MKDEV(SCSI_CHANGER_MAJOR,ch-minor));
-   devfs_remove(ch-name);
kfree(ch-dt);
kfree(ch);
ch_devcount--;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] add template for scsi_host_set_state()

2005-09-07 Thread Linux Kernel Mailing List
tree 49eaf65fda30d8824d9ce79a195c4399e65b6650
parent 82f29467a025f6a2192d281e97fca0be46e905cc
author James Bottomley [EMAIL PROTECTED](none) Sat, 30 Jul 2005 21:39:53 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sat, 30 Jul 2005 21:39:53 
-0500

[SCSI] add template for scsi_host_set_state()

Fixes up some warnings in the tree.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 include/scsi/scsi_host.h |1 +
 1 files changed, 1 insertion(+)

diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -676,5 +676,6 @@ extern struct scsi_device *scsi_get_host
 /* legacy interfaces */
 extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int);
 extern void scsi_unregister(struct Scsi_Host *);
+extern int scsi_host_set_state(struct Scsi_Host *, enum scsi_host_state);
 
 #endif /* _SCSI_SCSI_HOST_H */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] qla1280: interupt posting for irq disabling/enabling

2005-09-07 Thread Linux Kernel Mailing List
tree f42b951cce636d189249c8a915a5d10caaf62a40
parent a6c42741ace2fee235b6902e76f3c86a01d32146
author Christoph Hellwig [EMAIL PROTECTED] Mon, 04 Jul 2005 17:48:19 +0200
committer James Bottomley [EMAIL PROTECTED](none) Tue, 02 Aug 2005 21:43:44 
-0500

[SCSI] qla1280: interupt posting for irq disabling/enabling

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Thiemo Seufer [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla1280.c |   57 +
 1 files changed, 20 insertions(+), 37 deletions(-)

diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -1265,6 +1265,22 @@ qla1280_biosparam_old(Disk * disk, kdev_
return qla1280_biosparam(disk-device, NULL, disk-capacity, geom);
 }
 #endif
+ 
+/* disable risc and host interrupts */
+static inline void
+qla1280_disable_intrs(struct scsi_qla_host *ha)
+{
+   WRT_REG_WORD(ha-iobase-ictrl, 0);
+   RD_REG_WORD(ha-iobase-ictrl);/* PCI Posted Write flush */
+}
+
+/* enable risc and host interrupts */
+static inline void
+qla1280_enable_intrs(struct scsi_qla_host *ha)
+{
+   WRT_REG_WORD(ha-iobase-ictrl, (ISP_EN_INT | ISP_EN_RISC));
+   RD_REG_WORD(ha-iobase-ictrl);/* PCI Posted Write flush */
+}
 
 /**
  * qla1280_intr_handler
@@ -1286,7 +1302,7 @@ qla1280_intr_handler(int irq, void *dev_
ha-isr_count++;
reg = ha-iobase;
 
-   WRT_REG_WORD(reg-ictrl, 0);   /* disable our interrupt. */
+   qla1280_disable_intrs(ha);
 
data = qla1280_debounce_register(reg-istatus);
/* Check for pending interrupts. */
@@ -1299,8 +1315,7 @@ qla1280_intr_handler(int irq, void *dev_
 
spin_unlock(HOST_LOCK);
 
-   /* enable our interrupt. */
-   WRT_REG_WORD(reg-ictrl, (ISP_EN_INT | ISP_EN_RISC));
+   qla1280_enable_intrs(ha);
 
LEAVE_INTR(qla1280_intr_handler);
return IRQ_RETVAL(handled);
@@ -1613,38 +1628,6 @@ qla1280_return_status(struct response * 
 /*QLogic ISP1280 Hardware Support Functions.*/
 //
 
- /*
-  * qla2100_enable_intrs
-  * qla2100_disable_intrs
-  *
-  * Input:
-  *  ha = adapter block pointer.
-  *
-  * Returns:
-  *  None
-  */
-static inline void
-qla1280_enable_intrs(struct scsi_qla_host *ha)
-{
-   struct device_reg __iomem *reg;
-
-   reg = ha-iobase;
-   /* enable risc and host interrupts */
-   WRT_REG_WORD(reg-ictrl, (ISP_EN_INT | ISP_EN_RISC));
-   RD_REG_WORD(reg-ictrl);   /* PCI Posted Write flush */
-}
-
-static inline void
-qla1280_disable_intrs(struct scsi_qla_host *ha)
-{
-   struct device_reg __iomem *reg;
-
-   reg = ha-iobase;
-   /* disable risc and host interrupts */
-   WRT_REG_WORD(reg-ictrl, 0);
-   RD_REG_WORD(reg-ictrl);   /* PCI Posted Write flush */
-}
-
 /*
  * qla1280_initialize_adapter
  *  Initialize board.
@@ -4751,7 +4734,7 @@ qla1280_probe_one(struct pci_dev *pdev, 
 
 #if LINUX_VERSION_CODE = 0x020600
  error_disable_adapter:
-   WRT_REG_WORD(ha-iobase-ictrl, 0);
+   qla1280_disable_intrs(ha);
 #endif
  error_free_irq:
free_irq(pdev-irq, ha);
@@ -4788,7 +4771,7 @@ qla1280_remove_one(struct pci_dev *pdev)
scsi_remove_host(host);
 #endif
 
-   WRT_REG_WORD(ha-iobase-ictrl, 0);
+   qla1280_disable_intrs(ha);
 
free_irq(pdev-irq, ha);
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] qla1280: use SAM_ constants

2005-09-07 Thread Linux Kernel Mailing List
tree 289e8979516098c7b970b4666a8a093c30b7977e
parent 2b55cac3d2d9f545c141748d00eae86e2c042ca5
author Christoph Hellwig [EMAIL PROTECTED] Mon, 04 Jul 2005 17:48:36 +0200
committer James Bottomley [EMAIL PROTECTED](none) Tue, 02 Aug 2005 21:43:46 
-0500

[SCSI] qla1280: use SAM_ constants

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Thiemo Seufer [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla1280.c |2 +-
 drivers/scsi/qla1280.h |8 
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -4049,7 +4049,7 @@ qla1280_status_entry(struct scsi_qla_hos
/* Save ISP completion status */
CMD_RESULT(cmd) = qla1280_return_status(pkt, cmd);
 
-   if (scsi_status  SS_CHECK_CONDITION) {
+   if (scsi_status  SAM_STAT_CHECK_CONDITION) {
if (comp_status != CS_ARS_FAILED) {
uint16_t req_sense_length =
le16_to_cpu(pkt-req_sense_length);
diff --git a/drivers/scsi/qla1280.h b/drivers/scsi/qla1280.h
--- a/drivers/scsi/qla1280.h
+++ b/drivers/scsi/qla1280.h
@@ -979,14 +979,6 @@ struct ctio_a64_ret_entry {
 #define CS_RETRY0x82   /* Driver defined */
 
 /*
- * ISP status entry - SCSI status byte bit definitions.
- */
-#define SS_CHECK_CONDITION  BIT_1
-#define SS_CONDITION_METBIT_2
-#define SS_BUSY_CONDITION   BIT_3
-#define SS_RESERVE_CONFLICT (BIT_4 | BIT_3)
-
-/*
  * ISP target entries - Option flags bit definitions.
  */
 #define OF_ENABLE_TAG   BIT_1  /* Tagged queue action enable */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aic79xx: needs to select SPI_TRANSPORT_ATTRS

2005-09-07 Thread Linux Kernel Mailing List
tree 747c43febb3fb85668810a6996dccaf7044d337e
parent 0e68c00373f61fcdee453f6c9878e3390fc0f0ce
author [EMAIL PROTECTED] [EMAIL PROTECTED] Sun, 07 Aug 2005 13:32:07 -0700
committer James Bottomley [EMAIL PROTECTED](none) Sun, 07 Aug 2005 19:34:29 
-0500

[SCSI] aic79xx: needs to select SPI_TRANSPORT_ATTRS

without it you get this failure:

drivers/built-in.o(.text+0xdcccd): In function `ahd_linux_slave_configure':
drivers/scsi/aic7xxx/aic79xx_osm.c:636: undefined reference to `spi_dv_device'
drivers/built-in.o(.text+0xdd7b1): In function `ahd_send_async':
drivers/scsi/aic7xxx/aic79xx_osm.c:1652: undefined reference to 
`spi_display_xfer_agreement'
drivers/built-in.o(.init.text+0x7b4d): In function `ahd_linux_init':
drivers/scsi/aic7xxx/aic79xx_osm.c:2765: undefined reference to 
`spi_attach_transport'
drivers/built-in.o(.init.text+0x7c94):drivers/scsi/aic7xxx/aic79xx_osm.c:2774: 
undefined reference to `spi_release_transport'
drivers/built-in.o(.exit.text+0x72c): In function `ahd_linux_exit':
drivers/scsi/aic7xxx/aic79xx_osm.c:2783: undefined reference to 
`spi_release_transport'

Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aic7xxx/Kconfig.aic79xx |1 +
 1 files changed, 1 insertion(+)

diff --git a/drivers/scsi/aic7xxx/Kconfig.aic79xx 
b/drivers/scsi/aic7xxx/Kconfig.aic79xx
--- a/drivers/scsi/aic7xxx/Kconfig.aic79xx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic79xx
@@ -5,6 +5,7 @@
 config SCSI_AIC79XX
tristate Adaptec AIC79xx U320 support
depends on PCI  SCSI
+   select SCSI_SPI_ATTRS
help
This driver supports all of Adaptec's Ultra 320 PCI-X
based SCSI controllers.
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] qla1280: endianess annotations

2005-09-07 Thread Linux Kernel Mailing List
tree fe8ae190259fe0d0ad17c74e90077950eea31809
parent 7a34766fdcec0c619aa68ace203b934dd7cf9dbc
author Christoph Hellwig [EMAIL PROTECTED] Mon, 04 Jul 2005 17:49:26 +0200
committer James Bottomley [EMAIL PROTECTED](none) Tue, 02 Aug 2005 21:43:52 
-0500

[SCSI] qla1280: endianess annotations

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla1280.c |8 -
 drivers/scsi/qla1280.h |  270 -
 2 files changed, 139 insertions(+), 139 deletions(-)

diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -1546,7 +1546,7 @@ qla1280_return_status(struct response * 
int host_status = DID_ERROR;
uint16_t comp_status = le16_to_cpu(sts-comp_status);
uint16_t state_flags = le16_to_cpu(sts-state_flags);
-   uint16_t residual_length = le16_to_cpu(sts-residual_length);
+   uint16_t residual_length = le32_to_cpu(sts-residual_length);
uint16_t scsi_status = le16_to_cpu(sts-scsi_status);
 #if DEBUG_QLA1280_INTR
static char *reason[] = {
@@ -1932,7 +1932,7 @@ qla1280_load_firmware_dma(struct scsi_ql
%d,%d(0x%x)\n,
risc_code_address, cnt, num, risc_address);
for(i = 0; i  cnt; i++)
-   ((uint16_t *)ha-request_ring)[i] =
+   ((__le16 *)ha-request_ring)[i] =
cpu_to_le16(risc_code_address[i]);
 
mb[0] = MBC_LOAD_RAM;
@@ -2986,7 +2986,7 @@ qla1280_64bit_start_scsi(struct scsi_qla
struct scsi_cmnd *cmd = sp-cmd;
cmd_a64_entry_t *pkt;
struct scatterlist *sg = NULL;
-   u32 *dword_ptr;
+   __le32 *dword_ptr;
dma_addr_t dma_handle;
int status = 0;
int cnt;
@@ -3273,7 +3273,7 @@ qla1280_32bit_start_scsi(struct scsi_qla
struct scsi_cmnd *cmd = sp-cmd;
struct cmd_entry *pkt;
struct scatterlist *sg = NULL;
-   uint32_t *dword_ptr;
+   __le32 *dword_ptr;
int status = 0;
int cnt;
int req_cnt;
diff --git a/drivers/scsi/qla1280.h b/drivers/scsi/qla1280.h
--- a/drivers/scsi/qla1280.h
+++ b/drivers/scsi/qla1280.h
@@ -516,23 +516,23 @@ struct cmd_entry {
uint8_t entry_count;/* Entry count. */
uint8_t sys_define; /* System defined. */
uint8_t entry_status;   /* Entry Status. */
-   uint32_t handle;/* System handle. */
+   __le32 handle;  /* System handle. */
uint8_t lun;/* SCSI LUN */
uint8_t target; /* SCSI ID */
-   uint16_t cdb_len;   /* SCSI command length. */
-   uint16_t control_flags; /* Control flags. */
-   uint16_t reserved;
-   uint16_t timeout;   /* Command timeout. */
-   uint16_t dseg_count;/* Data segment count. */
+   __le16 cdb_len; /* SCSI command length. */
+   __le16 control_flags;   /* Control flags. */
+   __le16 reserved;
+   __le16 timeout; /* Command timeout. */
+   __le16 dseg_count;  /* Data segment count. */
uint8_t scsi_cdb[MAX_CMDSZ];/* SCSI command words. */
-   uint32_t dseg_0_address;/* Data segment 0 address. */
-   uint32_t dseg_0_length; /* Data segment 0 length. */
-   uint32_t dseg_1_address;/* Data segment 1 address. */
-   uint32_t dseg_1_length; /* Data segment 1 length. */
-   uint32_t dseg_2_address;/* Data segment 2 address. */
-   uint32_t dseg_2_length; /* Data segment 2 length. */
-   uint32_t dseg_3_address;/* Data segment 3 address. */
-   uint32_t dseg_3_length; /* Data segment 3 length. */
+   __le32 dseg_0_address;  /* Data segment 0 address. */
+   __le32 dseg_0_length;   /* Data segment 0 length. */
+   __le32 dseg_1_address;  /* Data segment 1 address. */
+   __le32 dseg_1_length;   /* Data segment 1 length. */
+   __le32 dseg_2_address;  /* Data segment 2 address. */
+   __le32 dseg_2_length;   /* Data segment 2 length. */
+   __le32 dseg_3_address;  /* Data segment 3 address. */
+   __le32 dseg_3_length;   /* Data segment 3 length. */
 };
 
 /*
@@ -544,21 +544,21 @@ struct cont_entry {
uint8_t entry_count;/* Entry count. */
uint8_t sys_define; /* System defined. */
uint8_t entry_status;   /* Entry Status. */
-   uint32_t reserved;  /* Reserved */
-   uint32_t dseg_0_address;/* Data segment 0 address. */
-   uint32_t dseg_0_length; /* Data segment 0 length. */
-   uint32_t dseg_1_address;/* Data segment 1 address. */
-  

[SCSI] add global timeout to the scsi mid-layer

2005-09-07 Thread Linux Kernel Mailing List
tree 4eb9124ae72e1a905094c259465718793698e603
parent f03a567054fea4f9d43c50ec91338266c0bd588d
author James Bottomley [EMAIL PROTECTED] Sat, 06 Aug 2005 07:45:40 -0500
committer James Bottomley [EMAIL PROTECTED](none) Mon, 08 Aug 2005 19:55:39 
-0500

[SCSI] add global timeout to the scsi mid-layer

There are certain rogue devices (and the aic7xxx driver) that return
BUSY or QUEUE_FULL forever.  This code will apply a global timeout (of
the total number of retries times the per command timer) to a given
command.  If it is exceeded, the command is completed regardless of its
state.

The patch also removes the unused field in the command: timeout and
timeout_total.

This solves the problem of detecting an endless loop in the mid-layer
because of BUSY/QUEUE_FULL bouncing, but will not recover the device.
In the aic7xxx case, the driver can be recovered by sending a bus reset,
so possibly this should be tied into the error handler?

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/advansys.c  |4 ++--
 drivers/scsi/scsi.c  |   15 +++
 include/scsi/scsi_cmnd.h |8 ++--
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -9200,8 +9200,8 @@ asc_prt_scsi_cmnd(struct scsi_cmnd *s)
 (unsigned) s-serial_number, s-retries, s-allowed);
 
 printk(
- timeout_per_command %d, timeout_total %d, timeout %d\n,
-s-timeout_per_command, s-timeout_total, s-timeout);
+ timeout_per_command %d\n,
+s-timeout_per_command);
 
 printk(
  scsi_done 0x%lx, done 0x%lx, host_scribble 0x%lx, result 0x%x\n,
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -268,6 +268,7 @@ struct scsi_cmnd *scsi_get_command(struc
} else
put_device(dev-sdev_gendev);
 
+   cmd-jiffies_at_alloc = jiffies;
return cmd;
 }  
 EXPORT_SYMBOL(scsi_get_command);
@@ -798,9 +799,23 @@ static void scsi_softirq(struct softirq_
while (!list_empty(local_q)) {
struct scsi_cmnd *cmd = list_entry(local_q.next,
   struct scsi_cmnd, eh_entry);
+   /* The longest time any command should be outstanding is the
+* per command timeout multiplied by the number of retries.
+*
+* For a typical command, this is 2.5 minutes */
+   unsigned long wait_for 
+   = cmd-allowed * cmd-timeout_per_command;
list_del_init(cmd-eh_entry);
 
disposition = scsi_decide_disposition(cmd);
+   if (disposition != SUCCESS 
+   time_before(cmd-jiffies_at_alloc + wait_for, jiffies)) {
+   dev_printk(KERN_ERR, cmd-device-sdev_gendev, 
+  timing out command, waited %ds\n,
+  wait_for/HZ);
+   disposition = SUCCESS;
+   }
+   
scsi_log_completion(cmd, disposition);
switch (disposition) {
case SUCCESS:
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -51,12 +51,16 @@ struct scsi_cmnd {
 * printk's to use -pid, so that we can kill this field.
 */
unsigned long serial_number;
+   /*
+* This is set to jiffies as it was when the command was first
+* allocated.  It is used to time how long the command has
+* been outstanding
+*/
+   unsigned long jiffies_at_alloc;
 
int retries;
int allowed;
int timeout_per_command;
-   int timeout_total;
-   int timeout;
 
unsigned char cmd_len;
unsigned char old_cmd_len;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aacraid: sgraw command support

2005-09-07 Thread Linux Kernel Mailing List
tree 7172e827bccfa4b9c04fc11ddc54ae34a6376562
parent 12a26d0879d8a4502425037e9013b1f64ed669b7
author Mark Haverkamp [EMAIL PROTECTED] Thu, 04 Aug 2005 05:39:49 -0700
committer James Bottomley [EMAIL PROTECTED](none) Sat, 06 Aug 2005 02:57:56 
-0500

[SCSI] aacraid: sgraw command support

Received from Mark Salyzyn from Adaptec:

This patch adds support for the new raw io command. This new command
offers much larger io commands, is more friendly to the internal firmware
structure requiring less translation efforts by the firmware and offers
support for targets greater than 2TB (patch to support 2TB will
be sent in the future).

Signed-off-by: Mark Haverkamp [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aacraid/aachba.c  |  181 ++---
 drivers/scsi/aacraid/aacraid.h |   43 +
 2 files changed, 194 insertions(+), 30 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -133,6 +133,7 @@ struct inquiry_data {
  
 static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* 
sgmap);
 static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* 
psg);
+static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct 
sgmapraw* psg);
 static int aac_send_srb_fib(struct scsi_cmnd* scsicmd);
 #ifdef AAC_DETAILED_STATUS_INFO
 static char *aac_get_status_string(u32 status);
@@ -777,34 +778,36 @@ int aac_get_adapter_info(struct aac_dev*
/* 
 * 57 scatter gather elements 
 */
-   dev-scsi_host_ptr-sg_tablesize = (dev-max_fib_size -
-   sizeof(struct aac_fibhdr) -
-   sizeof(struct aac_write) + sizeof(struct sgmap)) /
-   sizeof(struct sgmap);
-   if (dev-dac_support) {
-   /* 
-* 38 scatter gather elements 
-*/
-   dev-scsi_host_ptr-sg_tablesize =
-   (dev-max_fib_size -
+   if (!(dev-raw_io_interface)) {
+   dev-scsi_host_ptr-sg_tablesize = (dev-max_fib_size -
sizeof(struct aac_fibhdr) -
-   sizeof(struct aac_write64) +
-   sizeof(struct sgmap64)) /
-   sizeof(struct sgmap64);
-   }
-   dev-scsi_host_ptr-max_sectors = AAC_MAX_32BIT_SGBCOUNT;
-   if(!(dev-adapter_info.options  AAC_OPT_NEW_COMM)) {
-   /*
-* Worst case size that could cause sg overflow when
-* we break up SG elements that are larger than 64KB.
-* Would be nice if we could tell the SCSI layer what
-* the maximum SG element size can be. Worst case is
-* (sg_tablesize-1) 4KB elements with one 64KB
-* element.
-*  32bit - 468 or 238KB   64bit - 424 or 212KB
-*/
-   dev-scsi_host_ptr-max_sectors =
- (dev-scsi_host_ptr-sg_tablesize * 8) + 112;
+   sizeof(struct aac_write) + sizeof(struct sgmap)) /
+   sizeof(struct sgmap);
+   if (dev-dac_support) {
+   /* 
+* 38 scatter gather elements 
+*/
+   dev-scsi_host_ptr-sg_tablesize =
+   (dev-max_fib_size -
+   sizeof(struct aac_fibhdr) -
+   sizeof(struct aac_write64) +
+   sizeof(struct sgmap64)) /
+   sizeof(struct sgmap64);
+   }
+   dev-scsi_host_ptr-max_sectors = AAC_MAX_32BIT_SGBCOUNT;
+   if(!(dev-adapter_info.options  AAC_OPT_NEW_COMM)) {
+   /*
+* Worst case size that could cause sg overflow when
+* we break up SG elements that are larger than 64KB.
+* Would be nice if we could tell the SCSI layer what
+* the maximum SG element size can be. Worst case is
+* (sg_tablesize-1) 4KB elements with one 64KB
+* element.
+*  32bit - 468 or 238KB   64bit - 424 or 212KB
+*/
+   dev-scsi_host_ptr-max_sectors =
+ (dev-scsi_host_ptr-sg_tablesize * 8) + 112;
+   }
}
 
fib_complete(fibptr);
@@ -905,7 +908,32 @@ static int aac_read(struct scsi_cmnd * s
 
fib_init(cmd_fibcontext);
 
-   if (dev-dac_support == 1) {
+   if (dev-raw_io_interface) {
+   struct aac_raw_io *readcmd;
+   readcmd = (struct aac_raw_io *) fib_data(cmd_fibcontext);
+   readcmd-block[0] = cpu_to_le32(lba);
+   

[SCSI] aacraid: driver version update

2005-09-07 Thread Linux Kernel Mailing List
tree a73d27c245d024ea9e0e0651d3ca524ef74ba9b5
parent bed30de47b034b5f28fb7db2fae4860b9d9c0622
author Mark Haverkamp [EMAIL PROTECTED] Thu, 04 Aug 2005 05:38:55 -0700
committer James Bottomley [EMAIL PROTECTED](none) Sat, 06 Aug 2005 02:50:26 
-0500

[SCSI] aacraid: driver version update

Received from Mark Salyzyn from Adaptec.

Fixes a bug in check_revision.  It should return the driver version not
the firmware version.
Update driver version number.
Update driver version string.

Signed-off-by: Mark Haverkamp [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aacraid/aacraid.h  |8 +---
 drivers/scsi/aacraid/commctrl.c |   16 +---
 drivers/scsi/aacraid/linit.c|   21 -
 3 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1512,11 +1512,12 @@ struct fib_ioctl
 
 struct revision
 {
-   u32 compat;
-   u32 version;
-   u32 build;
+   __le32 compat;
+   __le32 version;
+   __le32 build;
 };

+
 /*
  * Ugly - non Linux like ioctl coding for back compat.
  */
@@ -1737,3 +1738,4 @@ int aac_get_adapter_info(struct aac_dev*
 int aac_send_shutdown(struct aac_dev *dev);
 extern int numacb;
 extern int acbsize;
+extern char aac_driver_version[];
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -405,10 +405,20 @@ static int close_getadapter_fib(struct a
 static int check_revision(struct aac_dev *dev, void __user *arg)
 {
struct revision response;
+   char *driver_version = aac_driver_version;
+   u32 version;
 
-   response.compat = 1;
-   response.version = le32_to_cpu(dev-adapter_info.kernelrev);
-   response.build = le32_to_cpu(dev-adapter_info.kernelbuild);
+   response.compat = cpu_to_le32(1);
+   version = (simple_strtol(driver_version, 
+   driver_version, 10)  24) | 0x0400;
+   version += simple_strtol(driver_version + 1, driver_version, 10)  16;
+   version += simple_strtol(driver_version + 1, NULL, 10);
+   response.version = cpu_to_le32(version);
+#  if (defined(AAC_DRIVER_BUILD))
+   response.build = cpu_to_le32(AAC_DRIVER_BUILD);
+#  else
+   response.build = cpu_to_le32();
+#  endif
 
if (copy_to_user(arg, response, sizeof(response)))
return -EFAULT;
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -27,8 +27,11 @@
  * Abstract: Linux Driver entry module for Adaptec RAID Array Controller
  */
 
-#define AAC_DRIVER_VERSION 1.1.2-lk2
-#define AAC_DRIVER_BUILD_DATE  __DATE__
+#define AAC_DRIVER_VERSION 1.1-4
+#ifndef AAC_DRIVER_BRANCH
+#define AAC_DRIVER_BRANCH  
+#endif
+#define AAC_DRIVER_BUILD_DATE  __DATE__   __TIME__
 #define AAC_DRIVERNAME aacraid
 
 #include linux/compat.h
@@ -58,16 +61,24 @@
 
 #include aacraid.h
 
+#ifdef AAC_DRIVER_BUILD
+#define _str(x) #x
+#define str(x) _str(x)
+#define AAC_DRIVER_FULL_VERSIONAAC_DRIVER_VERSION [ 
str(AAC_DRIVER_BUILD) ] AAC_DRIVER_BRANCH
+#else
+#define AAC_DRIVER_FULL_VERSIONAAC_DRIVER_VERSION AAC_DRIVER_BRANCH  
 AAC_DRIVER_BUILD_DATE
+#endif
 
 MODULE_AUTHOR(Red Hat Inc and Adaptec);
 MODULE_DESCRIPTION(Dell PERC2, 2/Si, 3/Si, 3/Di, 
   Adaptec Advanced Raid Products, 
   and HP NetRAID-4M SCSI driver);
 MODULE_LICENSE(GPL);
-MODULE_VERSION(AAC_DRIVER_VERSION);
+MODULE_VERSION(AAC_DRIVER_FULL_VERSION);
 
 static LIST_HEAD(aac_devices);
 static int aac_cfg_major = -1;
+char aac_driver_version[] = AAC_DRIVER_FULL_VERSION;
 
 /*
  * Because of the way Linux names scsi devices, the order in this table has
@@ -896,8 +907,8 @@ static int __init aac_init(void)
 {
int error;

-   printk(KERN_INFO Red Hat/Adaptec aacraid driver (%s %s)\n,
-   AAC_DRIVER_VERSION, AAC_DRIVER_BUILD_DATE);
+   printk(KERN_INFO Adaptec %s driver (%s)\n,
+ AAC_DRIVERNAME, aac_driver_version);
 
error = pci_module_init(aac_pci_driver);
if (error)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aic7xxx/79xx: fix another potential panic due to a non existent target

2005-09-07 Thread Linux Kernel Mailing List
tree f83fa07a0dc721a41a7e5d984284b823aa39b261
parent 79778a27be4c704552a18cf2a3e8b9e30623acd1
author James Bottomley [EMAIL PROTECTED] Sat, 06 Aug 2005 02:24:54 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sat, 06 Aug 2005 02:49:15 
-0500

[SCSI] aic7xxx/79xx: fix another potential panic due to a non existent target

I ran into this one sending bus resets across the hardware.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aic7xxx/aic79xx_osm.c |4 ++--
 drivers/scsi/aic7xxx/aic7xxx_osm.c |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c 
b/drivers/scsi/aic7xxx/aic79xx_osm.c
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1617,9 +1617,9 @@ ahd_send_async(struct ahd_softc *ahd, ch
 * are identical to those last reported.
 */
starget = ahd-platform_data-starget[target];
-   targ = scsi_transport_target_data(starget);
-   if (targ == NULL)
+   if (starget == NULL)
break;
+   targ = scsi_transport_target_data(starget);
 
target_ppr_options =
(spi_dt(starget) ? MSG_EXT_PPR_DT_REQ : 0)
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c 
b/drivers/scsi/aic7xxx/aic7xxx_osm.c
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1618,9 +1618,9 @@ ahc_send_async(struct ahc_softc *ahc, ch
if (channel == 'B')
target_offset += 8;
starget = ahc-platform_data-starget[target_offset];
-   targ = scsi_transport_target_data(starget);
-   if (targ == NULL)
+   if (starget == NULL)
break;
+   targ = scsi_transport_target_data(starget);
 
target_ppr_options =
(spi_dt(starget) ? MSG_EXT_PPR_DT_REQ : 0)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aic7xxx: upport all sequencer and core fixes from adaptec version 6.3.9

2005-09-07 Thread Linux Kernel Mailing List
tree 43a3107ead65790b9f5ffa04d54d5daa8904de79
parent 52b5cfb355b2b3274979d25490f190d478ab1fad
author James Bottomley [EMAIL PROTECTED] Fri, 05 Aug 2005 03:33:22 -0500
committer James Bottomley [EMAIL PROTECTED](none) Fri, 05 Aug 2005 03:41:25 
-0500

[SCSI] aic7xxx: upport all sequencer and core fixes from adaptec version 6.3.9

This patch upports all relevant code fixes and bumps the driver version
to 7.0 to signify starting a new tree.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 Documentation/scsi/aic7xxx.txt   |6 
 drivers/scsi/aic7xxx/aic7xxx.h   |4 
 drivers/scsi/aic7xxx/aic7xxx.reg |4 
 drivers/scsi/aic7xxx/aic7xxx.seq |5 
 drivers/scsi/aic7xxx/aic7xxx_93cx6.c |   36 
 drivers/scsi/aic7xxx/aic7xxx_core.c  |   60 -
 drivers/scsi/aic7xxx/aic7xxx_osm.c   |2 
 drivers/scsi/aic7xxx/aic7xxx_osm.h   |2 
 drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped   |6 
 drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped |4 
 drivers/scsi/aic7xxx/aic7xxx_seq.h_shipped   |  933 +++
 11 files changed, 549 insertions(+), 513 deletions(-)

diff --git a/Documentation/scsi/aic7xxx.txt b/Documentation/scsi/aic7xxx.txt
--- a/Documentation/scsi/aic7xxx.txt
+++ b/Documentation/scsi/aic7xxx.txt
@@ -1,5 +1,5 @@
 
-=Adaptec Aic7xxx Fast - Ultra160 Family Manager Set v6.2.28   =
+=Adaptec Aic7xxx Fast - Ultra160 Family Manager Set v7.0  =
 =README for=
 = The Linux Operating System   =
 
@@ -131,6 +131,10 @@ The following information is available i
   SCSI stub effects.
 
 2. Version History
+   7.0   (4th August, 2005)
+   - Updated driver to use SCSI transport class infrastructure
+   - Upported sequencer and core fixes from last adaptec released
+ version of the driver.
6.2.36 (June 3rd, 2003)
 - Correct code that disables PCI parity error checking.
 - Correct and simplify handling of the ignore wide residue
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h
--- a/drivers/scsi/aic7xxx/aic7xxx.h
+++ b/drivers/scsi/aic7xxx/aic7xxx.h
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.h#79 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.h#85 $
  *
  * $FreeBSD$
  */
@@ -243,7 +243,7 @@ typedef enum {
 */
AHC_AIC7850_FE  = AHC_SPIOCAP|AHC_AUTOPAUSE|AHC_TARGETMODE|AHC_ULTRA,
AHC_AIC7860_FE  = AHC_AIC7850_FE,
-   AHC_AIC7870_FE  = AHC_TARGETMODE,
+   AHC_AIC7870_FE  = AHC_TARGETMODE|AHC_AUTOPAUSE,
AHC_AIC7880_FE  = AHC_AIC7870_FE|AHC_ULTRA,
/*
 * Although we have space for both the initiator and
diff --git a/drivers/scsi/aic7xxx/aic7xxx.reg b/drivers/scsi/aic7xxx/aic7xxx.reg
--- a/drivers/scsi/aic7xxx/aic7xxx.reg
+++ b/drivers/scsi/aic7xxx/aic7xxx.reg
@@ -39,7 +39,7 @@
  *
  * $FreeBSD$
  */
-VERSION = $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#39 $
+VERSION = $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#40 $
 
 /*
  * This file is processed by the aic7xxx_asm utility for use in assembling
@@ -1306,7 +1306,6 @@ scratch_ram {
 */
MWI_RESIDUAL {
size1
-   alias   TARG_IMMEDIATE_SCB
}
/*
 * SCBID of the next SCB to be started by the controller.
@@ -1461,6 +1460,7 @@ scratch_ram {
 */
LAST_MSG {
size1
+   alias   TARG_IMMEDIATE_SCB
}
 
/*
diff --git a/drivers/scsi/aic7xxx/aic7xxx.seq b/drivers/scsi/aic7xxx/aic7xxx.seq
--- a/drivers/scsi/aic7xxx/aic7xxx.seq
+++ b/drivers/scsi/aic7xxx/aic7xxx.seq
@@ -40,7 +40,7 @@
  * $FreeBSD$
  */
 
-VERSION = $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#56 $
+VERSION = $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#58 $
 PATCH_ARG_LIST = struct ahc_softc *ahc
 PREFIX = ahc_
 
@@ -679,6 +679,7 @@ await_busfree:
clr SCSIBUSL;   /* Prevent bit leakage durint SELTO */
}
and SXFRCTL0, ~SPIOEN;
+   mvi SEQ_FLAGS, NOT_IDENTIFIED|NO_CDB_SENT;
testSSTAT1,REQINIT|BUSFREE  jz .;
testSSTAT1, BUSFREE jnz poll_for_work;
mvi MISSED_BUSFREE call set_seqint;
@@ -1097,7 +1098,7 @@ ultra2_dmahalt:
testSCB_RESIDUAL_DATACNT[3], SG_LAST_SEG jz dma_mid_sg;
if ((ahc-flags  AHC_TARGETROLE) != 0) {
testSSTAT0, TARGET jz dma_last_sg;
-   if ((ahc-flags  AHC_TMODE_WIDEODD_BUG) != 0) {
+   if ((ahc-bugs  AHC_TMODE_WIDEODD_BUG) != 0) {
test

[SCSI] aacraid: interupt mitigation

2005-09-07 Thread Linux Kernel Mailing List
tree 1dd29e4f8ae3122d8cc642523a6f0cd2ca70bfd3
parent fc789a93994858b5e5a46afb96d0dcf6cc1b6f08
author Mark Haverkamp [EMAIL PROTECTED] Thu, 04 Aug 2005 05:38:51 -0700
committer James Bottomley [EMAIL PROTECTED](none) Sat, 06 Aug 2005 02:49:46 
-0500

[SCSI] aacraid: interupt mitigation

Received from Mark Salyzyn from Adaptec:

If more than two commands are outstanding to the controller, there is no
need to notify the adapter via a PCI bus transaction of additional
commands added into the queue; it will get to them when it works through
the produce/consumer indexes.

This reduced the PCI traffic in the driver to submit a command to the
queue to near zero allowing a significant number of commands to be
turned around with no need to block for the PCI bridge to flush the
notify request to the adapter.

Interrupt mitigation has always been present in the driver; it was
turned off because of a bug that prevented one from realizing the
usefulness of the feature. This bug is fixed in this patch.

Signed-off-by: Mark Haverkamp [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aacraid/comminit.c |4 +++-
 drivers/scsi/aacraid/commsup.c  |   20 +---
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -44,7 +44,9 @@
 
 #include aacraid.h
 
-struct aac_common aac_config;
+struct aac_common aac_config = {
+   .irq_mod = 1
+};
 
 static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long 
commsize, unsigned long commalign)
 {
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -254,6 +254,7 @@ static void fib_dealloc(struct fib * fib
 static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry 
**entry, u32 * index, unsigned long *nonotify)
 {
struct aac_queue * q;
+   unsigned long idx;
 
/*
 *  All of the queues wrap when they reach the end, so we check
@@ -263,10 +264,23 @@ static int aac_get_entry (struct aac_dev
 */
 
q = dev-queues-queue[qid];
-   
-   *index = le32_to_cpu(*(q-headers.producer));
-   if ((*index - 2) == le32_to_cpu(*(q-headers.consumer)))
+
+   idx = *index = le32_to_cpu(*(q-headers.producer));
+   /* Interrupt Moderation, only interrupt for first two entries */
+   if (idx != le32_to_cpu(*(q-headers.consumer))) {
+   if (--idx == 0) {
+   if (qid == AdapHighCmdQueue)
+   idx = ADAP_HIGH_CMD_ENTRIES;
+   else if (qid == AdapNormCmdQueue)
+   idx = ADAP_NORM_CMD_ENTRIES;
+   else if (qid == AdapHighRespQueue) 
+   idx = ADAP_HIGH_RESP_ENTRIES;
+   else if (qid == AdapNormRespQueue) 
+   idx = ADAP_NORM_RESP_ENTRIES;
+   }
+   if (idx != le32_to_cpu(*(q-headers.consumer)))
*nonotify = 1; 
+   }
 
if (qid == AdapHighCmdQueue) {
if (*index = ADAP_HIGH_CMD_ENTRIES)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aacraid: driver shutdown method

2005-09-07 Thread Linux Kernel Mailing List
tree 7ec25f58f22929ee48495addf8facda797668852
parent c7f476023f57145357df32346b7de9202ce47d5f
author Mark Haverkamp [EMAIL PROTECTED] Thu, 04 Aug 2005 05:39:01 -0700
committer James Bottomley [EMAIL PROTECTED](none) Sat, 06 Aug 2005 02:51:11 
-0500

[SCSI] aacraid: driver shutdown method

Add in pci shutdown method so that the adapter shuts down correctly and
flushes its cache. Shutdown should also disable the adapter's interrupt
when shutdown (in particularly if the driver is rmmod'd) to prevent
spurious hardware activities.

Signed-off-by: Mark Haverkamp [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aacraid/aacraid.h |4 
 drivers/scsi/aacraid/linit.c   |   13 -
 drivers/scsi/aacraid/rkt.c |   20 
 drivers/scsi/aacraid/rx.c  |   20 
 drivers/scsi/aacraid/sa.c  |   22 --
 5 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -460,6 +460,7 @@ struct adapter_ops
 {
void (*adapter_interrupt)(struct aac_dev *dev);
void (*adapter_notify)(struct aac_dev *dev, u32 event);
+   void (*adapter_disable_int)(struct aac_dev *dev);
int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 
p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 
*r4);
int  (*adapter_check_health)(struct aac_dev *dev);
 };
@@ -994,6 +995,9 @@ struct aac_dev
 #define aac_adapter_notify(dev, event) \
(dev)-a_ops.adapter_notify(dev, event)
 
+#define aac_adapter_disable_int(dev) \
+   (dev)-a_ops.adapter_disable_int(dev)
+
 #define aac_adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, 
r2, r3, r4) \
(dev)-a_ops.adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, 
status, r1, r2, r3, r4)
 
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -849,11 +849,12 @@ static int __devinit aac_probe_one(struc
 
return 0;
 
-out_deinit:
+ out_deinit:
kill_proc(aac-thread_pid, SIGKILL, 0);
wait_for_completion(aac-aif_completion);
 
aac_send_shutdown(aac);
+   aac_adapter_disable_int(aac);
fib_map_free(aac);
pci_free_consistent(aac-pdev, aac-comm_size, aac-comm_addr, 
aac-comm_phys);
kfree(aac-queues);
@@ -870,6 +871,13 @@ out_deinit:
return error;
 }
 
+static void aac_shutdown(struct pci_dev *dev)
+{
+   struct Scsi_Host *shost = pci_get_drvdata(dev);
+   struct aac_dev *aac = (struct aac_dev *)shost-hostdata;
+   aac_send_shutdown(aac);
+}
+
 static void __devexit aac_remove_one(struct pci_dev *pdev)
 {
struct Scsi_Host *shost = pci_get_drvdata(pdev);
@@ -881,6 +889,7 @@ static void __devexit aac_remove_one(str
wait_for_completion(aac-aif_completion);
 
aac_send_shutdown(aac);
+   aac_adapter_disable_int(aac);
fib_map_free(aac);
pci_free_consistent(aac-pdev, aac-comm_size, aac-comm_addr,
aac-comm_phys);
@@ -901,6 +910,7 @@ static struct pci_driver aac_pci_driver 
.id_table   = aac_pci_tbl,
.probe  = aac_probe_one,
.remove = __devexit_p(aac_remove_one),
+   .shutdown   = aac_shutdown,
 };
 
 static int __init aac_init(void)
@@ -919,6 +929,7 @@ static int __init aac_init(void)
printk(KERN_WARNING
   aacraid: unable to register \aac\ device.\n);
}
+
return 0;
 }
 
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c
--- a/drivers/scsi/aacraid/rkt.c
+++ b/drivers/scsi/aacraid/rkt.c
@@ -88,6 +88,16 @@ static irqreturn_t aac_rkt_intr(int irq,
 }
 
 /**
+ * aac_rkt_disable_interrupt   -   Disable interrupts
+ * @dev: Adapter
+ */
+
+static void aac_rkt_disable_interrupt(struct aac_dev *dev)
+{
+   rkt_writeb(dev, MUnit.OIMR, dev-OIMR = 0xff);
+}
+
+/**
  * rkt_sync_cmd-   send a command and wait
  * @dev: Adapter
  * @command: Command to execute
@@ -412,10 +422,19 @@ int aac_rkt_init(struct aac_dev *dev)
 *  Fill in the function dispatch table.
 */
dev-a_ops.adapter_interrupt = aac_rkt_interrupt_adapter;
+   dev-a_ops.adapter_disable_int = aac_rkt_disable_interrupt;
dev-a_ops.adapter_notify = aac_rkt_notify_adapter;
dev-a_ops.adapter_sync_cmd = rkt_sync_cmd;
dev-a_ops.adapter_check_health = aac_rkt_check_health;
 
+   /*
+*  First clear out all interrupts.  Then enable the one's that we
+*  can handle.
+*/
+   rkt_writeb(dev, MUnit.OIMR, 0xff);
+   rkt_writel(dev, MUnit.ODR, 0x);
+   rkt_writeb(dev, MUnit.OIMR, dev-OIMR = 0xfb);
+
if (aac_init_adapter(dev) == 

[SCSI] qla1280: don't use bitfields for hardware access in isp_config

2005-09-07 Thread Linux Kernel Mailing List
tree 1266e52875e27c859c14f42731854c70b60c6582
parent 5c79d6154f335543ea4c4a555f645a1f76b5d117
author Christoph Hellwig [EMAIL PROTECTED] Mon, 04 Jul 2005 17:48:55 +0200
committer James Bottomley [EMAIL PROTECTED](none) Tue, 02 Aug 2005 21:43:50 
-0500

[SCSI] qla1280: don't use bitfields for hardware access in isp_config

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Thiemo Seufer [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/qla1280.c |   44 +---
 drivers/scsi/qla1280.h |   30 --
 2 files changed, 41 insertions(+), 33 deletions(-)

diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -2189,9 +2189,9 @@ qla1280_set_defaults(struct scsi_qla_hos
/* nv-cntr_flags_1.disable_loading_risc_code = 1; */
nv-firmware_feature.f.enable_fast_posting = 1;
nv-firmware_feature.f.disable_synchronous_backoff = 1;
-   nv-termination.f.scsi_bus_0_control = 3;
-   nv-termination.f.scsi_bus_1_control = 3;
-   nv-termination.f.auto_term_support = 1;
+   nv-termination.scsi_bus_0_control = 3;
+   nv-termination.scsi_bus_1_control = 3;
+   nv-termination.auto_term_support = 1;
 
/*
 * Set default FIFO magic - What appropriate values would be here
@@ -2201,7 +2201,12 @@ qla1280_set_defaults(struct scsi_qla_hos
 * header file provided by QLogic seems to be bogus or incomplete
 * at best.
 */
-   nv-isp_config.c = ISP_CFG1_BENAB|ISP_CFG1_F128;
+   nv-isp_config.burst_enable = 1;
+   if (IS_ISP1040(ha))
+   nv-isp_config.fifo_threshold |= 3;
+   else
+   nv-isp_config.fifo_threshold |= 4;
+
if (IS_ISP1x160(ha))
nv-isp_parameter = 0x01; /* fast memory enable */
 
@@ -2362,31 +2367,40 @@ qla1280_nvram_config(struct scsi_qla_hos
 
hwrev = RD_REG_WORD(reg-cfg_0)  ISP_CFG0_HWMSK;
 
-   cfg1 = RD_REG_WORD(reg-cfg_1);
+   cfg1 = RD_REG_WORD(reg-cfg_1)  ~(BIT_4 | BIT_5 | BIT_6);
cdma_conf = RD_REG_WORD(reg-cdma_cfg);
ddma_conf = RD_REG_WORD(reg-ddma_cfg);
 
/* Busted fifo, says mjacob. */
-   if (hwrev == ISP_CFG0_1040A)
-   WRT_REG_WORD(reg-cfg_1, cfg1 | ISP_CFG1_F64);
-   else
-   WRT_REG_WORD(reg-cfg_1, cfg1 | ISP_CFG1_F64 | 
ISP_CFG1_BENAB);
+   if (hwrev != ISP_CFG0_1040A)
+   cfg1 |= nv-isp_config.fifo_threshold  4;
+
+   cfg1 |= nv-isp_config.burst_enable  2;
+   WRT_REG_WORD(reg-cfg_1, cfg1);
 
WRT_REG_WORD(reg-cdma_cfg, cdma_conf | CDMA_CONF_BENAB);
WRT_REG_WORD(reg-ddma_cfg, cdma_conf | DDMA_CONF_BENAB);
} else {
+   uint16_t cfg1, term;
+
/* Set ISP hardware DMA burst */
-   mb[0] = nv-isp_config.c;
+   cfg1 = nv-isp_config.fifo_threshold  4;
+   cfg1 |= nv-isp_config.burst_enable  2;
/* Enable DMA arbitration on dual channel controllers */
if (ha-ports  1)
-   mb[0] |= BIT_13;
-   WRT_REG_WORD(reg-cfg_1, mb[0]);
+   cfg1 |= BIT_13;
+   WRT_REG_WORD(reg-cfg_1, cfg1);
 
/* Set SCSI termination. */
-   WRT_REG_WORD(reg-gpio_enable, (BIT_3 + BIT_2 + BIT_1 + 
BIT_0));
-   mb[0] = nv-termination.c  (BIT_3 + BIT_2 + BIT_1 + BIT_0);
-   WRT_REG_WORD(reg-gpio_data, mb[0]);
+   WRT_REG_WORD(reg-gpio_enable,
+BIT_7 | BIT_3 | BIT_2 | BIT_1 | BIT_0);
+   term = nv-termination.scsi_bus_1_control;
+   term |= nv-termination.scsi_bus_0_control  2;
+   term |= nv-termination.auto_term_support  7;
+   RD_REG_WORD(reg-id_l);/* Flush PCI write */
+   WRT_REG_WORD(reg-gpio_data, term);
}
+   RD_REG_WORD(reg-id_l);/* Flush PCI write */
 
/* ISP parameter word. */
mb[0] = MBC_SET_SYSTEM_PARAMETER;
diff --git a/drivers/scsi/qla1280.h b/drivers/scsi/qla1280.h
--- a/drivers/scsi/qla1280.h
+++ b/drivers/scsi/qla1280.h
@@ -375,29 +375,23 @@ struct nvram {
uint16_t unused_12; /* 12, 13 */
uint16_t unused_14; /* 14, 15 */
 
-   union {
-   uint8_t c;
-   struct {
-   uint8_t reserved:2;
-   uint8_t burst_enable:1;
-   uint8_t reserved_1:1;
-   uint8_t fifo_threshold:4;
-   } f;
+   struct {
+   uint8_t reserved:2;
+   uint8_t burst_enable:1;
+   uint8_t reserved_1:1;
+   uint8_t fifo_threshold:4;
} isp_config;   /* 16 */

[SCSI] lpfc driver 8.0.30 : fix lip/cablepull panic

2005-09-07 Thread Linux Kernel Mailing List
tree 3bd3c4f60e0cbb5c316dad3789abaf4fc1facbd0
parent 483f05f0134e60b724bc3678507c1def860c56d5
author [EMAIL PROTECTED] [EMAIL PROTECTED] Wed, 10 Aug 2005 23:02:50 -0400
committer James Bottomley [EMAIL PROTECTED](none) Fri, 12 Aug 2005 22:08:30 
-0500

[SCSI] lpfc driver 8.0.30 : fix lip/cablepull panic

Fix panic on lip and cable pull

Symptoms: Panic on lip or cable pull

Cause: Use after free of nlp in lpfc_nlp_remove()

Fix: Do not make FC transport calls after a node is removed. Transport
calls are disabled by ignoring the initial delete transition.

Signed-off-by: James Smart [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/lpfc/lpfc_hbadisc.c |2 ++
 1 files changed, 2 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1135,6 +1135,8 @@ lpfc_nlp_list(struct lpfc_hba * phba, st
switch(list) {
case NLP_NO_LIST: /* No list, just remove it */
lpfc_nlp_remove(phba, nlp);
+   /* as node removed - stop further transport calls */
+   rport_del = none;
break;
case NLP_UNUSED_LIST:
spin_lock_irq(phba-host-host_lock);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] add missing hold_mcs parameter to the spi transport class

2005-09-07 Thread Linux Kernel Mailing List
tree ad5ef1024415a81f31426879b4b32c17e373d910
parent 3f40d7d6eaadecd48f6d1c0c4a5ad414b992260e
author James Bottomley [EMAIL PROTECTED] Thu, 04 Aug 2005 01:43:52 -0500
committer James Bottomley [EMAIL PROTECTED](none) Thu, 04 Aug 2005 01:54:55 
-0500

[SCSI] add missing hold_mcs parameter to the spi transport class

This parameter is important only to people who take the time to tune the
margin control settings, otherwise it's completely irrelevant.  However,
just in case anyone should want to do this, it's appropriate to include
the parameter.

I don't do anything with it in DV by design, so the parameter will come
up as off by default, so if anyone actually wants to play with the
margin control settings they'll have to enable it under the
spi_transport class first.

I also updated the transfer settings display to report all of the PPR
settings instead of only DT, IU and QAS

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/scsi_transport_spi.c |   20 +++-
 include/scsi/scsi_transport_spi.h |5 +
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/scsi_transport_spi.c 
b/drivers/scsi/scsi_transport_spi.c
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -35,7 +35,7 @@
 
 #define SPI_PRINTK(x, l, f, a...)  dev_printk(l, (x)-dev, f , ##a)
 
-#define SPI_NUM_ATTRS 13   /* increase this if you add attributes */
+#define SPI_NUM_ATTRS 14   /* increase this if you add attributes */
 #define SPI_OTHER_ATTRS 1  /* Increase this if you add always
 * on attributes */
 #define SPI_HOST_ATTRS 1
@@ -231,6 +231,7 @@ static int spi_setup_transport_attrs(str
spi_rd_strm(starget) = 0;
spi_rti(starget) = 0;
spi_pcomp_en(starget) = 0;
+   spi_hold_mcs(starget) = 0;
spi_dv_pending(starget) = 0;
spi_initial_dv(starget) = 0;
init_MUTEX(spi_dv_sem(starget));
@@ -347,6 +348,7 @@ spi_transport_rd_attr(wr_flow, %d\n);
 spi_transport_rd_attr(rd_strm, %d\n);
 spi_transport_rd_attr(rti, %d\n);
 spi_transport_rd_attr(pcomp_en, %d\n);
+spi_transport_rd_attr(hold_mcs, %d\n);
 
 /* we only care about the first child device so we return 1 */
 static int child_iter(struct device *dev, void *data)
@@ -1028,10 +1030,17 @@ void spi_display_xfer_agreement(struct s
sprint_frac(tmp, picosec, 1000);
 
dev_info(starget-dev,
-   %s %sSCSI %d.%d MB/s %s%s%s (%s ns, offset %d)\n,
-   scsi, tp-width ? WIDE  : , kb100/10, kb100 % 10,
-   tp-dt ? DT : ST, tp-iu ?  IU : ,
-   tp-qas  ?  QAS : , tmp, tp-offset);
+%s %sSCSI %d.%d MB/s %s%s%s%s%s%s%s%s (%s ns, offset 
%d)\n,
+scsi, tp-width ? WIDE  : , kb100/10, kb100 % 10,
+tp-dt ? DT : ST,
+tp-iu ?  IU : ,
+tp-qas  ?  QAS : ,
+tp-rd_strm ?  RDSTRM : ,
+tp-rti ?  RTI : ,
+tp-wr_flow ?  WRFLOW : ,
+tp-pcomp_en ?  PCOMP : ,
+tp-hold_mcs ?  HMCS : ,
+tmp, tp-offset);
} else {
dev_info(starget-dev, %sasynchronous.\n,
tp-width ? wide  : );
@@ -1154,6 +1163,7 @@ spi_attach_transport(struct spi_function
SETUP_ATTRIBUTE(rd_strm);
SETUP_ATTRIBUTE(rti);
SETUP_ATTRIBUTE(pcomp_en);
+   SETUP_ATTRIBUTE(hold_mcs);
 
/* if you add an attribute but forget to increase SPI_NUM_ATTRS
 * this bug will trigger */
diff --git a/include/scsi/scsi_transport_spi.h 
b/include/scsi/scsi_transport_spi.h
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -39,6 +39,7 @@ struct spi_transport_attrs {
unsigned int rd_strm:1; /* Read streaming enabled */
unsigned int rti:1; /* Retain Training Information */
unsigned int pcomp_en:1;/* Precompensation enabled */
+   unsigned int hold_mcs:1;/* Hold Margin Control Settings */
unsigned int initial_dv:1; /* DV done to this target yet  */
unsigned long flags;/* flags field for drivers to use */
/* Device Properties fields */
@@ -78,6 +79,7 @@ struct spi_host_attrs {
 #define spi_rd_strm(x) (((struct spi_transport_attrs 
*)(x)-starget_data)-rd_strm)
 #define spi_rti(x) (((struct spi_transport_attrs 
*)(x)-starget_data)-rti)
 #define spi_pcomp_en(x)(((struct spi_transport_attrs 
*)(x)-starget_data)-pcomp_en)
+#define spi_hold_mcs(x)(((struct spi_transport_attrs 
*)(x)-starget_data)-hold_mcs)
 #define spi_initial_dv(x)  (((struct spi_transport_attrs 
*)(x)-starget_data)-initial_dv)
 
 #define spi_support_sync(x)(((struct spi_transport_attrs 
*)(x)-starget_data)-support_sync)
@@ -114,6 +116,8 @@ struct spi_function_template 

[SCSI] drivers/scsi/st.c: add reference count and related fixes

2005-09-07 Thread Linux Kernel Mailing List
tree 97b3258660d52dc0359d50f27b5f593c935c9012
parent 5262d0851cc6692390ee1aa2c55f57f3bfd0a7c7
author Kai Makisara [EMAIL PROTECTED] Tue, 02 Aug 2005 13:40:47 +0300
committer James Bottomley [EMAIL PROTECTED](none) Mon, 08 Aug 2005 19:33:48 
-0500

[SCSI] drivers/scsi/st.c: add reference count and related fixes

I have rediffed the patch against 2.6.13-rc5, done a couple of cosmetic
cleanups, and run some tests.  Brian King has acknowledged that it fixes the
problems he has seen. Seems mature enough for inclusion into 2.6.14 (or
later)?

Nate's explanation of the changes:

I've attached patches against 2.6.13rc2. These are basically identical
to my earlier patches, as I found that all issues I'd seen in earlier
kernels still existed in this kernel.

To summarize, the changes are: (more details in my original email)

- add a kref to the scsi_tape structure, and associate reference
counting stuff

- set sr_request-end_io = blk_end_sync_rq so we get notified when an IO
is rejected when the device goes away

- check rq_status when IOs complete, else we don't know that IOs
rejected for a dead device in fact did not complete

- change last_SRpnt so it's set before an async IO is issued (in case
st_sleep_done is bypassed)

- fix a bogus use of last_SRpnt in st_chk_result

Signed-off-by: Nate Dailey [EMAIL PROTECTED]
Signed-off-by: Kai Makisara [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/st.c |  150 +++---
 drivers/scsi/st.h |3 -
 2 files changed, 123 insertions(+), 30 deletions(-)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -17,7 +17,7 @@
Last modified: 18-JAN-1998 Richard Gooch [EMAIL PROTECTED] Devfs support
  */
 
-static char *verstr = 20050501;
+static char *verstr = 20050802;
 
 #include linux/module.h
 
@@ -219,6 +219,12 @@ static int switch_partition(struct scsi_
 
 static int st_int_ioctl(struct scsi_tape *, unsigned int, unsigned long);
 
+static void scsi_tape_release(struct kref *);
+
+#define to_scsi_tape(obj) container_of(obj, struct scsi_tape, kref)
+
+static DECLARE_MUTEX(st_ref_sem);
+
 
 #include osst_detect.h
 #ifndef SIGS_FROM_OSST
@@ -230,6 +236,46 @@ static int st_int_ioctl(struct scsi_tape
{OnStream, FW-, , osst}
 #endif
 
+static struct scsi_tape *scsi_tape_get(int dev)
+{
+   struct scsi_tape *STp = NULL;
+
+   down(st_ref_sem);
+   write_lock(st_dev_arr_lock);
+
+   if (dev  st_dev_max  scsi_tapes != NULL)
+   STp = scsi_tapes[dev];
+   if (!STp) goto out;
+
+   kref_get(STp-kref);
+
+   if (!STp-device)
+   goto out_put;
+
+   if (scsi_device_get(STp-device))
+   goto out_put;
+
+   goto out;
+
+out_put:
+   kref_put(STp-kref, scsi_tape_release);
+   STp = NULL;
+out:
+   write_unlock(st_dev_arr_lock);
+   up(st_ref_sem);
+   return STp;
+}
+
+static void scsi_tape_put(struct scsi_tape *STp)
+{
+   struct scsi_device *sdev = STp-device;
+
+   down(st_ref_sem);
+   kref_put(STp-kref, scsi_tape_release);
+   scsi_device_put(sdev);
+   up(st_ref_sem);
+}
+
 struct st_reject_data {
char *vendor;
char *model;
@@ -311,7 +357,7 @@ static int st_chk_result(struct scsi_tap
return 0;
 
cmdstatp = STp-buffer-cmdstat;
-   st_analyze_sense(STp-buffer-last_SRpnt, cmdstatp);
+   st_analyze_sense(SRpnt, cmdstatp);
 
if (cmdstatp-have_sense)
scode = STp-buffer-cmdstat.sense_hdr.sense_key;
@@ -399,10 +445,10 @@ static void st_sleep_done(struct scsi_cm
 
(STp-buffer)-cmdstat.midlevel_result = SCpnt-result;
SCpnt-request-rq_status = RQ_SCSI_DONE;
-   (STp-buffer)-last_SRpnt = SCpnt-sc_request;
DEB( STp-write_pending = 0; )
 
-   complete(SCpnt-request-waiting);
+   if (SCpnt-request-waiting)
+   complete(SCpnt-request-waiting);
 }
 
 /* Do the scsi command. Waits until command performed if do_wait is true.
@@ -412,8 +458,20 @@ static struct scsi_request *
 st_do_scsi(struct scsi_request * SRpnt, struct scsi_tape * STp, unsigned char 
*cmd,
   int bytes, int direction, int timeout, int retries, int do_wait)
 {
+   struct completion *waiting;
unsigned char *bp;
 
+   /* if async, make sure there's no command outstanding */
+   if (!do_wait  ((STp-buffer)-last_SRpnt)) {
+   printk(KERN_ERR %s: Async command already active.\n,
+  tape_name(STp));
+   if (signal_pending(current))
+   (STp-buffer)-syscall_result = (-EINTR);
+   else
+   (STp-buffer)-syscall_result = (-EBUSY);
+   return NULL;
+   }
+
if (SRpnt == NULL) {
SRpnt = scsi_allocate_request(STp-device, GFP_ATOMIC);
if (SRpnt == NULL) {
@@ -427,7 +485,13 @@ st_do_scsi(struct scsi_request * 

[SCSI] lpfc driver 8.0.30 : dev_loss and nodev timeouts

2005-09-07 Thread Linux Kernel Mailing List
tree ab04eda0ed5763908dfbb5803e44052e53607f40
parent f888ba3ce77c66bece3d804caf7d559838209a4a
author [EMAIL PROTECTED] [EMAIL PROTECTED] Wed, 10 Aug 2005 23:02:30 -0400
committer James Bottomley [EMAIL PROTECTED](none) Fri, 12 Aug 2005 22:08:54 
-0500

[SCSI] lpfc driver 8.0.30 : dev_loss and nodev timeouts

Fix handling of the dev_loss and nodev timeouts.

Symptoms: when remote port disappears for a period of time longer then
either nodev_tmo or dev_loss_tmo, the lpfc driver worker thread will
stall removing that remote port.

Cause: removing remote port involves un-blocking and sync-ing
corresponding block device queue. But corresponding node in the lpfc
driver is still in the NPR(?node port recovery?) state and mid-layer
gets SCSI_MLQUEUE_HOST_BUSY as a return value when it is trying to call
queuecommand() with command for that node (AKA remote port)

Fix: Instead of returning SCSI_MLQUEUE_HOST_BUS from queuecommand() for
nodes in NPR states complete it with retry-able error code  DID_BUS_BUSY

Signed-off-by: James Smart [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/lpfc/lpfc_scsi.c |4 
 1 files changed, 4 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -753,6 +753,10 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd
cmnd-result = ScsiResult(DID_NO_CONNECT, 0);
goto out_fail_command;
}
+   else if (ndlp-nlp_state == NLP_STE_NPR_NODE) {
+   cmnd-result = ScsiResult(DID_BUS_BUSY, 0);
+   goto out_fail_command;
+   }
/*
 * The device is most likely recovered and the driver
 * needs a bit more time to finish.  Ask the midlayer
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] lpfc driver 8.0.30 : convert to use of int_to_scsilun()

2005-09-07 Thread Linux Kernel Mailing List
tree db1f8660dba0b448b1a4150d44a084dafaf5253e
parent ea84c3f74df646a0897e95c78147190517a751a9
author [EMAIL PROTECTED] [EMAIL PROTECTED] Wed, 10 Aug 2005 23:03:09 -0400
committer James Bottomley [EMAIL PROTECTED](none) Fri, 12 Aug 2005 22:09:01 
-0500

[SCSI] lpfc driver 8.0.30 : convert to use of int_to_scsilun()

Replace use of lpfc_put_lun with midlayer's int_to_scsilun

Remove driver's local definition of lpfc_put_lun (which converts an
int back to a 64-bit LUN) and replace it's use with the recently added
int_to_scsilun function provided by the midlayer.

Note: Embedding midlayer structure in our structure caused
need for more files to include midlayer headers.

Signed-off-by: James Smart [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/lpfc/lpfc_attr.c  |1 +
 drivers/scsi/lpfc/lpfc_ct.c|1 +
 drivers/scsi/lpfc/lpfc_els.c   |1 +
 drivers/scsi/lpfc/lpfc_hbadisc.c   |1 +
 drivers/scsi/lpfc/lpfc_init.c  |1 +
 drivers/scsi/lpfc/lpfc_mbox.c  |2 ++
 drivers/scsi/lpfc/lpfc_mem.c   |2 ++
 drivers/scsi/lpfc/lpfc_nportdisc.c |1 +
 drivers/scsi/lpfc/lpfc_scsi.c  |   11 ---
 drivers/scsi/lpfc/lpfc_scsi.h  |   13 +
 drivers/scsi/lpfc/lpfc_sli.c   |1 +
 11 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -23,6 +23,7 @@
 #include linux/pci.h
 #include linux/interrupt.h
 
+#include scsi/scsi.h
 #include scsi/scsi_device.h
 #include scsi/scsi_host.h
 #include scsi/scsi_tcq.h
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -27,6 +27,7 @@
 #include linux/interrupt.h
 #include linux/utsname.h
 
+#include scsi/scsi.h
 #include scsi/scsi_device.h
 #include scsi/scsi_host.h
 #include scsi/scsi_transport_fc.h
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -23,6 +23,7 @@
 #include linux/pci.h
 #include linux/interrupt.h
 
+#include scsi/scsi.h
 #include scsi/scsi_device.h
 #include scsi/scsi_host.h
 #include scsi/scsi_transport_fc.h
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -24,6 +24,7 @@
 #include linux/kthread.h
 #include linux/interrupt.h
 
+#include scsi/scsi.h
 #include scsi/scsi_device.h
 #include scsi/scsi_host.h
 #include scsi/scsi_transport_fc.h
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -28,6 +28,7 @@
 #include linux/pci.h
 #include linux/spinlock.h
 
+#include scsi/scsi.h
 #include scsi/scsi_device.h
 #include scsi/scsi_host.h
 #include scsi/scsi_transport_fc.h
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -26,6 +26,8 @@
 #include scsi/scsi_device.h
 #include scsi/scsi_transport_fc.h
 
+#include scsi/scsi.h
+
 #include lpfc_hw.h
 #include lpfc_sli.h
 #include lpfc_disc.h
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -26,6 +26,8 @@
 #include scsi/scsi_device.h
 #include scsi/scsi_transport_fc.h
 
+#include scsi/scsi.h
+
 #include lpfc_hw.h
 #include lpfc_sli.h
 #include lpfc_disc.h
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c 
b/drivers/scsi/lpfc/lpfc_nportdisc.c
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -23,6 +23,7 @@
 #include linux/pci.h
 #include linux/interrupt.h
 
+#include scsi/scsi.h
 #include scsi/scsi_device.h
 #include scsi/scsi_host.h
 #include scsi/scsi_transport_fc.h
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -40,11 +40,6 @@
 #define LPFC_RESET_WAIT  2
 #define LPFC_ABORT_WAIT  2
 
-static inline void lpfc_put_lun(struct fcp_cmnd *fcmd, unsigned int lun)
-{
-   fcmd-fcpLunLsl = 0;
-   fcmd-fcpLunMsl = swab16((uint16_t)lun);
-}
 
 /*
  * This routine allocates a scsi buffer, which contains all the necessary
@@ -453,7 +448,8 @@ lpfc_scsi_prep_cmnd(struct lpfc_hba * ph
/* clear task management bits */
lpfc_cmd-fcp_cmnd-fcpCntl2 = 0;
 
-   lpfc_put_lun(lpfc_cmd-fcp_cmnd, lpfc_cmd-pCmd-device-lun);
+   int_to_scsilun(lpfc_cmd-pCmd-device-lun,
+   lpfc_cmd-fcp_cmnd-fcp_lun);
 
memcpy(fcp_cmnd-fcpCdb[0], scsi_cmnd-cmnd, 16);
 
@@ -552,7 +548,8 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc
piocb = piocbq-iocb;
 
fcp_cmnd = lpfc_cmd-fcp_cmnd;
-   lpfc_put_lun(lpfc_cmd-fcp_cmnd, 

[SCSI] lpfc driver 8.0.30 : update version to 8.0.30

2005-09-07 Thread Linux Kernel Mailing List
tree fc7d4cf9f2f1fa7d7ddefb272583a844120328cf
parent 918865230e55b1fece2d8edec39d46c00626590b
author [EMAIL PROTECTED] [EMAIL PROTECTED] Wed, 10 Aug 2005 23:03:17 -0400
committer James Bottomley [EMAIL PROTECTED](none) Fri, 12 Aug 2005 22:09:32 
-0500

[SCSI] lpfc driver 8.0.30 : update version to 8.0.30

Signed-off-by: James Smart [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/lpfc/lpfc_version.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -18,7 +18,7 @@
  * included with this package. *
  ***/
 
-#define LPFC_DRIVER_VERSION 8.0.29
+#define LPFC_DRIVER_VERSION 8.0.30
 
 #define LPFC_DRIVER_NAME lpfc
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] add ability to deny binding to SPI transport class

2005-09-07 Thread Linux Kernel Mailing List
tree 21b45648425c43f6a392afc0da800524608c7caf
parent 3a4f5c60dbe1978580ea03c1aff353d1e63d1638
author James Bottomley [EMAIL PROTECTED] Mon, 15 Aug 2005 00:34:06 -0500
committer James Bottomley [EMAIL PROTECTED](none) Mon, 15 Aug 2005 00:42:25 
-0500

[SCSI] add ability to deny binding to SPI transport class

This patch is necessary if we begin exposing underlying physical disks
(which can attach to the SPI transport class) of the hardware RAID
cards, since we don't want any SPI parameters binding to the RAID
devices.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/scsi_transport_spi.c |   11 ++-
 include/scsi/scsi_transport_spi.h |1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_spi.c 
b/drivers/scsi/scsi_transport_spi.c
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -1082,6 +1082,7 @@ static int spi_device_match(struct attri
 {
struct scsi_device *sdev;
struct Scsi_Host *shost;
+   struct spi_internal *i;
 
if (!scsi_is_sdev_device(dev))
return 0;
@@ -1094,6 +1095,9 @@ static int spi_device_match(struct attri
/* Note: this class has no device attributes, so it has
 * no per-HBA allocation and thus we don't need to distinguish
 * the attribute containers for the device */
+   i = to_spi_internal(shost-transportt);
+   if (i-f-deny_binding  i-f-deny_binding(sdev-sdev_target))
+   return 0;
return 1;
 }
 
@@ -1101,6 +1105,7 @@ static int spi_target_match(struct attri
struct device *dev)
 {
struct Scsi_Host *shost;
+   struct scsi_target *starget;
struct spi_internal *i;
 
if (!scsi_is_target_device(dev))
@@ -1112,7 +1117,11 @@ static int spi_target_match(struct attri
return 0;
 
i = to_spi_internal(shost-transportt);
-   
+   starget = to_scsi_target(dev);
+
+   if (i-f-deny_binding  i-f-deny_binding(starget))
+   return 0;
+
return i-t.target_attrs.ac == cont;
 }
 
diff --git a/include/scsi/scsi_transport_spi.h 
b/include/scsi/scsi_transport_spi.h
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -120,6 +120,7 @@ struct spi_function_template {
void(*set_hold_mcs)(struct scsi_target *, int);
void(*get_signalling)(struct Scsi_Host *);
void(*set_signalling)(struct Scsi_Host *, enum spi_signal_type);
+   int (*deny_binding)(struct scsi_target *);
/* The driver sets these to tell the transport class it
 * wants the attributes displayed in sysfs.  If the show_ flag
 * is not set, the attribute will be private to the transport
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] fix warning in scsi_softirq

2005-09-07 Thread Linux Kernel Mailing List
tree 7686ea80865e30f79fe0360540e1eb6cd9ac7485
parent 3a1c1d446b7cac6ddd8f6b1f3254ccffe87f1751
author [EMAIL PROTECTED] [EMAIL PROTECTED] Tue, 09 Aug 2005 14:17:03 -0700
committer James Bottomley [EMAIL PROTECTED](none) Fri, 12 Aug 2005 22:27:44 
-0500

[SCSI] fix warning in scsi_softirq

From: Andrew Morton [EMAIL PROTECTED]

drivers/scsi/scsi.c: In function `scsi_softirq':
drivers/scsi/scsi.c:814: warning: int format, long int arg (arg 4)

Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/scsi.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -811,7 +811,7 @@ static void scsi_softirq(struct softirq_
if (disposition != SUCCESS 
time_before(cmd-jiffies_at_alloc + wait_for, jiffies)) {
dev_printk(KERN_ERR, cmd-device-sdev_gendev, 
-  timing out command, waited %ds\n,
+  timing out command, waited %lus\n,
   wait_for/HZ);
disposition = SUCCESS;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aic79xx: remove some dead code

2005-09-07 Thread Linux Kernel Mailing List
tree b4847d520aa5fdfa9d80dc848407bd7d89d05342
parent d0a7e574007fd547d72ec693bfa35778623d0738
author Christoph Hellwig [EMAIL PROTECTED] Mon, 15 Aug 2005 13:27:39 +0200
committer James Bottomley [EMAIL PROTECTED](none) Mon, 15 Aug 2005 19:18:12 
-0500

[SCSI] aic79xx: remove some dead code

remove some dead cruft, as done already in aic7xxx

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aic7xxx/aic79xx_osm.h |   35 -
 drivers/scsi/aic7xxx/aic79xx_osm_pci.c |3 --
 2 files changed, 38 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h 
b/drivers/scsi/aic7xxx/aic79xx_osm.h
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h
@@ -254,39 +254,8 @@ ahd_scb_timer_reset(struct scb *scb, u_i
 /* SMP support 
/
 #include linux/spinlock.h
 
-#define AHD_SCSI_HAS_HOST_LOCK 1
-
 #define AIC79XX_DRIVER_VERSION 1.3.11
 
-/ Front End Queues 
/
-/*
- * Data structure used to cast the Linux struct scsi_cmnd to something
- * that allows us to use the queue macros.  The linux structure has
- * plenty of space to hold the links fields as required by the queue
- * macros, but the queue macors require them to have the correct type.
- */
-struct ahd_cmd_internal {
-   /* Area owned by the Linux scsi layer. */
-   uint8_t private[offsetof(struct scsi_cmnd, SCp.Status)];
-   union {
-   STAILQ_ENTRY(ahd_cmd)   ste;
-   LIST_ENTRY(ahd_cmd) le;
-   TAILQ_ENTRY(ahd_cmd)tqe;
-   } links;
-   uint32_tend;
-};
-
-struct ahd_cmd {
-   union {
-   struct ahd_cmd_internal icmd;
-   struct scsi_cmndscsi_cmd;
-   } un;
-};
-
-#define acmd_icmd(cmd) ((cmd)-un.icmd)
-#define acmd_scsi_cmd(cmd) ((cmd)-un.scsi_cmd)
-#define acmd_links un.icmd.links
-
 /*** Device Data Structures 
***/
 /*
  * A per probed device structure used to deal with some error recovery
@@ -297,13 +266,10 @@ struct ahd_cmd {
  */
 
 typedef enum {
-   AHD_DEV_UNCONFIGURED = 0x01,
AHD_DEV_FREEZE_TIL_EMPTY = 0x02, /* Freeze queue until active == 0 */
-   AHD_DEV_TIMER_ACTIVE = 0x04, /* Our timer is active */
AHD_DEV_Q_BASIC  = 0x10, /* Allow basic device queuing */
AHD_DEV_Q_TAGGED = 0x20, /* Allow full SCSI2 command queueing */
AHD_DEV_PERIODIC_OTAG= 0x40, /* Send OTAG to prevent starvation */
-   AHD_DEV_SLAVE_CONFIGURED = 0x80  /* slave_configure() has been called */
 } ahd_linux_dev_flags;
 
 struct ahd_linux_target;
@@ -432,7 +398,6 @@ struct ahd_platform_data {
uint32_t irq;   /* IRQ for this adapter */
uint32_t bios_address;
uint32_t mem_busaddr;   /* Mem Base Addr */
-   uint64_t hw_dma_mask;
 #defineAHD_SCB_UP_EH_SEM 0x1
uint32_t flags;
 };
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c 
b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
@@ -177,15 +177,12 @@ ahd_linux_pci_dev_probe(struct pci_dev *
if (memsize = 0x80ULL
  pci_set_dma_mask(pdev, DMA_64BIT_MASK) == 0) {
ahd-flags |= AHD_64BIT_ADDRESSING;
-   ahd-platform_data-hw_dma_mask = DMA_64BIT_MASK;
} else if (memsize  0x8000
 pci_set_dma_mask(pdev, mask_39bit) == 0) {
ahd-flags |= AHD_39BIT_ADDRESSING;
-   ahd-platform_data-hw_dma_mask = mask_39bit;
}
} else {
pci_set_dma_mask(pdev, DMA_32BIT_MASK);
-   ahd-platform_data-hw_dma_mask = DMA_32BIT_MASK;
}
ahd-dev_softc = pci;
error = ahd_pci_config(ahd, entry);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] correct transport class abstraction to work outside SCSI

2005-09-07 Thread Linux Kernel Mailing List
tree 3457bdf4e8eaf870971aab03c99c31534ba85658
parent 10c1b88987d618f4f89c10e11e574c76de73b5e7
author James Bottomley [EMAIL PROTECTED] Mon, 15 Aug 2005 03:09:01 -0500
committer James Bottomley [EMAIL PROTECTED](none) Mon, 15 Aug 2005 03:21:27 
-0500

[SCSI] correct transport class abstraction to work outside SCSI

I recently tried to construct a totally generic transport class and
found there were certain features missing from the current abstract
transport class.  Most notable is that you have to hang the data on the
class_device but most of the API is framed in terms of the generic
device, not the class_device.

These changes are two fold

- Provide the class_device to all of the setup and configure APIs
- Provide and extra API to take the device and the attribute class and
  return the corresponding class_device

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/base/attribute_container.c  |   38 
 drivers/base/transport_class.c  |   17 ++--
 drivers/scsi/scsi_transport_fc.c|6 +++--
 drivers/scsi/scsi_transport_spi.c   |   11 +++---
 include/linux/attribute_container.h |9 ++--
 include/linux/transport_class.h |   11 +++---
 6 files changed, 72 insertions(+), 20 deletions(-)

diff --git a/drivers/base/attribute_container.c 
b/drivers/base/attribute_container.c
--- a/drivers/base/attribute_container.c
+++ b/drivers/base/attribute_container.c
@@ -58,6 +58,7 @@ attribute_container_register(struct attr
 {
INIT_LIST_HEAD(cont-node);
INIT_LIST_HEAD(cont-containers);
+   spin_lock_init(cont-containers_lock);

down(attribute_container_mutex);
list_add_tail(cont-node, attribute_container_list);
@@ -77,11 +78,13 @@ attribute_container_unregister(struct at
 {
int retval = -EBUSY;
down(attribute_container_mutex);
+   spin_lock(cont-containers_lock);
if (!list_empty(cont-containers))
goto out;
retval = 0;
list_del(cont-node);
  out:
+   spin_unlock(cont-containers_lock);
up(attribute_container_mutex);
return retval;

@@ -151,7 +154,9 @@ attribute_container_add_device(struct de
fn(cont, dev, ic-classdev);
else
attribute_container_add_class_device(ic-classdev);
+   spin_lock(cont-containers_lock);
list_add_tail(ic-node, cont-containers);
+   spin_unlock(cont-containers_lock);
}
up(attribute_container_mutex);
 }
@@ -189,6 +194,7 @@ attribute_container_remove_device(struct
 
if (!cont-match(cont, dev))
continue;
+   spin_lock(cont-containers_lock);
list_for_each_entry_safe(ic, tmp, cont-containers, node) {
if (dev != ic-classdev.dev)
continue;
@@ -200,6 +206,7 @@ attribute_container_remove_device(struct
class_device_unregister(ic-classdev);
}
}
+   spin_unlock(cont-containers_lock);
}
up(attribute_container_mutex);
 }
@@ -230,10 +237,12 @@ attribute_container_device_trigger(struc
if (!cont-match(cont, dev))
continue;
 
+   spin_lock(cont-containers_lock);
list_for_each_entry_safe(ic, tmp, cont-containers, node) {
if (dev == ic-classdev.dev)
fn(cont, dev, ic-classdev);
}
+   spin_unlock(cont-containers_lock);
}
up(attribute_container_mutex);
 }
@@ -368,6 +377,35 @@ attribute_container_class_device_del(str
 }
 EXPORT_SYMBOL_GPL(attribute_container_class_device_del);
 
+/**
+ * attribute_container_find_class_device - find the corresponding class_device
+ *
+ * @cont:  the container
+ * @dev:   the generic device
+ *
+ * Looks up the device in the container's list of class devices and returns
+ * the corresponding class_device.
+ */
+struct class_device *
+attribute_container_find_class_device(struct attribute_container *cont,
+ struct device *dev)
+{
+   struct class_device *cdev = NULL;
+   struct internal_container *ic;
+
+   spin_lock(cont-containers_lock);
+   list_for_each_entry(ic, cont-containers, node) {
+   if (ic-classdev.dev == dev) {
+   cdev = ic-classdev;
+   break;
+   }
+   }
+   spin_unlock(cont-containers_lock);
+
+   return cdev;
+}
+EXPORT_SYMBOL_GPL(attribute_container_find_class_device);
+
 int __init
 attribute_container_init(void)
 {
diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c
--- a/drivers/base/transport_class.c
+++ b/drivers/base/transport_class.c
@@ -64,7 +64,9 @@ void 

[SCSI] Add Emulex as maintainer of lpfc SCSI driver

2005-09-07 Thread Linux Kernel Mailing List
tree 419e336ec5ca884cc8b11cebfd5be30262078583
parent 9909b79e3d533b422c6c72945da35aef124dbce1
author [EMAIL PROTECTED] [EMAIL PROTECTED] Thu, 11 Aug 2005 21:42:35 -0400
committer James Bottomley [EMAIL PROTECTED](none) Fri, 12 Aug 2005 22:09:57 
-0500

[SCSI] Add Emulex as maintainer of lpfc SCSI driver

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 MAINTAINERS |7 +++
 1 files changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -824,6 +824,13 @@ L: [EMAIL PROTECTED]
 W: http://sourceforge.net/projects/emu10k1/
 S: Maintained
 
+EMULEX LPFC FC SCSI DRIVER
+P:  James Smart
+M:  [EMAIL PROTECTED]
+L:  linux-scsi@vger.kernel.org
+W:  http://sourceforge.net/projects/lpfc
+S:  Supported
+
 EPSON 1355 FRAMEBUFFER DRIVER
 P: Christopher Hoover
 M: [EMAIL PROTECTED], [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] aic79xx: sane pci probing

2005-09-07 Thread Linux Kernel Mailing List
tree c465c274ffe0e4118ed46ad4e0e09dca975aeb1f
parent d46b1d549e1414d673e0ec18219f4f5e30d5f3f5
author Christoph Hellwig [EMAIL PROTECTED] Mon, 15 Aug 2005 13:28:46 +0200
committer James Bottomley [EMAIL PROTECTED](none) Mon, 15 Aug 2005 19:18:55 
-0500

[SCSI] aic79xx: sane pci probing

remove ahd_tailq and do sane pci probing.  ported over from aic7xxx.

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aic7xxx/aic79xx.h |6 -
 drivers/scsi/aic7xxx/aic79xx_core.c|  103 ---
 drivers/scsi/aic7xxx/aic79xx_osm.c |  108 ++---
 drivers/scsi/aic7xxx/aic79xx_osm.h |   30 -
 drivers/scsi/aic7xxx/aic79xx_osm_pci.c |   79 ++--
 drivers/scsi/aic7xxx/aic79xx_pci.c |   14 
 drivers/scsi/aic7xxx/aic79xx_proc.c|   11 ---
 7 files changed, 60 insertions(+), 291 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
--- a/drivers/scsi/aic7xxx/aic79xx.h
+++ b/drivers/scsi/aic7xxx/aic79xx.h
@@ -1247,9 +1247,6 @@ struct ahd_softc {
uint16_t  user_tagenable;/* Tagged Queuing allowed */
 };
 
-TAILQ_HEAD(ahd_softc_tailq, ahd_softc);
-extern struct ahd_softc_tailq ahd_tailq;
-
 /*** IO Cell Configuration 
/
 #defineAHD_PRECOMP_SLEW_INDEX  
\
 (AHD_ANNEXCOL_PRECOMP_SLEW - AHD_ANNEXCOL_PER_DEV0)
@@ -1374,8 +1371,6 @@ void   ahd_enable_coalescing(struct 
ahd
 voidahd_pause_and_flushwork(struct ahd_softc *ahd);
 int ahd_suspend(struct ahd_softc *ahd); 
 int ahd_resume(struct ahd_softc *ahd);
-voidahd_softc_insert(struct ahd_softc *);
-struct ahd_softc   *ahd_find_softc(struct ahd_softc *ahd);
 voidahd_set_unit(struct ahd_softc *, int);
 voidahd_set_name(struct ahd_softc *, char *);
 struct scb *ahd_get_scb(struct ahd_softc *ahd, u_int col_idx);
@@ -1524,7 +1519,6 @@ void  ahd_print_scb(struct scb *scb);
 void   ahd_print_devinfo(struct ahd_softc *ahd,
  struct ahd_devinfo *devinfo);
 void   ahd_dump_sglist(struct scb *scb);
-void   ahd_dump_all_cards_state(void);
 void   ahd_dump_card_state(struct ahd_softc *ahd);
 intahd_print_register(ahd_reg_parse_entry_t *table,
   u_int num_entries,
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c 
b/drivers/scsi/aic7xxx/aic79xx_core.c
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -52,8 +52,6 @@
 #include dev/aic7xxx/aicasm/aicasm_insformat.h
 #endif
 
-/ Globals 
*/
-struct ahd_softc_tailq ahd_tailq = TAILQ_HEAD_INITIALIZER(ahd_tailq);
 
 /* Lookup Tables 
**/
 char *ahd_chip_names[] =
@@ -5180,74 +5178,6 @@ ahd_softc_init(struct ahd_softc *ahd)
 }
 
 void
-ahd_softc_insert(struct ahd_softc *ahd)
-{
-   struct ahd_softc *list_ahd;
-
-#if AHD_PCI_CONFIG  0
-   /*
-* Second Function PCI devices need to inherit some
-* settings from function 0.
-*/
-   if ((ahd-features  AHD_MULTI_FUNC) != 0) {
-   TAILQ_FOREACH(list_ahd, ahd_tailq, links) {
-   ahd_dev_softc_t list_pci;
-   ahd_dev_softc_t pci;
-
-   list_pci = list_ahd-dev_softc;
-   pci = ahd-dev_softc;
-   if (ahd_get_pci_slot(list_pci) == ahd_get_pci_slot(pci)
- ahd_get_pci_bus(list_pci) == ahd_get_pci_bus(pci)) {
-   struct ahd_softc *master;
-   struct ahd_softc *slave;
-
-   if (ahd_get_pci_function(list_pci) == 0) {
-   master = list_ahd;
-   slave = ahd;
-   } else {
-   master = ahd;
-   slave = list_ahd;
-   }
-   slave-flags = ~AHD_BIOS_ENABLED; 
-   slave-flags |=
-   master-flags  AHD_BIOS_ENABLED;
-   break;
-   }
-   }
-   }
-#endif
-
-   /*
-* Insertion sort into our list of softcs.
-*/
-   list_ahd = TAILQ_FIRST(ahd_tailq);
-   while (list_ahd != NULL
-ahd_softc_comp(ahd, list_ahd) = 0)
-   list_ahd = TAILQ_NEXT(list_ahd, links);
-   if 

[SCSI] aacraid: Fix aacraid probe breakage (updated)

2005-09-07 Thread Linux Kernel Mailing List
tree 204bd462cf3e484173fea17724ed0bfa68fc614c
parent ebd8bb7647e908e8654e565fa289b0300f9f8fa7
author Mark Haverkamp [EMAIL PROTECTED] Tue, 16 Aug 2005 00:50:24 -0700
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:14:07 
-0500

[SCSI] aacraid: Fix aacraid probe breakage (updated)

This patch fixes the bad assumption of the aacraid driver with use_sg.
I used the 3w- driver fix as a guide for this.

Signed-off-by: Mark Haverkamp [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/aacraid/aachba.c |   79 --
 1 files changed, 53 insertions(+), 26 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -349,6 +349,27 @@ static void aac_io_done(struct scsi_cmnd
spin_unlock_irqrestore(host-host_lock, cpu_flags);
 }
 
+static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, 
unsigned int offset, unsigned int len)
+{
+   void *buf;
+   unsigned int transfer_len;
+   struct scatterlist *sg = scsicmd-request_buffer;
+
+   if (scsicmd-use_sg) {
+   buf = kmap_atomic(sg-page, KM_IRQ0) + sg-offset;
+   transfer_len = min(sg-length, len + offset);
+   } else {
+   buf = scsicmd-request_buffer;
+   transfer_len = min(scsicmd-request_bufflen, len + offset);
+   }
+
+   memcpy(buf + offset, data, transfer_len - offset);
+
+   if (scsicmd-use_sg) 
+   kunmap_atomic(buf - sg-offset, KM_IRQ0);
+
+}
+
 static void get_container_name_callback(void *context, struct fib * fibptr)
 {
struct aac_get_name_resp * get_name_reply;
@@ -364,18 +385,22 @@ static void get_container_name_callback(
/* Failure is irrelevant, using default value instead */
if ((le32_to_cpu(get_name_reply-status) == CT_OK)
  (get_name_reply-data[0] != '\0')) {
-   intcount;
-   char * dp;
-   char * sp = get_name_reply-data;
+   char *sp = get_name_reply-data;
sp[sizeof(((struct aac_get_name_resp *)NULL)-data)-1] = '\0';
while (*sp == ' ')
++sp;
-   count = sizeof(((struct inquiry_data *)NULL)-inqd_pid);
-   dp = ((struct inquiry_data *)scsicmd-request_buffer)-inqd_pid;
-   if (*sp) do {
-   *dp++ = (*sp) ? *sp++ : ' ';
-   } while (--count  0);
+   if (*sp) {
+   char d[sizeof(((struct inquiry_data *)NULL)-inqd_pid)];
+   int count = sizeof(d);
+   char *dp = d;
+   do {
+   *dp++ = (*sp) ? *sp++ : ' ';
+   } while (--count  0);
+   aac_internal_transfer(scsicmd, d, 
+ offsetof(struct inquiry_data, inqd_pid), sizeof(d));
+   }
}
+
scsicmd-result = DID_OK  16 | COMMAND_COMPLETE  8 | SAM_STAT_GOOD;
 
fib_complete(fibptr);
@@ -1344,44 +1369,45 @@ int aac_scsi_cmd(struct scsi_cmnd * scsi
switch (scsicmd-cmnd[0]) {
case INQUIRY:
{
-   struct inquiry_data *inq_data_ptr;
+   struct inquiry_data inq_data;
 
dprintk((KERN_DEBUG INQUIRY command, ID: %d.\n, 
scsicmd-device-id));
-   inq_data_ptr = (struct inquiry_data *)scsicmd-request_buffer;
-   memset(inq_data_ptr, 0, sizeof (struct inquiry_data));
+   memset(inq_data, 0, sizeof (struct inquiry_data));
 
-   inq_data_ptr-inqd_ver = 2; /* claim compliance to SCSI-2 */
-   inq_data_ptr-inqd_dtq = 0x80;  /* set RMB bit to one 
indicating that the medium is removable */
-   inq_data_ptr-inqd_rdf = 2; /* A response data format value 
of two indicates that the data shall be in the format specified in SCSI-2 */
-   inq_data_ptr-inqd_len = 31;
+   inq_data.inqd_ver = 2;  /* claim compliance to SCSI-2 */
+   inq_data.inqd_dtq = 0x80;   /* set RMB bit to one 
indicating that the medium is removable */
+   inq_data.inqd_rdf = 2;  /* A response data format value of two 
indicates that the data shall be in the format specified in SCSI-2 */
+   inq_data.inqd_len = 31;
/*Format for pad2 is  RelAdr | WBus32 | WBus16 |  Sync  | 
Linked |Reserved| CmdQue | SftRe */
-   inq_data_ptr-inqd_pad2= 0x32 ;  /*WBus16|Sync|CmdQue */
+   inq_data.inqd_pad2= 0x32 ;   /*WBus16|Sync|CmdQue */
/*
 *  Set the Vendor, Product, and Revision Level
 *  see: vendor.c i.e. aac.c
 */
if (scsicmd-device-id == host-this_id) {
-   setinqstr(cardtype, (void *) 

[SCSI] ibmvscsi eh locking

2005-09-07 Thread Linux Kernel Mailing List
tree 2015cb8448cdfb0350cfd582c660535e4242fed0
parent 3b2946cc96bfafa90a555c70b2e876cbbd0fae98
author Dave C Boutcher [EMAIL PROTECTED] Tue, 16 Aug 2005 02:52:58 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:14:08 
-0500

[SCSI] ibmvscsi eh locking

With the removal of the spinlocking around eh calls, we need to add a
little more locking back in, otherwise we do some naked list
manipulation.

Signed-off-by: Dave Boutcher [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/ibmvscsi/ibmvscsi.c |   23 ---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -826,11 +826,13 @@ static int ibmvscsi_eh_abort_handler(str
struct srp_event_struct *tmp_evt, *found_evt;
union viosrp_iu srp_rsp;
int rsp_rc;
+   unsigned long flags;
u16 lun = lun_from_dev(cmd-device);
 
/* First, find this command in our sent list so we can figure
 * out the correct tag
 */
+   spin_lock_irqsave(hostdata-host-host_lock, flags);
found_evt = NULL;
list_for_each_entry(tmp_evt, hostdata-sent, list) {
if (tmp_evt-cmnd == cmd) {
@@ -839,11 +841,14 @@ static int ibmvscsi_eh_abort_handler(str
}
}
 
-   if (!found_evt) 
+   if (!found_evt) {
+   spin_unlock_irqrestore(hostdata-host-host_lock, flags);
return FAILED;
+   }
 
evt = get_event_struct(hostdata-pool);
if (evt == NULL) {
+   spin_unlock_irqrestore(hostdata-host-host_lock, flags);
printk(KERN_ERR ibmvscsi: failed to allocate abort event\n);
return FAILED;
}
@@ -867,7 +872,9 @@ static int ibmvscsi_eh_abort_handler(str
 
evt-sync_srp = srp_rsp;
init_completion(evt-comp);
-   if (ibmvscsi_send_srp_event(evt, hostdata) != 0) {
+   rsp_rc = ibmvscsi_send_srp_event(evt, hostdata);
+   spin_unlock_irqrestore(hostdata-host-host_lock, flags);
+   if (rsp_rc != 0) {
printk(KERN_ERR ibmvscsi: failed to send abort() event\n);
return FAILED;
}
@@ -901,6 +908,7 @@ static int ibmvscsi_eh_abort_handler(str
 * The event is no longer in our list.  Make sure it didn't
 * complete while we were aborting
 */
+   spin_lock_irqsave(hostdata-host-host_lock, flags);
found_evt = NULL;
list_for_each_entry(tmp_evt, hostdata-sent, list) {
if (tmp_evt-cmnd == cmd) {
@@ -910,6 +918,7 @@ static int ibmvscsi_eh_abort_handler(str
}
 
if (found_evt == NULL) {
+   spin_unlock_irqrestore(hostdata-host-host_lock, flags);
printk(KERN_INFO
   ibmvscsi: aborted task tag 0x%lx completed\n,
   tsk_mgmt-managed_task_tag);
@@ -924,6 +933,7 @@ static int ibmvscsi_eh_abort_handler(str
list_del(found_evt-list);
unmap_cmd_data(found_evt-iu.srp.cmd, found_evt-hostdata-dev);
free_event_struct(found_evt-hostdata-pool, found_evt);
+   spin_unlock_irqrestore(hostdata-host-host_lock, flags);
atomic_inc(hostdata-request_limit);
return SUCCESS;
 }
@@ -943,10 +953,13 @@ static int ibmvscsi_eh_device_reset_hand
struct srp_event_struct *tmp_evt, *pos;
union viosrp_iu srp_rsp;
int rsp_rc;
+   unsigned long flags;
u16 lun = lun_from_dev(cmd-device);
 
+   spin_lock_irqsave(hostdata-host-host_lock, flags);
evt = get_event_struct(hostdata-pool);
if (evt == NULL) {
+   spin_unlock_irqrestore(hostdata-host-host_lock, flags);
printk(KERN_ERR ibmvscsi: failed to allocate reset event\n);
return FAILED;
}
@@ -969,7 +982,9 @@ static int ibmvscsi_eh_device_reset_hand
 
evt-sync_srp = srp_rsp;
init_completion(evt-comp);
-   if (ibmvscsi_send_srp_event(evt, hostdata) != 0) {
+   rsp_rc = ibmvscsi_send_srp_event(evt, hostdata);
+   spin_unlock_irqrestore(hostdata-host-host_lock, flags);
+   if (rsp_rc != 0) {
printk(KERN_ERR ibmvscsi: failed to send reset event\n);
return FAILED;
}
@@ -1002,6 +1017,7 @@ static int ibmvscsi_eh_device_reset_hand
/* We need to find all commands for this LUN that have not yet been
 * responded to, and fail them with DID_RESET
 */
+   spin_lock_irqsave(hostdata-host-host_lock, flags);
list_for_each_entry_safe(tmp_evt, pos, hostdata-sent, list) {
if ((tmp_evt-cmnd)  (tmp_evt-cmnd-device == cmd-device)) {
if (tmp_evt-cmnd)
@@ -1017,6 +1033,7 @@ static int ibmvscsi_eh_device_reset_hand
tmp_evt-done(tmp_evt);
}
}
+  

[SCSI] add missing attribute container function prototype

2005-09-07 Thread Linux Kernel Mailing List
tree 69ec4dfa0927096cca15167c04150637fad66de6
parent be042f240a8528b8f6b741a484cdbbf515698388
author James Bottomley [EMAIL PROTECTED] Wed, 17 Aug 2005 03:26:10 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:14:09 
-0500

[SCSI] add missing attribute container function prototype

attribute_container_classdev_to_container is an exported function of the
attribute_container.c file.  However, there's no prototype for it.  Now
I actually want to use it, so add one.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 include/linux/attribute_container.h |1 +
 1 files changed, 1 insertion(+)

diff --git a/include/linux/attribute_container.h 
b/include/linux/attribute_container.h
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -64,6 +64,7 @@ int attribute_container_add_class_device
 struct class_device *classdev);
 void attribute_container_remove_attrs(struct class_device *classdev);
 void attribute_container_class_device_del(struct class_device *classdev);
+struct attribute_container *attribute_container_classdev_to_container(struct 
class_device *);
 struct class_device *attribute_container_find_class_device(struct 
attribute_container *, struct device *);
 struct class_device_attribute **attribute_container_classdev_to_attrs(const 
struct class_device *classdev);
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] drivers/scsi/constants.c should include scsi_dbg.h

2005-09-07 Thread Linux Kernel Mailing List
tree 9c4c2bfea134ad9a457b391bf389106f44a71449
parent caca1779870b1bcc0fb07e48ebd2403901f356b8
author Adrian Bunk [EMAIL PROTECTED] Sat, 20 Aug 2005 21:27:27 +0200
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:14:10 
-0500

[SCSI] drivers/scsi/constants.c should include scsi_dbg.h

C files should include the files with the prototypes for their global
functions.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/constants.c |1 +
 1 files changed, 1 insertion(+)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -17,6 +17,7 @@
 #include scsi/scsi_host.h
 #include scsi/scsi_request.h
 #include scsi/scsi_eh.h
+#include scsi/scsi_dbg.h
 
 
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Add blk_rq_map_kern()

2005-09-07 Thread Linux Kernel Mailing List
tree 30ab71759486f94d60af2283fc55bfffcc22155a
parent 8b22c249e7de453961e4d253b19fc2a0bdd65d53
author Mike Christie [EMAIL PROTECTED] Mon, 20 Jun 2005 14:04:44 +0200
committer Jens Axboe [EMAIL PROTECTED] Mon, 20 Jun 2005 14:04:44 +0200

[PATCH] Add blk_rq_map_kern()

Add blk_rq_map_kern which takes a kernel buffer and maps it into
a request and bio. This can be used by the dm hw_handlers, old
sg_scsi_ioctl, and one day scsi special requests so all requests
comming into scsi will have bios. All requests having bios
should allow scsi to use scatter lists for all IO and allow it
to use block layer functions.

Signed-off-by: Jens Axboe [EMAIL PROTECTED]

 drivers/block/ll_rw_blk.c |   56 +++
 fs/bio.c  |   66 ++
 include/linux/bio.h   |2 +
 include/linux/blkdev.h|2 +
 4 files changed, 126 insertions(+)

diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -281,6 +281,7 @@ static inline void rq_init(request_queue
rq-special = NULL;
rq-data_len = 0;
rq-data = NULL;
+   rq-nr_phys_segments = 0;
rq-sense = NULL;
rq-end_io = NULL;
rq-end_io_data = NULL;
@@ -2176,6 +2177,61 @@ int blk_rq_unmap_user(struct request *rq
 
 EXPORT_SYMBOL(blk_rq_unmap_user);
 
+static int blk_rq_map_kern_endio(struct bio *bio, unsigned int bytes_done,
+int error)
+{
+   if (bio-bi_size)
+   return 1;
+
+   bio_put(bio);
+   return 0;
+}
+
+/**
+ * blk_rq_map_kern - map kernel data to a request, for REQ_BLOCK_PC usage
+ * @q: request queue where request should be inserted
+ * @rw:READ or WRITE data
+ * @kbuf:  the kernel buffer
+ * @len:   length of user data
+ */
+struct request *blk_rq_map_kern(request_queue_t *q, int rw, void *kbuf,
+   unsigned int len, unsigned int gfp_mask)
+{
+   struct request *rq;
+   struct bio *bio;
+
+   if (len  (q-max_sectors  9))
+   return ERR_PTR(-EINVAL);
+   if ((!len  kbuf) || (len  !kbuf))
+   return ERR_PTR(-EINVAL);
+
+   rq = blk_get_request(q, rw, gfp_mask);
+   if (!rq)
+   return ERR_PTR(-ENOMEM);
+
+   bio = bio_map_kern(q, kbuf, len, gfp_mask);
+   if (!IS_ERR(bio)) {
+   if (rw)
+   bio-bi_rw |= (1  BIO_RW);
+   bio-bi_end_io = blk_rq_map_kern_endio;
+
+   rq-bio = rq-biotail = bio;
+   blk_rq_bio_prep(q, rq, bio);
+
+   rq-buffer = rq-data = NULL;
+   rq-data_len = len;
+   return rq;
+   }
+
+   /*
+* bio is the err-ptr
+*/
+   blk_put_request(rq);
+   return (struct request *) bio;
+}
+
+EXPORT_SYMBOL(blk_rq_map_kern);
+
 /**
  * blk_execute_rq - insert a request into queue for execution
  * @q: queue to insert the request in
diff --git a/fs/bio.c b/fs/bio.c
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -701,6 +701,71 @@ void bio_unmap_user(struct bio *bio)
bio_put(bio);
 }
 
+static struct bio *__bio_map_kern(request_queue_t *q, void *data,
+ unsigned int len, unsigned int gfp_mask)
+{
+   unsigned long kaddr = (unsigned long)data;
+   unsigned long end = (kaddr + len + PAGE_SIZE - 1)  PAGE_SHIFT;
+   unsigned long start = kaddr  PAGE_SHIFT;
+   const int nr_pages = end - start;
+   int offset, i;
+   struct bio *bio;
+
+   bio = bio_alloc(gfp_mask, nr_pages);
+   if (!bio)
+   return ERR_PTR(-ENOMEM);
+
+   offset = offset_in_page(kaddr);
+   for (i = 0; i  nr_pages; i++) {
+   unsigned int bytes = PAGE_SIZE - offset;
+
+   if (len = 0)
+   break;
+
+   if (bytes  len)
+   bytes = len;
+
+   if (__bio_add_page(q, bio, virt_to_page(data), bytes,
+  offset)  bytes)
+   break;
+
+   data += bytes;
+   len -= bytes;
+   offset = 0;
+   }
+
+   return bio;
+}
+
+/**
+ * bio_map_kern-   map kernel address into bio
+ * @q: the request_queue_t for the bio
+ * @data: pointer to buffer to map
+ * @len: length in bytes
+ * @gfp_mask: allocation flags for bio allocation
+ *
+ * Map the kernel address into a bio suitable for io to a block
+ * device. Returns an error pointer in case of error.
+ */
+struct bio *bio_map_kern(request_queue_t *q, void *data, unsigned int len,
+unsigned int gfp_mask)
+{
+   struct bio *bio;
+
+   bio = __bio_map_kern(q, data, len, gfp_mask);
+   if (IS_ERR(bio))
+   return bio;
+
+   if (bio-bi_size == len)
+   return bio;
+
+   /*
+* Don't 

[PATCH] Keep the bio end_io parts inside of bio.c for blk_rq_map_kern()

2005-09-07 Thread Linux Kernel Mailing List
tree f825aa09e088c160d50f2b9e878a287ebf2cb304
parent df46b9a44ceb5af2ea2351ce8e28ae7bd840b00f
author Jens Axboe [EMAIL PROTECTED] Mon, 20 Jun 2005 14:05:27 +0200
committer Jens Axboe [EMAIL PROTECTED] Mon, 20 Jun 2005 14:05:27 +0200

[PATCH] Keep the bio end_io parts inside of bio.c for blk_rq_map_kern()

Signed-off-by: Jens Axboe [EMAIL PROTECTED]

 drivers/block/ll_rw_blk.c |   11 ---
 fs/bio.c  |   11 +++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -2177,16 +2177,6 @@ int blk_rq_unmap_user(struct request *rq
 
 EXPORT_SYMBOL(blk_rq_unmap_user);
 
-static int blk_rq_map_kern_endio(struct bio *bio, unsigned int bytes_done,
-int error)
-{
-   if (bio-bi_size)
-   return 1;
-
-   bio_put(bio);
-   return 0;
-}
-
 /**
  * blk_rq_map_kern - map kernel data to a request, for REQ_BLOCK_PC usage
  * @q: request queue where request should be inserted
@@ -2213,7 +2203,6 @@ struct request *blk_rq_map_kern(request_
if (!IS_ERR(bio)) {
if (rw)
bio-bi_rw |= (1  BIO_RW);
-   bio-bi_end_io = blk_rq_map_kern_endio;
 
rq-bio = rq-biotail = bio;
blk_rq_bio_prep(q, rq, bio);
diff --git a/fs/bio.c b/fs/bio.c
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -701,6 +701,16 @@ void bio_unmap_user(struct bio *bio)
bio_put(bio);
 }
 
+static int bio_map_kern_endio(struct bio *bio, unsigned int bytes_done, int 
err)
+{
+   if (bio-bi_size)
+   return 1;
+
+   bio_put(bio);
+   return 0;
+}
+
+
 static struct bio *__bio_map_kern(request_queue_t *q, void *data,
  unsigned int len, unsigned int gfp_mask)
 {
@@ -734,6 +744,7 @@ static struct bio *__bio_map_kern(reques
offset = 0;
}
 
+   bio-bi_end_io = bio_map_kern_endio;
return bio;
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Cleanup blk_rq_map_* interfaces

2005-09-07 Thread Linux Kernel Mailing List
tree ddf12e2fad7c0df0656a10ee6aac3f12a04dbed8
parent b823825e8e09aac6dc1ca362cd5639a87329d636
author Jens Axboe [EMAIL PROTECTED] Mon, 20 Jun 2005 14:06:01 +0200
committer Jens Axboe [EMAIL PROTECTED] Mon, 20 Jun 2005 14:06:01 +0200

[PATCH] Cleanup blk_rq_map_* interfaces

Change the blk_rq_map_user() and blk_rq_map_kern() interface to require
a previously allocated request to be passed in. This is both more efficient
for multiple iterations of mapping data to the same request, and it is also
a much nicer API.

Signed-off-by: Jens Axboe [EMAIL PROTECTED]

 drivers/block/ll_rw_blk.c  |   70 ++---
 drivers/block/scsi_ioctl.c |   25 +---
 drivers/cdrom/cdrom.c  |   13 +---
 include/linux/blkdev.h |7 +---
 4 files changed, 55 insertions(+), 60 deletions(-)

diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -2107,21 +2107,19 @@ EXPORT_SYMBOL(blk_insert_request);
  *original bio must be passed back in to blk_rq_unmap_user() for proper
  *unmapping.
  */
-struct request *blk_rq_map_user(request_queue_t *q, int rw, void __user *ubuf,
-   unsigned int len)
+int blk_rq_map_user(request_queue_t *q, struct request *rq, void __user *ubuf,
+   unsigned int len)
 {
unsigned long uaddr;
-   struct request *rq;
struct bio *bio;
+   int reading;
 
if (len  (q-max_sectors  9))
-   return ERR_PTR(-EINVAL);
-   if ((!len  ubuf) || (len  !ubuf))
-   return ERR_PTR(-EINVAL);
-
-   rq = blk_get_request(q, rw, __GFP_WAIT);
-   if (!rq)
-   return ERR_PTR(-ENOMEM);
+   return -EINVAL;
+   if (!len || !ubuf)
+   return -EINVAL;
+
+   reading = rq_data_dir(rq) == READ;
 
/*
 * if alignment requirement is satisfied, map in user pages for
@@ -2129,9 +2127,9 @@ struct request *blk_rq_map_user(request_
 */
uaddr = (unsigned long) ubuf;
if (!(uaddr  queue_dma_alignment(q))  !(len  
queue_dma_alignment(q)))
-   bio = bio_map_user(q, NULL, uaddr, len, rw == READ);
+   bio = bio_map_user(q, NULL, uaddr, len, reading);
else
-   bio = bio_copy_user(q, uaddr, len, rw == READ);
+   bio = bio_copy_user(q, uaddr, len, reading);
 
if (!IS_ERR(bio)) {
rq-bio = rq-biotail = bio;
@@ -2139,14 +2137,13 @@ struct request *blk_rq_map_user(request_
 
rq-buffer = rq-data = NULL;
rq-data_len = len;
-   return rq;
+   return 0;
}
 
/*
 * bio is the err-ptr
 */
-   blk_put_request(rq);
-   return (struct request *) bio;
+   return PTR_ERR(bio);
 }
 
 EXPORT_SYMBOL(blk_rq_map_user);
@@ -2160,7 +2157,7 @@ EXPORT_SYMBOL(blk_rq_map_user);
  * Description:
  *Unmap a request previously mapped by blk_rq_map_user().
  */
-int blk_rq_unmap_user(struct request *rq, struct bio *bio, unsigned int ulen)
+int blk_rq_unmap_user(struct bio *bio, unsigned int ulen)
 {
int ret = 0;
 
@@ -2171,8 +2168,7 @@ int blk_rq_unmap_user(struct request *rq
ret = bio_uncopy_user(bio);
}
 
-   blk_put_request(rq);
-   return ret;
+   return 0;
 }
 
 EXPORT_SYMBOL(blk_rq_unmap_user);
@@ -2184,39 +2180,29 @@ EXPORT_SYMBOL(blk_rq_unmap_user);
  * @kbuf:  the kernel buffer
  * @len:   length of user data
  */
-struct request *blk_rq_map_kern(request_queue_t *q, int rw, void *kbuf,
-   unsigned int len, unsigned int gfp_mask)
+int blk_rq_map_kern(request_queue_t *q, struct request *rq, void *kbuf,
+   unsigned int len, unsigned int gfp_mask)
 {
-   struct request *rq;
struct bio *bio;
 
if (len  (q-max_sectors  9))
-   return ERR_PTR(-EINVAL);
-   if ((!len  kbuf) || (len  !kbuf))
-   return ERR_PTR(-EINVAL);
-
-   rq = blk_get_request(q, rw, gfp_mask);
-   if (!rq)
-   return ERR_PTR(-ENOMEM);
+   return -EINVAL;
+   if (!len || !kbuf)
+   return -EINVAL;
 
bio = bio_map_kern(q, kbuf, len, gfp_mask);
-   if (!IS_ERR(bio)) {
-   if (rw)
-   bio-bi_rw |= (1  BIO_RW);
+   if (IS_ERR(bio))
+   return PTR_ERR(bio);
 
-   rq-bio = rq-biotail = bio;
-   blk_rq_bio_prep(q, rq, bio);
+   if (rq_data_dir(rq) == WRITE)
+   bio-bi_rw |= (1  BIO_RW);
 
-   rq-buffer = rq-data = NULL;
-   rq-data_len = len;
-   return rq;
-   }
+   rq-bio = rq-biotail = bio;
+   blk_rq_bio_prep(q, rq, bio);
 
-   /*
-* bio is the err-ptr
-*/
-   blk_put_request(rq);
-   return (struct request *) bio;
+   rq-buffer = 

[PATCH] Add scatter-gather support for the block layer SG_IO

2005-09-07 Thread Linux Kernel Mailing List
tree 559898cdf83bd0f93b8a72248c6423a6548fb604
parent dd1cab95f356f1395278633565f198463cf6bd24
author James Bottomley [EMAIL PROTECTED] Mon, 20 Jun 2005 14:06:52 +0200
committer Jens Axboe [EMAIL PROTECTED] Mon, 20 Jun 2005 14:06:52 +0200

[PATCH] Add scatter-gather support for the block layer SG_IO

Signed-off-by: Jens Axboe [EMAIL PROTECTED]

 drivers/block/ll_rw_blk.c  |   64 +--
 drivers/block/scsi_ioctl.c |   34 +++---
 fs/bio.c   |  146 +++--
 include/linux/bio.h|4 +
 include/linux/blkdev.h |1 
 5 files changed, 189 insertions(+), 60 deletions(-)

diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -2149,6 +2149,50 @@ int blk_rq_map_user(request_queue_t *q, 
 EXPORT_SYMBOL(blk_rq_map_user);
 
 /**
+ * blk_rq_map_user_iov - map user data to a request, for REQ_BLOCK_PC usage
+ * @q: request queue where request should be inserted
+ * @rq:request to map data to
+ * @iov:   pointer to the iovec
+ * @iov_count: number of elements in the iovec
+ *
+ * Description:
+ *Data will be mapped directly for zero copy io, if possible. Otherwise
+ *a kernel bounce buffer is used.
+ *
+ *A matching blk_rq_unmap_user() must be issued at the end of io, while
+ *still in process context.
+ *
+ *Note: The mapped bio may need to be bounced through blk_queue_bounce()
+ *before being submitted to the device, as pages mapped may be out of
+ *reach. It's the callers responsibility to make sure this happens. The
+ *original bio must be passed back in to blk_rq_unmap_user() for proper
+ *unmapping.
+ */
+int blk_rq_map_user_iov(request_queue_t *q, struct request *rq,
+   struct sg_iovec *iov, int iov_count)
+{
+   struct bio *bio;
+
+   if (!iov || iov_count = 0)
+   return -EINVAL;
+
+   /* we don't allow misaligned data like bio_map_user() does.  If the
+* user is using sg, they're expected to know the alignment constraints
+* and respect them accordingly */
+   bio = bio_map_user_iov(q, NULL, iov, iov_count, rq_data_dir(rq)== READ);
+   if (IS_ERR(bio))
+   return PTR_ERR(bio);
+
+   rq-bio = rq-biotail = bio;
+   blk_rq_bio_prep(q, rq, bio);
+   rq-buffer = rq-data = NULL;
+   rq-data_len = bio-bi_size;
+   return 0;
+}
+
+EXPORT_SYMBOL(blk_rq_map_user_iov);
+
+/**
  * blk_rq_unmap_user - unmap a request with user data
  * @rq:request to be unmapped
  * @bio:   bio for the request
@@ -2207,6 +2251,19 @@ int blk_rq_map_kern(request_queue_t *q, 
 
 EXPORT_SYMBOL(blk_rq_map_kern);
 
+void blk_execute_rq_nowait(request_queue_t *q, struct gendisk *bd_disk,
+  struct request *rq, int at_head,
+  void (*done)(struct request *))
+{
+   int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK;
+
+   rq-rq_disk = bd_disk;
+   rq-flags |= REQ_NOMERGE;
+   rq-end_io = done;
+   elv_add_request(q, rq, where, 1);
+   generic_unplug_device(q);
+}
+
 /**
  * blk_execute_rq - insert a request into queue for execution
  * @q: queue to insert the request in
@@ -2224,8 +2281,6 @@ int blk_execute_rq(request_queue_t *q, s
char sense[SCSI_SENSE_BUFFERSIZE];
int err = 0;
 
-   rq-rq_disk = bd_disk;
-
/*
 * we need an extra reference to the request, so we can look at
 * it after io completion
@@ -2238,11 +2293,8 @@ int blk_execute_rq(request_queue_t *q, s
rq-sense_len = 0;
}
 
-   rq-flags |= REQ_NOMERGE;
rq-waiting = wait;
-   rq-end_io = blk_end_sync_rq;
-   elv_add_request(q, rq, ELEVATOR_INSERT_BACK, 1);
-   generic_unplug_device(q);
+   blk_execute_rq_nowait(q, bd_disk, rq, 0, blk_end_sync_rq);
wait_for_completion(wait);
rq-waiting = NULL;
 
diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
--- a/drivers/block/scsi_ioctl.c
+++ b/drivers/block/scsi_ioctl.c
@@ -231,17 +231,11 @@ static int sg_io(struct file *file, requ
if (verify_command(file, cmd))
return -EPERM;
 
-   /*
-* we'll do that later
-*/
-   if (hdr-iovec_count)
-   return -EOPNOTSUPP;
-
if (hdr-dxfer_len  (q-max_sectors  9))
return -EIO;
 
reading = writing = 0;
-   if (hdr-dxfer_len) {
+   if (hdr-dxfer_len)
switch (hdr-dxfer_direction) {
default:
return -EINVAL;
@@ -261,11 +255,29 @@ static int sg_io(struct file *file, requ
if (!rq)
return -ENOMEM;
 
-   if (reading || writing) {
-   ret = blk_rq_map_user(q, rq, hdr-dxferp, hdr-dxfer_len);
-   if (ret)
+   if (hdr-iovec_count) {
+   const 

[PATCH] The blk_rq_map_user() change missed an update in scsi_ioctl.c

2005-09-07 Thread Linux Kernel Mailing List
tree bca12f46d6ea3039896406081826d7db37b0384e
parent f1970baf6d74e03bd32072ab453f2fc01bc1b8d3
author James Bottomley [EMAIL PROTECTED] Mon, 20 Jun 2005 14:07:17 +0200
committer Jens Axboe [EMAIL PROTECTED] Mon, 20 Jun 2005 14:07:17 +0200

[PATCH] The blk_rq_map_user() change missed an update in scsi_ioctl.c

Signed-off-by: Jens Axboe [EMAIL PROTECTED]

 drivers/block/scsi_ioctl.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
--- a/drivers/block/scsi_ioctl.c
+++ b/drivers/block/scsi_ioctl.c
@@ -216,7 +216,7 @@ static int sg_io(struct file *file, requ
struct gendisk *bd_disk, struct sg_io_hdr *hdr)
 {
unsigned long start_time;
-   int reading, writing, ret;
+   int reading, writing, ret = 0;
struct request *rq;
struct bio *bio;
char sense[SCSI_SENSE_BUFFERSIZE];
@@ -249,7 +249,6 @@ static int sg_io(struct file *file, requ
reading = 1;
break;
}
-   }
 
rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL);
if (!rq)
@@ -335,7 +334,7 @@ static int sg_io(struct file *file, requ
hdr-sb_len_wr = len;
}
 
-   if (blk_rq_unmap_user(rq, bio, hdr-dxfer_len))
+   if (blk_rq_unmap_user(bio, hdr-dxfer_len))
ret = -EFAULT;
 
/* may not have succeeded, but output values written to control
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] update blk_execute_rq to take an at_head parameter

2005-09-07 Thread Linux Kernel Mailing List
tree 0998252ed375929dca468440b7486d4c1104757f
parent f63eb21b4f32028755b6b9d47e5eb13c18ba0cae
author James Bottomley [EMAIL PROTECTED] Mon, 20 Jun 2005 14:11:09 +0200
committer Jens Axboe [EMAIL PROTECTED] Mon, 20 Jun 2005 14:11:09 +0200

[PATCH] update blk_execute_rq to take an at_head parameter

Original From: Mike Christie [EMAIL PROTECTED]

Modified to split out block changes (this patch) and SCSI pieces.

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/block/ll_rw_blk.c  |7 ---
 drivers/block/scsi_ioctl.c |6 +++---
 drivers/cdrom/cdrom.c  |2 +-
 drivers/ide/ide-disk.c |2 +-
 include/linux/blkdev.h |4 ++--
 5 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -2269,13 +2269,14 @@ void blk_execute_rq_nowait(request_queue
  * @q: queue to insert the request in
  * @bd_disk:   matching gendisk
  * @rq:request to insert
+ * @at_head:insert request at head or tail of queue
  *
  * Description:
  *Insert a fully prepared request at the back of the io scheduler queue
  *for execution.
  */
 int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk,
-  struct request *rq)
+  struct request *rq, int at_head)
 {
DECLARE_COMPLETION(wait);
char sense[SCSI_SENSE_BUFFERSIZE];
@@ -2294,7 +2295,7 @@ int blk_execute_rq(request_queue_t *q, s
}
 
rq-waiting = wait;
-   blk_execute_rq_nowait(q, bd_disk, rq, 0, blk_end_sync_rq);
+   blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq);
wait_for_completion(wait);
rq-waiting = NULL;
 
@@ -2361,7 +2362,7 @@ int blkdev_scsi_issue_flush_fn(request_q
rq-data_len = 0;
rq-timeout = 60 * HZ;
 
-   ret = blk_execute_rq(q, disk, rq);
+   ret = blk_execute_rq(q, disk, rq, 0);
 
if (ret  error_sector)
*error_sector = rq-sector;
diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
--- a/drivers/block/scsi_ioctl.c
+++ b/drivers/block/scsi_ioctl.c
@@ -308,7 +308,7 @@ static int sg_io(struct file *file, requ
 * (if he doesn't check that is his problem).
 * N.B. a non-zero SCSI status is _not_ necessarily an error.
 */
-   blk_execute_rq(q, bd_disk, rq);
+   blk_execute_rq(q, bd_disk, rq, 0);
 
/* write to all output members */
hdr-status = 0xff  rq-errors;
@@ -420,7 +420,7 @@ static int sg_scsi_ioctl(struct file *fi
rq-data_len = bytes;
rq-flags |= REQ_BLOCK_PC;
 
-   blk_execute_rq(q, bd_disk, rq);
+   blk_execute_rq(q, bd_disk, rq, 0);
err = rq-errors  0xff;/* only 8 bit SCSI status */
if (err) {
if (rq-sense_len  rq-sense) {
@@ -573,7 +573,7 @@ int scsi_cmd_ioctl(struct file *file, st
rq-cmd[0] = GPCMD_START_STOP_UNIT;
rq-cmd[4] = 0x02 + (close != 0);
rq-cmd_len = 6;
-   err = blk_execute_rq(q, bd_disk, rq);
+   err = blk_execute_rq(q, bd_disk, rq, 0);
blk_put_request(rq);
break;
default:
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2136,7 +2136,7 @@ static int cdrom_read_cdda_bpc(struct cd
if (rq-bio)
blk_queue_bounce(q, rq-bio);
 
-   if (blk_execute_rq(q, cdi-disk, rq)) {
+   if (blk_execute_rq(q, cdi-disk, rq, 0)) {
struct request_sense *s = rq-sense;
ret = -EIO;
cdi-last_sense = s-sense_key;
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -750,7 +750,7 @@ static int idedisk_issue_flush(request_q
 
idedisk_prepare_flush(q, rq);
 
-   ret = blk_execute_rq(q, disk, rq);
+   ret = blk_execute_rq(q, disk, rq, 0);
 
/*
 * if we failed and caller wants error offset, get it
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -562,8 +562,8 @@ extern int blk_rq_map_user(request_queue
 extern int blk_rq_unmap_user(struct bio *, unsigned int);
 extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, 
unsigned int, unsigned int);
 extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct 
sg_iovec *, int);
-extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request 
*);
-
+extern int blk_execute_rq(request_queue_t *, struct gendisk *,
+ struct request *, int);
 static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
 {
   

[PATCH] ll_rw_blk.c kerneldoc updates

2005-09-07 Thread Linux Kernel Mailing List
tree d7cae2a3da1e15dc8c87b0ffbf2608eb8c999cc9
parent 994ca9a19616f0d4161a9e825f0835925d522426
author Christoph Hellwig [EMAIL PROTECTED] Mon, 20 Jun 2005 14:21:01 +0200
committer Jens Axboe [EMAIL PROTECTED] Mon, 20 Jun 2005 14:21:01 +0200

[PATCH] ll_rw_blk.c kerneldoc updates

The recent mapping changes didn't update the kerneldoc appropriately.

Original from Christoph Hellwig [EMAIL PROTECTED]

Signed-off-by: Jens Axboe [EMAIL PROTECTED]

 drivers/block/ll_rw_blk.c |   24 ++--
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -2090,7 +2090,7 @@ EXPORT_SYMBOL(blk_insert_request);
 /**
  * blk_rq_map_user - map user data to a request, for REQ_BLOCK_PC usage
  * @q: request queue where request should be inserted
- * @rw:READ or WRITE data
+ * @rq:request structure to fill
  * @ubuf:  the user buffer
  * @len:   length of user data
  *
@@ -2194,12 +2194,11 @@ EXPORT_SYMBOL(blk_rq_map_user_iov);
 
 /**
  * blk_rq_unmap_user - unmap a request with user data
- * @rq:request to be unmapped
- * @bio:   bio for the request
+ * @bio:   bio to be unmapped
  * @ulen:  length of user buffer
  *
  * Description:
- *Unmap a request previously mapped by blk_rq_map_user().
+ *Unmap a bio previously mapped by blk_rq_map_user().
  */
 int blk_rq_unmap_user(struct bio *bio, unsigned int ulen)
 {
@@ -2220,9 +2219,10 @@ EXPORT_SYMBOL(blk_rq_unmap_user);
 /**
  * blk_rq_map_kern - map kernel data to a request, for REQ_BLOCK_PC usage
  * @q: request queue where request should be inserted
- * @rw:READ or WRITE data
+ * @rq:request to fill
  * @kbuf:  the kernel buffer
  * @len:   length of user data
+ * @gfp_mask:  memory allocation flags
  */
 int blk_rq_map_kern(request_queue_t *q, struct request *rq, void *kbuf,
unsigned int len, unsigned int gfp_mask)
@@ -2251,6 +2251,18 @@ int blk_rq_map_kern(request_queue_t *q, 
 
 EXPORT_SYMBOL(blk_rq_map_kern);
 
+/**
+ * blk_execute_rq_nowait - insert a request into queue for execution
+ * @q: queue to insert the request in
+ * @bd_disk:   matching gendisk
+ * @rq:request to insert
+ * @at_head:insert request at head or tail of queue
+ * @done:  I/O completion handler
+ *
+ * Description:
+ *Insert a fully prepared request at the back of the io scheduler queue
+ *for execution.  Don't wait for completion.
+ */
 void blk_execute_rq_nowait(request_queue_t *q, struct gendisk *bd_disk,
   struct request *rq, int at_head,
   void (*done)(struct request *))
@@ -2273,7 +2285,7 @@ void blk_execute_rq_nowait(request_queue
  *
  * Description:
  *Insert a fully prepared request at the back of the io scheduler queue
- *for execution.
+ *for execution and wait for completion.
  */
 int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk,
   struct request *rq, int at_head)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] use scatter lists for all block pc requests and simplify hw handlers

2005-09-07 Thread Linux Kernel Mailing List
tree 5c3a30bec263cb62538f08834db5e1cfec64c265
parent 31151ba2cef171344beac254e65bd7e00138bb0d
author James Bottomley [EMAIL PROTECTED] Sun, 05 Jun 2005 12:07:14 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 20:45:34 
-0500

[SCSI] use scatter lists for all block pc requests and simplify hw handlers

Here's the proof of concept for this one.  It converts scsi_wait_req to
do correct REQ_BLOCK_PC submission (and works nicely in my setup).

The final goal should be to eliminate struct scsi_request, but that
can't be done until the character submission paths of sg and st are also
modified.

There's some loss of functionality to this: retries are no longer
controllable (except by setting REQ_FASTFAIL) and the wait_req API needs
to be altered, but it looks very nice.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/scsi_lib.c |   96 +---
 1 files changed, 59 insertions(+), 37 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -232,23 +232,6 @@ void scsi_do_req(struct scsi_request *sr
 }
 EXPORT_SYMBOL(scsi_do_req);
 
-static void scsi_wait_done(struct scsi_cmnd *cmd)
-{
-   struct request *req = cmd-request;
-   struct request_queue *q = cmd-device-request_queue;
-   unsigned long flags;
-
-   req-rq_status = RQ_SCSI_DONE;  /* Busy, but indicate request done */
-
-   spin_lock_irqsave(q-queue_lock, flags);
-   if (blk_rq_tagged(req))
-   blk_queue_end_tag(q, req);
-   spin_unlock_irqrestore(q-queue_lock, flags);
-
-   if (req-waiting)
-   complete(req-waiting);
-}
-
 /* This is the end routine we get to if a command was never attached
  * to the request.  Simply complete the request without changing
  * rq_status; this will cause a DRIVER_ERROR. */
@@ -263,19 +246,36 @@ void scsi_wait_req(struct scsi_request *
   unsigned bufflen, int timeout, int retries)
 {
DECLARE_COMPLETION(wait);
-   
-   sreq-sr_request-waiting = wait;
-   sreq-sr_request-rq_status = RQ_SCSI_BUSY;
-   sreq-sr_request-end_io = scsi_wait_req_end_io;
-   scsi_do_req(sreq, cmnd, buffer, bufflen, scsi_wait_done,
-   timeout, retries);
+   struct request *req;
+
+   if (bufflen)
+   req = blk_rq_map_kern(sreq-sr_device-request_queue,
+ sreq-sr_data_direction == DMA_TO_DEVICE,
+ buffer, bufflen, __GFP_WAIT);
+   else
+   req = blk_get_request(sreq-sr_device-request_queue, READ,
+ __GFP_WAIT);
+   req-flags |= REQ_NOMERGE;
+   req-waiting = wait;
+   req-end_io = scsi_wait_req_end_io;
+   req-cmd_len = COMMAND_SIZE(((u8 *)cmnd)[0]);
+   req-sense = sreq-sr_sense_buffer;
+   req-sense_len = 0;
+   memcpy(req-cmd, cmnd, req-cmd_len);
+   req-timeout = timeout;
+   req-flags |= REQ_BLOCK_PC;
+   req-rq_disk = NULL;
+   blk_insert_request(sreq-sr_device-request_queue, req,
+  sreq-sr_data_direction == DMA_TO_DEVICE, NULL);
wait_for_completion(wait);
sreq-sr_request-waiting = NULL;
-   if (sreq-sr_request-rq_status != RQ_SCSI_DONE)
+   sreq-sr_result = req-errors;
+   if (req-errors)
sreq-sr_result |= (DRIVER_ERROR  24);
 
-   __scsi_release_request(sreq);
+   blk_put_request(req);
 }
+
 EXPORT_SYMBOL(scsi_wait_req);
 
 /*
@@ -878,11 +878,12 @@ void scsi_io_completion(struct scsi_cmnd
return;
}
if (result) {
-   printk(KERN_INFO SCSI error : %d %d %d %d return code 
-  = 0x%x\n, cmd-device-host-host_no,
-  cmd-device-channel,
-  cmd-device-id,
-  cmd-device-lun, result);
+   if (!(req-flags  REQ_SPECIAL))
+   printk(KERN_INFO SCSI error : %d %d %d %d return 
code 
+  = 0x%x\n, cmd-device-host-host_no,
+  cmd-device-channel,
+  cmd-device-id,
+  cmd-device-lun, result);
 
if (driver_byte(result)  DRIVER_SENSE)
scsi_print_sense(, cmd);
@@ -1020,6 +1021,12 @@ static int scsi_issue_flush_fn(request_q
return -EOPNOTSUPP;
 }
 
+static void scsi_generic_done(struct scsi_cmnd *cmd)
+{
+   BUG_ON(!blk_pc_request(cmd-request));
+   scsi_io_completion(cmd, cmd-result == 0 ? cmd-bufflen : 0, 0);
+}
+
 static int scsi_prep_fn(struct request_queue *q, struct request *req)
 {
struct scsi_device *sdev = q-queuedata;
@@ -1061,7 +1068,7 @@ static int scsi_prep_fn(struct request_q
 * these two cases differently.  We differentiate by looking
 * at request-cmd, as this tells us the 

update scsi_wait_req to new format for blk_rq_map_kern()

2005-09-07 Thread Linux Kernel Mailing List
tree af64a510d254c8c96f662c3e3ba5039119765b1b
parent e537a36d528053f6b9dbe6c88e763e835c0d3517
author James Bottomley [EMAIL PROTECTED](none) Thu, 16 Jun 2005 04:16:09 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 20:46:39 
-0500

update scsi_wait_req to new format for blk_rq_map_kern()

Signed-off-by: James Bottomley [EMAIL PROTECTED]
 drivers/scsi/scsi_lib.c |   17 ++---
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -246,15 +246,18 @@ void scsi_wait_req(struct scsi_request *
   unsigned bufflen, int timeout, int retries)
 {
DECLARE_COMPLETION(wait);
+   int write = sreq-sr_data_direction == DMA_TO_DEVICE;
struct request *req;
 
-   if (bufflen)
-   req = blk_rq_map_kern(sreq-sr_device-request_queue,
- sreq-sr_data_direction == DMA_TO_DEVICE,
- buffer, bufflen, __GFP_WAIT);
-   else
-   req = blk_get_request(sreq-sr_device-request_queue, READ,
- __GFP_WAIT);
+   req = blk_get_request(sreq-sr_device-request_queue, write,
+ __GFP_WAIT);
+   if (bufflen  blk_rq_map_kern(sreq-sr_device-request_queue, req,
+  buffer, bufflen, __GFP_WAIT)) {
+   sreq-sr_result = DRIVER_ERROR  24;
+   blk_put_request(req);
+   return;
+   }
+
req-flags |= REQ_NOMERGE;
req-waiting = wait;
req-end_io = scsi_wait_req_end_io;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] use scatter lists for all block pc requests and simplify hw handlers

2005-09-07 Thread Linux Kernel Mailing List
tree ce664010089283f464d88cd89c11a60d35923851
parent 8e6401187ef7fb1edc2740832b48bf47ed2c90f2
author James Bottomley [EMAIL PROTECTED](none) Thu, 16 Jun 2005 04:48:29 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 20:46:40 
-0500

[SCSI] use scatter lists for all block pc requests and simplify hw handlers

Original From: Mike Christie [EMAIL PROTECTED]

Add scsi_execute_req() as a replacement for scsi_wait_req()

Fixed up various pieces (added REQ_SPECIAL and caught req use after
free)

Signed-off-by: James Bottomley [EMAIL PROTECTED]
 drivers/scsi/scsi_lib.c |   51 +++-
 drivers/scsi/scsi_scan.c|  112 +++-
 include/scsi/scsi_request.h |3 +
 3 files changed, 102 insertions(+), 64 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -246,7 +246,7 @@ void scsi_wait_req(struct scsi_request *
   unsigned bufflen, int timeout, int retries)
 {
DECLARE_COMPLETION(wait);
-   int write = sreq-sr_data_direction == DMA_TO_DEVICE;
+   int write = (sreq-sr_data_direction == DMA_TO_DEVICE);
struct request *req;
 
req = blk_get_request(sreq-sr_device-request_queue, write,
@@ -281,6 +281,55 @@ void scsi_wait_req(struct scsi_request *
 
 EXPORT_SYMBOL(scsi_wait_req);
 
+/**
+ * scsi_execute_req - insert request and wait for the result
+ * @sdev:  scsi device
+ * @cmd:   scsi command
+ * @data_direction: data direction
+ * @buffer:data buffer
+ * @bufflen:   len of buffer
+ * @sense: optional sense buffer
+ * @timeout:   request timeout in seconds
+ * @retries:   number of times to retry request
+ *
+ * scsi_execute_req returns the req-errors value which is the
+ * the scsi_cmnd result field.
+ **/
+int scsi_execute_req(struct scsi_device *sdev, unsigned char *cmd,
+int data_direction, void *buffer, unsigned bufflen,
+unsigned char *sense, int timeout, int retries)
+{
+   struct request *req;
+   int write = (data_direction == DMA_TO_DEVICE);
+   int ret = DRIVER_ERROR  24;
+
+   req = blk_get_request(sdev-request_queue, write, __GFP_WAIT);
+
+   if (bufflen   blk_rq_map_kern(sdev-request_queue, req,
+   buffer, bufflen, __GFP_WAIT))
+   goto out;
+
+   req-cmd_len = COMMAND_SIZE(cmd[0]);
+   memcpy(req-cmd, cmd, req-cmd_len);
+   req-sense = sense;
+   req-sense_len = 0;
+   req-timeout = timeout;
+   req-flags |= REQ_BLOCK_PC | REQ_SPECIAL;
+
+   /*
+* head injection *required* here otherwise quiesce won't work
+*/
+   blk_execute_rq(req-q, NULL, req, 1);
+
+   ret = req-errors;
+ out:
+   blk_put_request(req);
+
+   return ret;
+}
+
+EXPORT_SYMBOL(scsi_execute_req);
+
 /*
  * Function:scsi_init_cmd_errh()
  *
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -111,15 +111,14 @@ MODULE_PARM_DESC(inq_timeout, 
 
 /**
  * scsi_unlock_floptical - unlock device via a special MODE SENSE command
- * @sreq:  used to send the command
+ * @sdev:  scsi device to send command to
  * @result:area to store the result of the MODE SENSE
  *
  * Description:
- * Send a vendor specific MODE SENSE (not a MODE SELECT) command using
- * @sreq to unlock a device, storing the (unused) results into result.
+ * Send a vendor specific MODE SENSE (not a MODE SELECT) command.
  * Called for BLIST_KEY devices.
  **/
-static void scsi_unlock_floptical(struct scsi_request *sreq,
+static void scsi_unlock_floptical(struct scsi_device *sdev,
  unsigned char *result)
 {
unsigned char scsi_cmd[MAX_COMMAND_SIZE];
@@ -129,11 +128,10 @@ static void scsi_unlock_floptical(struct
scsi_cmd[1] = 0;
scsi_cmd[2] = 0x2e;
scsi_cmd[3] = 0;
-   scsi_cmd[4] = 0x2a; /* size */
+   scsi_cmd[4] = 0x2a; /* size */
scsi_cmd[5] = 0;
-   sreq-sr_cmd_len = 0;
-   sreq-sr_data_direction = DMA_FROM_DEVICE;
-   scsi_wait_req(sreq, scsi_cmd, result, 0x2a /* size */, SCSI_TIMEOUT, 3);
+   scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, result, 0x2a, NULL,
+SCSI_TIMEOUT, 3);
 }
 
 /**
@@ -433,26 +431,26 @@ void scsi_target_reap(struct scsi_target
 
 /**
  * scsi_probe_lun - probe a single LUN using a SCSI INQUIRY
- * @sreq:  used to send the INQUIRY
+ * @sdev:  scsi_device to probe
  * @inq_result:area to store the INQUIRY result
+ * @result_len: len of inq_result
  * @bflags:store any bflags found here
  *
  * Description:
- * Probe the lun associated with @sreq using a standard SCSI INQUIRY;
+ * Probe the lun associated with @req using a standard SCSI INQUIRY;
  *
- * If the INQUIRY is successful, 

[XFS] Prevent the incore superblock sb_fdblocks count from leaking when we

2005-09-07 Thread Linux Kernel Mailing List
tree f4528809d197fc687a73b8152fab8356540455ba
parent bcec2b7f2bf856bdf2a8780a57fe78417a513682
author David Chinner [EMAIL PROTECTED] Fri, 02 Sep 2005 16:40:47 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:40:47 +1000

[XFS] Prevent the incore superblock sb_fdblocks count from leaking when we
are getting ENOSPC errors on writes. When we fail to allocate space for
indirect blocks in xfs_bmapi() make sure we release the direct block
allocation before returning.

SGI-PV: 938502
SGI-Modid: xfs-linux:xfs-kern:22986a

Signed-off-by: David Chinner [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/xfs_bmap.c |   12 +++-
 1 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -4754,10 +4754,20 @@ xfs_bmapi(
error = xfs_mod_incore_sb(mp,
XFS_SBS_FDBLOCKS,
-(alen), rsvd);
-   if (!error)
+   if (!error) {
error = xfs_mod_incore_sb(mp,
XFS_SBS_FDBLOCKS,
-(indlen), rsvd);
+   if (error  rt) {
+   xfs_mod_incore_sb(ip-i_mount,
+   XFS_SBS_FREXTENTS,
+   extsz, rsvd);
+   } else if (error) {
+   xfs_mod_incore_sb(ip-i_mount,
+   XFS_SBS_FDBLOCKS,
+   alen, rsvd);
+   }
+   }
 
if (error) {
if (XFS_IS_QUOTA_ON(ip-i_mount))
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] comment cleanup for spi_execute

2005-09-07 Thread Linux Kernel Mailing List
tree e7032760509cdb7185fae574ac070f6dfeda8a3e
parent 1ccb48bb163853c24840c0a50c2a6df1affe029c
author Christoph Hellwig [EMAIL PROTECTED] Sun, 19 Jun 2005 11:32:53 +0200
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:34:10 
-0500

[SCSI] comment cleanup for spi_execute

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/scsi_transport_spi.c |4 
 1 files changed, 4 deletions(-)

diff --git a/drivers/scsi/scsi_transport_spi.c 
b/drivers/scsi/scsi_transport_spi.c
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -106,8 +106,6 @@ static int sprint_frac(char *dest, int v
return result;
 }
 
-/* Modification of scsi_wait_req that will clear UNIT ATTENTION conditions
- * resulting from (likely) bus and device resets */
 static int spi_execute(struct scsi_device *sdev, const void *cmd,
   enum dma_data_direction dir,
   void *buffer, unsigned bufflen,
@@ -117,8 +115,6 @@ static int spi_execute(struct scsi_devic
unsigned char sense[SCSI_SENSE_BUFFERSIZE];
 
for(i = 0; i  DV_RETRIES; i++) {
-
-   /* FIXME: need to set REQ_FAILFAST */
result = scsi_execute(sdev, cmd, dir, buffer, bufflen,
  sense, DV_TIMEOUT, /* retries */ 1,
  REQ_FAILFAST);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] libata: fix pio_mask values (take 2)

2005-09-07 Thread Linux Kernel Mailing List
tree afd386f0cee850f62fdb9245105e02fe49631d28
parent 4706df3d3c42af802597d82c8b1542c3d52eab23
author Brett Russ [EMAIL PROTECTED] Fri, 02 Sep 2005 05:53:34 -0400
committer Jeff Garzik [EMAIL PROTECTED] Wed, 07 Sep 2005 09:54:54 -0400

[PATCH] libata: fix pio_mask values (take 2)

ata_get_mode_mask() uses bits 3 and 4 in the pio_mask to represent PIO
modes 3 and 4.  The value read from the drive, which reports support
for PIO3 and PIO4 in bits 0 and 1, is shifted left by 3 bits and OR'd
with 0x7 (which then corresponds to PIO 2-0 in libata).  Thus, the
drivers below need adjustments to comply with the way pio_mask is
used.  I changed the masks from the commented values to all support
PIO4-0, since the spec mandates that PIO0-2 are supported and there's
no reason not to support PIO3 IMO.

Signed-off-by: Brett Russ [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]

 drivers/scsi/ahci.c |2 +-
 drivers/scsi/sata_uli.c |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -250,7 +250,7 @@ static struct ata_port_info ahci_port_in
.host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
  ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
  ATA_FLAG_PIO_DMA,
-   .pio_mask   = 0x03, /* pio3-4 */
+   .pio_mask   = 0x1f, /* pio0-4 */
.udma_mask  = 0x7f, /* udma0-6 ; FIXME */
.port_ops   = ahci_ops,
},
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
--- a/drivers/scsi/sata_uli.c
+++ b/drivers/scsi/sata_uli.c
@@ -125,8 +125,8 @@ static struct ata_port_info uli_port_inf
.sht= uli_sht,
.host_flags = ATA_FLAG_SATA | ATA_FLAG_SATA_RESET |
  ATA_FLAG_NO_LEGACY,
-   .pio_mask   = 0x03, //support pio mode 4 (FIXME)
-   .udma_mask  = 0x7f, //support udma mode 6
+   .pio_mask   = 0x1f, /* pio0-4 */
+   .udma_mask  = 0x7f, /* udma0-6 */
.port_ops   = uli_ops,
 };
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] Fix check for writeable file in xfs_ioc_space ioctl code

2005-09-07 Thread Linux Kernel Mailing List
tree 9904bc324d1d174c198da8a74d6dec937cddc036
parent 3bdbfb104e53b367892cc9510e6722346dfb656b
author Eric Sandeen [EMAIL PROTECTED] Fri, 02 Sep 2005 16:41:16 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:41:16 +1000

[XFS] Fix check for writeable file in xfs_ioc_space ioctl code

SGI-PV: 938905
SGI-Modid: xfs-linux:xfs-kern:195240a

Signed-off-by: Eric Sandeen [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_ioctl.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -982,7 +982,7 @@ xfs_ioc_space(
if (vp-v_inode.i_flags  (S_IMMUTABLE|S_APPEND))
return -XFS_ERROR(EPERM);
 
-   if (!(filp-f_flags  FMODE_WRITE))
+   if (!(filp-f_mode  FMODE_WRITE))
return -XFS_ERROR(EBADF);
 
if (vp-v_type != VREG)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] 929956 add log debugging and tracing info

2005-09-07 Thread Linux Kernel Mailing List
tree ea1387a8bb0ca34f8690232bb4bddf99e3a8bf6c
parent 32fb9b57aef35b82434cfb4c9de18b484fc3ec88
author Tim Shimmin [EMAIL PROTECTED] Fri, 02 Sep 2005 16:42:05 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:42:05 +1000

[XFS] 929956 add log debugging and tracing info

SGI-PV: 931456
SGI-Modid: xfs-linux:xfs-kern:23155a

Signed-off-by: Tim Shimmin [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/quota/xfs_dquot_item.c |1 
 fs/xfs/xfs_buf_item.c |4 +
 fs/xfs/xfs_extfree_item.c |2 
 fs/xfs/xfs_inode_item.c   |9 ++
 fs/xfs/xfs_log.c  |  161 +++---
 fs/xfs/xfs_log.h  |   38 +
 fs/xfs/xfs_log_priv.h |   68 +++--
 fs/xfs/xfs_trans.c|3 
 fs/xfs/xfs_trans.h|1 
 9 files changed, 265 insertions(+), 22 deletions(-)

diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c
--- a/fs/xfs/quota/xfs_dquot_item.c
+++ b/fs/xfs/quota/xfs_dquot_item.c
@@ -509,6 +509,7 @@ xfs_qm_qoff_logitem_format(xfs_qoff_logi
 
log_vector-i_addr = (xfs_caddr_t)(qf-qql_format);
log_vector-i_len = sizeof(xfs_qoff_logitem_t);
+   XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_QUOTAOFF);
qf-qql_format.qf_size = 1;
 }
 
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -274,6 +274,7 @@ xfs_buf_item_format(
   ((bip-bli_format.blf_map_size - 1) * sizeof(uint)));
vecp-i_addr = (xfs_caddr_t)bip-bli_format;
vecp-i_len = base_size;
+   XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BFORMAT);
vecp++;
nvecs = 1;
 
@@ -320,12 +321,14 @@ xfs_buf_item_format(
buffer_offset = first_bit * XFS_BLI_CHUNK;
vecp-i_addr = xfs_buf_offset(bp, buffer_offset);
vecp-i_len = nbits * XFS_BLI_CHUNK;
+   XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BCHUNK);
nvecs++;
break;
} else if (next_bit != last_bit + 1) {
buffer_offset = first_bit * XFS_BLI_CHUNK;
vecp-i_addr = xfs_buf_offset(bp, buffer_offset);
vecp-i_len = nbits * XFS_BLI_CHUNK;
+   XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BCHUNK);
nvecs++;
vecp++;
first_bit = next_bit;
@@ -337,6 +340,7 @@ xfs_buf_item_format(
buffer_offset = first_bit * XFS_BLI_CHUNK;
vecp-i_addr = xfs_buf_offset(bp, buffer_offset);
vecp-i_len = nbits * XFS_BLI_CHUNK;
+   XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BCHUNK);
 /* You would think we need to bump the nvecs here too, but we do not
  * this number is used by recovery, and it gets confused by the boundary
  * split here
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -107,6 +107,7 @@ xfs_efi_item_format(xfs_efi_log_item_t  *
 
log_vector-i_addr = (xfs_caddr_t)(efip-efi_format);
log_vector-i_len = size;
+   XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_EFI_FORMAT);
ASSERT(size = sizeof(xfs_efi_log_format_t));
 }
 
@@ -426,6 +427,7 @@ xfs_efd_item_format(xfs_efd_log_item_t  *
 
log_vector-i_addr = (xfs_caddr_t)(efdp-efd_format);
log_vector-i_len = size;
+   XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_EFD_FORMAT);
ASSERT(size = sizeof(xfs_efd_log_format_t));
 }
 
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -248,6 +248,7 @@ xfs_inode_item_format(
 
vecp-i_addr = (xfs_caddr_t)iip-ili_format;
vecp-i_len  = sizeof(xfs_inode_log_format_t);
+   XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IFORMAT);
vecp++;
nvecs= 1;
 
@@ -292,6 +293,7 @@ xfs_inode_item_format(
 
vecp-i_addr = (xfs_caddr_t)ip-i_d;
vecp-i_len  = sizeof(xfs_dinode_core_t);
+   XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_ICORE);
vecp++;
nvecs++;
iip-ili_format.ilf_fields |= XFS_ILOG_CORE;
@@ -349,6 +351,7 @@ xfs_inode_item_format(
vecp-i_addr =
(char *)(ip-i_df.if_u1.if_extents);
vecp-i_len = ip-i_df.if_bytes;
+   XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IEXT);
} else
 #endif
{
@@ -367,6 +370,7 @@ xfs_inode_item_format(
vecp-i_addr = (xfs_caddr_t)ext_buffer;
vecp-i_len = xfs_iextents_copy(ip, ext_buffer,

[SCSI] convert sd to scsi_execute_req (and update the scsi_execute_req API)

2005-09-07 Thread Linux Kernel Mailing List
tree c000be3180caccc6d484aad0f82f58d733358622
parent 33aa687db90dd8541bd5e9a762eebf880eaee767
author James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:33:52 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:33:52 
-0500

[SCSI] convert sd to scsi_execute_req (and update the scsi_execute_req API)

This one removes struct scsi_request entirely from sd.  In the process,
I noticed we have no callers of scsi_wait_req who don't immediately
normalise the sense, so I updated the API to make it take a struct
scsi_sense_hdr instead of simply a big sense buffer.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/constants.c   |   48 +++--
 drivers/scsi/scsi_ioctl.c  |   15 +---
 drivers/scsi/scsi_lib.c|   67 ++
 drivers/scsi/scsi_scan.c   |   13 +--
 drivers/scsi/sd.c  |  160 ++---
 include/scsi/scsi_dbg.h|2 
 include/scsi/scsi_device.h |   14 +--
 7 files changed, 146 insertions(+), 173 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1156,6 +1156,31 @@ scsi_show_extd_sense(unsigned char asc, 
}
 }
 
+void
+scsi_print_sense_hdr(const char *name, struct scsi_sense_hdr *sshdr)
+{
+   const char *sense_txt;
+   /* An example of deferred is when an earlier write to disk cache
+* succeeded, but now the disk discovers that it cannot write the
+* data to the magnetic media.
+*/
+   const char *error = scsi_sense_is_deferred(sshdr) ? 
+   DEFERRED : Current;
+   printk(KERN_INFO %s: %s, name, error);
+   if (sshdr-response_code = 0x72)
+   printk( [descriptor]);
+
+   sense_txt = scsi_sense_key_string(sshdr-sense_key);
+   if (sense_txt)
+   printk(: sense key: %s\n, sense_txt);
+   else
+   printk(: sense key=0x%x\n, sshdr-sense_key);
+   printk(KERN_INFO );
+   scsi_show_extd_sense(sshdr-asc, sshdr-ascq);
+   printk(\n);
+}
+EXPORT_SYMBOL(scsi_print_sense_hdr);
+
 /* Print sense information */
 void
 __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
@@ -1163,8 +1188,6 @@ __scsi_print_sense(const char *name, con
 {
int k, num, res;
unsigned int info;
-   const char *error;
-   const char *sense_txt;
struct scsi_sense_hdr ssh;
 
res = scsi_normalize_sense(sense_buffer, sense_len, ssh);
@@ -1182,26 +1205,7 @@ __scsi_print_sense(const char *name, con
printk(\n);
return;
}
-
-   /* An example of deferred is when an earlier write to disk cache
-* succeeded, but now the disk discovers that it cannot write the
-* data to the magnetic media.
-*/
-   error = scsi_sense_is_deferred(ssh) ? 
-   DEFERRED : Current;
-   printk(KERN_INFO %s: %s, name, error);
-   if (ssh.response_code = 0x72)
-   printk( [descriptor]);
-
-   sense_txt = scsi_sense_key_string(ssh.sense_key);
-   if (sense_txt)
-   printk(: sense key: %s\n, sense_txt);
-   else
-   printk(: sense key=0x%x\n, ssh.sense_key);
-   printk(KERN_INFO );
-   scsi_show_extd_sense(ssh.asc, ssh.ascq);
-   printk(\n);
-
+   scsi_print_sense_hdr(name, ssh);
if (ssh.response_code  0x72) {
/* only decode extras for fixed format now */
char buff[80];
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -90,19 +90,16 @@ static int ioctl_internal_command(struct
 {
int result;
struct scsi_sense_hdr sshdr;
-   char sense[SCSI_SENSE_BUFFERSIZE];
 
SCSI_LOG_IOCTL(1, printk(Trying ioctl with scsi command %d\n, *cmd));
 
-
-   memset(sense, 0, sizeof(*sense));
result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0,
- sense, timeout, retries);
+ sshdr, timeout, retries);
 
SCSI_LOG_IOCTL(2, printk(Ioctl returned  0x%x\n, result));
 
if ((driver_byte(result)  DRIVER_SENSE) 
-   (scsi_normalize_sense(sense, sizeof(*sense), sshdr))) {
+   (scsi_sense_valid(sshdr))) {
switch (sshdr.sense_key) {
case ILLEGAL_REQUEST:
if (cmd[0] == ALLOW_MEDIUM_REMOVAL)
@@ -132,7 +129,7 @@ static int ioctl_internal_command(struct
   sdev-id,
   sdev-lun,
   result);
-   __scsi_print_sense(   , sense, sizeof(*sense));
+   scsi_print_sense_hdr(   , sshdr);
break;
}
}
@@ -315,9 +312,9 @@ int scsi_ioctl_send_command(struct scsi_
break;
}
 
- 

[XFS] Make metadata IO completion consistent with other IO completion

2005-09-07 Thread Linux Kernel Mailing List
tree 613ddae544b533a9051fd3bb8a733aaf6133961e
parent cdb626878f6f5e37d678d30c9cacf5726b88a656
author Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:39:56 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:39:56 +1000

[XFS] Make metadata IO completion consistent with other IO completion
handlers.

SGI-PV: 938409
SGI-Modid: xfs-linux:xfs-kern:22965a

Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_buf.c |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -1249,8 +1249,8 @@ bio_end_io_pagebuf(
int error)
 {
xfs_buf_t   *pb = (xfs_buf_t *)bio-bi_private;
-   unsigned inti, blocksize = pb-pb_target-pbr_bsize;
-   struct bio_vec  *bvec = bio-bi_io_vec;
+   unsigned intblocksize = pb-pb_target-pbr_bsize;
+   struct bio_vec  *bvec = bio-bi_io_vec + bio-bi_vcnt - 1;
 
if (bio-bi_size)
return 1;
@@ -1258,10 +1258,12 @@ bio_end_io_pagebuf(
if (!test_bit(BIO_UPTODATE, bio-bi_flags))
pb-pb_error = EIO;
 
-   for (i = 0; i  bio-bi_vcnt; i++, bvec++) {
+   do {
struct page *page = bvec-bv_page;
 
-   if (pb-pb_error) {
+   if (unlikely(pb-pb_error)) {
+   if (pb-pb_flags  PBF_READ)
+   ClearPageUptodate(page);
SetPageError(page);
} else if (blocksize == PAGE_CACHE_SIZE) {
SetPageUptodate(page);
@@ -1270,10 +1272,13 @@ bio_end_io_pagebuf(
set_page_region(page, bvec-bv_offset, bvec-bv_len);
}
 
+   if (--bvec = bio-bi_io_vec)
+   prefetchw(bvec-bv_page-flags);
+
if (_pagebuf_iolocked(pb)) {
unlock_page(page);
}
-   }
+   } while (bvec = bio-bi_io_vec);
 
_pagebuf_iodone(pb, 1);
bio_put(bio);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] remove struct vnode::v_type

2005-09-07 Thread Linux Kernel Mailing List
tree 44fa8c13d6300c9c42b9f5a60aeb933131e24e67
parent 155ffd075caedcea5ad595c95403c71bfc391c4a
author Christoph Hellwig [EMAIL PROTECTED] Fri, 02 Sep 2005 16:46:51 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:46:51 +1000

[XFS] remove struct vnode::v_type

SGI-PV: 936236
SGI-Modid: xfs-linux:xfs-kern:195878a

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_ioctl.c |   16 ++-
 fs/xfs/linux-2.6/xfs_iops.c  |6 +
 fs/xfs/linux-2.6/xfs_super.c |   35 -
 fs/xfs/linux-2.6/xfs_vnode.c |   16 ---
 fs/xfs/linux-2.6/xfs_vnode.h |   26 ++--
 fs/xfs/xfs_acl.c |6 ++---
 fs/xfs/xfs_inode.c   |3 --
 fs/xfs/xfs_vnodeops.c|   45 +--
 8 files changed, 68 insertions(+), 85 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -141,13 +141,19 @@ xfs_find_handle(
return -XFS_ERROR(EINVAL);
}
 
-   /* we need the vnode */
-   vp = LINVFS_GET_VP(inode);
-   if (vp-v_type != VREG  vp-v_type != VDIR  vp-v_type != VLNK) {
+   switch (inode-i_mode  S_IFMT) {
+   case S_IFREG:
+   case S_IFDIR:
+   case S_IFLNK:
+   break;
+   default:
iput(inode);
return -XFS_ERROR(EBADF);
}
 
+   /* we need the vnode */
+   vp = LINVFS_GET_VP(inode);
+
/* now we can grab the fsid */
memcpy(handle.ha_fsid, vp-v_vfsp-vfs_altfsid, sizeof(xfs_fsid_t));
hsize = sizeof(xfs_fsid_t);
@@ -386,7 +392,7 @@ xfs_readlink_by_handle(
return -error;
 
/* Restrict this handle operation to symlinks only. */
-   if (vp-v_type != VLNK) {
+   if (!S_ISLNK(inode-i_mode)) {
VN_RELE(vp);
return -XFS_ERROR(EINVAL);
}
@@ -985,7 +991,7 @@ xfs_ioc_space(
if (!(filp-f_mode  FMODE_WRITE))
return -XFS_ERROR(EBADF);
 
-   if (vp-v_type != VREG)
+   if (!VN_ISREG(vp))
return -XFS_ERROR(EINVAL);
 
if (copy_from_user(bf, arg, sizeof(bf)))
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -140,7 +140,6 @@ linvfs_mknod(
 
memset(va, 0, sizeof(va));
va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
-   va.va_type = IFTOVT(mode);
va.va_mode = mode;
 
switch (mode  S_IFMT) {
@@ -308,14 +307,13 @@ linvfs_symlink(
cvp = NULL;
 
memset(va, 0, sizeof(va));
-   va.va_type = VLNK;
-   va.va_mode = irix_symlink_mode ? 0777  ~current-fs-umask : S_IRWXUGO;
+   va.va_mode = S_IFLNK |
+   (irix_symlink_mode ? 0777  ~current-fs-umask : S_IRWXUGO);
va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
 
error = 0;
VOP_SYMLINK(dvp, dentry, va, (char *)symname, cvp, NULL, error);
if (!error  cvp) {
-   ASSERT(cvp-v_type == VLNK);
ip = LINVFS_GET_IP(cvp);
d_instantiate(dentry, ip);
validate_fields(dir);
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -138,24 +138,25 @@ STATIC __inline__ void
 xfs_set_inodeops(
struct inode*inode)
 {
-   vnode_t *vp = LINVFS_GET_VP(inode);
-
-   if (vp-v_type == VNON) {
-   vn_mark_bad(vp);
-   } else if (S_ISREG(inode-i_mode)) {
+   switch (inode-i_mode  S_IFMT) {
+   case S_IFREG:
inode-i_op = linvfs_file_inode_operations;
inode-i_fop = linvfs_file_operations;
inode-i_mapping-a_ops = linvfs_aops;
-   } else if (S_ISDIR(inode-i_mode)) {
+   break;
+   case S_IFDIR:
inode-i_op = linvfs_dir_inode_operations;
inode-i_fop = linvfs_dir_operations;
-   } else if (S_ISLNK(inode-i_mode)) {
+   break;
+   case S_IFLNK:
inode-i_op = linvfs_symlink_inode_operations;
if (inode-i_blocks)
inode-i_mapping-a_ops = linvfs_aops;
-   } else {
+   break;
+   default:
inode-i_op = linvfs_file_inode_operations;
init_special_inode(inode, inode-i_mode, inode-i_rdev);
+   break;
}
 }
 
@@ -167,16 +168,23 @@ xfs_revalidate_inode(
 {
struct inode*inode = LINVFS_GET_IP(vp);
 
-   inode-i_mode   = (ip-i_d.di_mode  MODEMASK) | VTTOIF(vp-v_type);
+   inode-i_mode   = ip-i_d.di_mode;
inode-i_nlink  = ip-i_d.di_nlink;
inode-i_uid= ip-i_d.di_uid;
inode-i_gid= ip-i_d.di_gid;
-   if (((1  

[XFS] Fix regression in transaction reserved-block accounting for direct

2005-09-07 Thread Linux Kernel Mailing List
tree 10b39fa2358be3766f36a6f7729d176ceb14ebd6
parent ad4a8ac4e9d9cffb0a4c9ebebc6bda9d8dbbfe99
author Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:41:32 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:41:32 +1000

[XFS] Fix regression in transaction reserved-block accounting for direct
writes.

SGI-PV: 938145
SGI-Modid: xfs-linux:xfs-kern:23088a

Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/xfs_iomap.c |   17 -
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -391,9 +391,9 @@ xfs_iomap_write_direct(
xfs_bmbt_irec_t imap[XFS_WRITE_IMAPS], *imapp;
xfs_bmap_free_t free_list;
int aeof;
-   xfs_filblks_t   datablocks, qblocks, resblks;
+   xfs_filblks_t   qblocks, resblks;
int committed;
-   int numrtextents;
+   int resrtextents;
 
/*
 * Make sure that the dquots are there. This doesn't hold
@@ -434,14 +434,14 @@ xfs_iomap_write_direct(
 
if (!(extsz = ip-i_d.di_extsize))
extsz = mp-m_sb.sb_rextsize;
-   numrtextents = qblocks = (count_fsb + extsz - 1);
-   do_div(numrtextents, mp-m_sb.sb_rextsize);
+   resrtextents = qblocks = (count_fsb + extsz - 1);
+   do_div(resrtextents, mp-m_sb.sb_rextsize);
+   resblks = XFS_DIOSTRAT_SPACE_RES(mp, 0);
quota_flag = XFS_QMOPT_RES_RTBLKS;
-   datablocks = 0;
} else {
-   datablocks = qblocks = count_fsb;
+   resrtextents = 0;
+   resblks = qblocks = XFS_DIOSTRAT_SPACE_RES(mp, count_fsb);
quota_flag = XFS_QMOPT_RES_REGBLKS;
-   numrtextents = 0;
}
 
/*
@@ -449,9 +449,8 @@ xfs_iomap_write_direct(
 */
xfs_iunlock(ip, XFS_ILOCK_EXCL);
tp = xfs_trans_alloc(mp, XFS_TRANS_DIOSTRAT);
-   resblks = XFS_DIOSTRAT_SPACE_RES(mp, datablocks);
error = xfs_trans_reserve(tp, resblks,
-   XFS_WRITE_LOG_RES(mp), numrtextents,
+   XFS_WRITE_LOG_RES(mp), resrtextents,
XFS_TRANS_PERM_LOG_RES,
XFS_WRITE_LOG_COUNT);
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] remove unessecary vnode flags

2005-09-07 Thread Linux Kernel Mailing List
tree 06558d42a069d0faeb398d81016c33448960d009
parent 760dea671ea9c5b8c732d76d09673d6d052a186f
author Christoph Hellwig [EMAIL PROTECTED] Fri, 02 Sep 2005 16:56:14 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:56:14 +1000

[XFS] remove unessecary vnode flags

SGI-PV: 934766
SGI-Modid: xfs-linux:xfs-kern:196852a

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_vnode.c |   59 ---
 fs/xfs/linux-2.6/xfs_vnode.h |4 --
 fs/xfs/xfs_iget.c|   11 
 3 files changed, 1 insertion(+), 73 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -78,10 +78,6 @@ vn_reclaim(
}
ASSERT(vp-v_fbhv == NULL);
 
-   VN_LOCK(vp);
-   vp-v_flag = (VRECLM|VWAIT);
-   VN_UNLOCK(vp, 0);
-
vp-v_fbhv = NULL;
 
 #ifdef XFS_VNODE_TRACE
@@ -92,31 +88,6 @@ vn_reclaim(
return 0;
 }
 
-STATIC void
-vn_wakeup(
-   struct vnode*vp)
-{
-   VN_LOCK(vp);
-   if (vp-v_flag  VWAIT)
-   sv_broadcast(vptosync(vp));
-   vp-v_flag = ~(VRECLM|VWAIT|VMODIFIED);
-   VN_UNLOCK(vp, 0);
-}
-
-int
-vn_wait(
-   struct vnode*vp)
-{
-   VN_LOCK(vp);
-   if (vp-v_flag  (VINACT | VRECLM)) {
-   vp-v_flag |= VWAIT;
-   sv_wait(vptosync(vp), PINOD, vp-v_lock, 0);
-   return 1;
-   }
-   VN_UNLOCK(vp, 0);
-   return 0;
-}
-
 struct vnode *
 vn_initialize(
struct inode*inode)
@@ -221,7 +192,6 @@ vn_purge(
 {
vn_trace_entry(vp, vn_purge, (inst_t *)__return_address);
 
-again:
/*
 * Check whether vp has already been reclaimed since our caller
 * sampled its version while holding a filesystem cache lock that
@@ -234,19 +204,6 @@ again:
}
 
/*
-* If vp is being reclaimed or inactivated, wait until it is inert,
-* then proceed.  Can't assume that vnode is actually reclaimed
-* just because the reclaimed flag is asserted -- a vn_alloc
-* reclaim can fail.
-*/
-   if (vp-v_flag  (VINACT | VRECLM)) {
-   ASSERT(vn_count(vp) == 0);
-   vp-v_flag |= VWAIT;
-   sv_wait(vptosync(vp), PINOD, vp-v_lock, 0);
-   goto again;
-   }
-
-   /*
 * Another process could have raced in and gotten this vnode...
 */
if (vn_count(vp)  0) {
@@ -255,7 +212,6 @@ again:
}
 
XFS_STATS_DEC(vn_active);
-   vp-v_flag |= VRECLM;
VN_UNLOCK(vp, 0);
 
/*
@@ -266,11 +222,6 @@ again:
 */
if (vn_reclaim(vp) != 0)
panic(vn_purge: cannot reclaim);
-
-   /*
-* Wakeup anyone waiting for vp to be reclaimed.
-*/
-   vn_wakeup(vp);
 }
 
 /*
@@ -315,11 +266,6 @@ vn_rele(
 * return.
 */
if (!vcnt) {
-   /*
-* As soon as we turn this on, noone can find us in vn_get
-* until we turn off VINACT or VRECLM
-*/
-   vp-v_flag |= VINACT;
VN_UNLOCK(vp, 0);
 
/*
@@ -330,10 +276,7 @@ vn_rele(
VOP_INACTIVE(vp, NULL, cache);
 
VN_LOCK(vp);
-   if (vp-v_flag  VWAIT)
-   sv_broadcast(vptosync(vp));
-
-   vp-v_flag = ~(VINACT|VWAIT|VRECLM|VMODIFIED);
+   vp-v_flag = ~VMODIFIED;
}
 
VN_UNLOCK(vp, 0);
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -135,9 +135,6 @@ typedef enum {
 /*
  * Vnode flags.
  */
-#define VINACT0x1  /* vnode is being inactivated   */
-#define VRECLM0x2  /* vnode is being reclaimed */
-#define VWAIT 0x4  /* waiting for VINACT/VRECLM to end */
 #define VMODIFIED 0x8  /* XFS inode state possibly differs */
/* to the Linux inode state.*/
 
@@ -489,7 +486,6 @@ typedef struct vattr {
(VN_ISREG(vp)  ((mode)  (VSGID|(VEXEC3))) == VSGID)
 
 extern voidvn_init(void);
-extern int vn_wait(struct vnode *);
 extern vnode_t *vn_initialize(struct inode *);
 
 /*
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -505,7 +505,6 @@ xfs_iget(
vnode_t *vp = NULL;
int error;
 
-retry:
XFS_STATS_INC(xs_ig_attempts);
 
if ((inode = iget_locked(XFS_MTOVFS(mp)-vfs_super, ino))) {
@@ -526,16 +525,6 @@ inode_allocate:
iput(inode);
}
} else {
-   /* These are true if the inode is in inactive or
- 

[SCSI] convert the remaining mid-layer pieces to scsi_execute_req

2005-09-07 Thread Linux Kernel Mailing List
tree 501f88d32efe275560c2df1f6c7c6bacf72af4cf
parent 7a93aef7fbac6f4db40b6fec5c0c6b654ae7a93c
author James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:27:01 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:27:01 
-0500

[SCSI] convert the remaining mid-layer pieces to scsi_execute_req

After this, we just have some drivers, all the ULDs and the SPI
transport class using scsi_wait_req().

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/scsi_ioctl.c   |   46 +++--
 drivers/scsi/scsi_lib.c |   94 +++-
 drivers/scsi/sd.c   |5 +-
 drivers/scsi/sr.c   |2 
 include/scsi/scsi_device.h  |   13 +-
 include/scsi/scsi_request.h |   15 ---
 6 files changed, 64 insertions(+), 111 deletions(-)

diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -88,25 +88,21 @@ static int ioctl_probe(struct Scsi_Host 
 static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
  int timeout, int retries)
 {
-   struct scsi_request *sreq;
int result;
struct scsi_sense_hdr sshdr;
+   char sense[SCSI_SENSE_BUFFERSIZE];
 
SCSI_LOG_IOCTL(1, printk(Trying ioctl with scsi command %d\n, *cmd));
 
-   sreq = scsi_allocate_request(sdev, GFP_KERNEL);
-   if (!sreq) {
-   printk(KERN_WARNING SCSI internal ioctl failed, no memory\n);
-   return -ENOMEM;
-   }
 
-   sreq-sr_data_direction = DMA_NONE;
-scsi_wait_req(sreq, cmd, NULL, 0, timeout, retries);
+   memset(sense, 0, sizeof(*sense));
+   result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0,
+ sense, timeout, retries);
 
-   SCSI_LOG_IOCTL(2, printk(Ioctl returned  0x%x\n, sreq-sr_result));
+   SCSI_LOG_IOCTL(2, printk(Ioctl returned  0x%x\n, result));
 
-   if ((driver_byte(sreq-sr_result)  DRIVER_SENSE) 
-   (scsi_request_normalize_sense(sreq, sshdr))) {
+   if ((driver_byte(result)  DRIVER_SENSE) 
+   (scsi_normalize_sense(sense, sizeof(*sense), sshdr))) {
switch (sshdr.sense_key) {
case ILLEGAL_REQUEST:
if (cmd[0] == ALLOW_MEDIUM_REMOVAL)
@@ -125,7 +121,7 @@ static int ioctl_internal_command(struct
case UNIT_ATTENTION:
if (sdev-removable) {
sdev-changed = 1;
-   sreq-sr_result = 0;/* This is no longer 
considered an error */
+   result = 0; /* This is no longer considered 
an error */
break;
}
default:/* Fall through for non-removable media */
@@ -135,15 +131,13 @@ static int ioctl_internal_command(struct
   sdev-channel,
   sdev-id,
   sdev-lun,
-  sreq-sr_result);
-   scsi_print_req_sense(   , sreq);
+  result);
+   __scsi_print_sense(   , sense, sizeof(*sense));
break;
}
}
 
-   result = sreq-sr_result;
SCSI_LOG_IOCTL(2, printk(IOCTL Releasing command\n));
-   scsi_release_request(sreq);
return result;
 }
 
@@ -208,8 +202,8 @@ int scsi_ioctl_send_command(struct scsi_
 {
char *buf;
unsigned char cmd[MAX_COMMAND_SIZE];
+   unsigned char sense[SCSI_SENSE_BUFFERSIZE];
char __user *cmd_in;
-   struct scsi_request *sreq;
unsigned char opcode;
unsigned int inlen, outlen, cmdlen;
unsigned int needed, buf_needed;
@@ -321,31 +315,23 @@ int scsi_ioctl_send_command(struct scsi_
break;
}
 
-   sreq = scsi_allocate_request(sdev, GFP_KERNEL);
-if (!sreq) {
-result = -EINTR;
-goto error;
-}
-
-   sreq-sr_data_direction = data_direction;
-scsi_wait_req(sreq, cmd, buf, needed, timeout, retries);
-
+   result = scsi_execute_req(sdev, cmd, data_direction, buf, needed,
+ sense, timeout, retries);
+ 
/* 
 * If there was an error condition, pass the info back to the user. 
 */
-   result = sreq-sr_result;
if (result) {
-   int sb_len = sizeof(sreq-sr_sense_buffer);
+   int sb_len = sizeof(*sense);
 
sb_len = (sb_len  OMAX_SB_LEN) ? OMAX_SB_LEN : sb_len;
-   if (copy_to_user(cmd_in, sreq-sr_sense_buffer, sb_len))
+   if (copy_to_user(cmd_in, sense, sb_len))
result = -EFAULT;
} else {
if (copy_to_user(cmd_in, buf, outlen))
 

[kernel-doc] fix various DocBook build problems/warnings

2005-09-07 Thread Linux Kernel Mailing List
tree 7ba5f46394251a478c071a64dff941369769a18c
parent 4706df3d3c42af802597d82c8b1542c3d52eab23
author Jeff Garzik [EMAIL PROTECTED] Wed, 07 Sep 2005 09:15:17 -0400
committer Jeff Garzik [EMAIL PROTECTED] Wed, 07 Sep 2005 09:15:17 -0400

[kernel-doc] fix various DocBook build problems/warnings

Most serious is fixing include/sound/pcm.h, which breaks the DocBook
build.

The other stuff is just filling in things that cause warnings.

 Documentation/DocBook/mcabook.tmpl |2 +-
 drivers/net/wan/syncppp.c  |1 +
 drivers/scsi/libata-core.c |4 ++--
 include/sound/pcm.h|2 +-
 kernel/sched.c |1 +
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/DocBook/mcabook.tmpl 
b/Documentation/DocBook/mcabook.tmpl
--- a/Documentation/DocBook/mcabook.tmpl
+++ b/Documentation/DocBook/mcabook.tmpl
@@ -96,7 +96,7 @@
 
   chapter id=pubfunctions
  titlePublic Functions Provided/title
-!Earch/i386/kernel/mca.c
+!Edrivers/mca/mca-legacy.c
   /chapter
 
   chapter id=dmafunctions
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -1440,6 +1440,7 @@ static void sppp_print_bytes (u_char *p,
  * @skb:   The buffer to process
  * @dev:   The device it arrived on
  * @p: Unused
+ * @orig_dev: Unused
  *
  * Protocol glue. This drives the deferred processing mode the poorer
  * cards use. This can be called directly by cards that do not have
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -2531,7 +2531,7 @@ void swap_buf_le16(u16 *buf, unsigned in
  * @ap: port to read/write
  * @buf: data buffer
  * @buflen: buffer length
- * @do_write: read/write
+ * @write_data: read/write
  *
  * Transfer data from/to the device data register by MMIO.
  *
@@ -2577,7 +2577,7 @@ static void ata_mmio_data_xfer(struct at
  * @ap: port to read/write
  * @buf: data buffer
  * @buflen: buffer length
- * @do_write: read/write
+ * @write_data: read/write
  *
  * Transfer data from/to the device data register by PIO.
  *
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -903,7 +903,7 @@ int snd_pcm_format_unsigned(snd_pcm_form
 int snd_pcm_format_linear(snd_pcm_format_t format);
 int snd_pcm_format_little_endian(snd_pcm_format_t format);
 int snd_pcm_format_big_endian(snd_pcm_format_t format);
-/**
+/*
  * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian
  * @format: the format to check
  *
diff --git a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1478,6 +1478,7 @@ static inline void prepare_task_switch(r
 
 /**
  * finish_task_switch - clean up after a task-switch
+ * @rq: runqueue associated with task-switch
  * @prev: the thread we just switched away from.
  *
  * finish_task_switch must be called after the context switch, paired
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


drm: small cleanups

2005-09-07 Thread Linux Kernel Mailing List
tree 4ffe6f27b02eb814f7c855bfb4e5f28c8f3d6280
parent 89625eb186b9b0b9454d44126f8b1bcc72ad93b7
author Dave Airlie [EMAIL PROTECTED](none) Mon, 05 Sep 2005 21:33:44 +1000
committer Dave Airlie [EMAIL PROTECTED] Mon, 05 Sep 2005 21:33:44 +1000

drm: small cleanups

This patch contains the following small cleanups:
- make two needlessly global functions static
- drm_sysfs.c: every file should #include the header with the prototypes
  of the global functions it is offering

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Dave Airlie [EMAIL PROTECTED]

 drivers/char/drm/drm_bufs.c|2 +-
 drivers/char/drm/drm_context.c |2 +-
 drivers/char/drm/drm_sysfs.c   |1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -1041,7 +1041,7 @@ static int drm_addbufs_sg(drm_device_t *
return 0;
 }
 
-int drm_addbufs_fb(drm_device_t *dev, drm_buf_desc_t *request)
+static int drm_addbufs_fb(drm_device_t *dev, drm_buf_desc_t *request)
 {
drm_device_dma_t *dma = dev-dma;
drm_buf_entry_t *entry;
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c
--- a/drivers/char/drm/drm_context.c
+++ b/drivers/char/drm/drm_context.c
@@ -308,7 +308,7 @@ found:
  *
  * Attempt to set drm_device::context_flag.
  */
-int drm_context_switch( drm_device_t *dev, int old, int new )
+static int drm_context_switch( drm_device_t *dev, int old, int new )
 {
 if ( test_and_set_bit( 0, dev-context_flag ) ) {
 DRM_ERROR( Reentering -- FIXME\n );
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
--- a/drivers/char/drm/drm_sysfs.c
+++ b/drivers/char/drm/drm_sysfs.c
@@ -17,6 +17,7 @@
 #include linux/err.h
 
 #include drm_core.h
+#include drmP.h
 
 struct drm_sysfs_class {
struct class_device_attribute attr;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] Remove extraneous quotacheck diagnostics.

2005-09-07 Thread Linux Kernel Mailing List
tree f7bb6d19d22cd94d7d160f305afd84d55c0231b9
parent e69a333b5e0c8c6b687b07665a3cb5545657d2aa
author Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:43:48 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:43:48 +1000

[XFS] Remove extraneous quotacheck diagnostics.

SGI-PV: 907752
SGI-Modid: xfs-linux:xfs-kern:23163a

Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/quota/xfs_qm.c |   12 ++--
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -388,11 +388,8 @@ xfs_qm_mount_quotas(
goto write_changes;
}
 
-#if defined(DEBUG)  defined(XFS_LOUD_RECOVERY)
-   cmn_err(CE_NOTE, Attempting to turn on disk quotas.);
-#endif
-
ASSERT(XFS_IS_QUOTA_RUNNING(mp));
+
/*
 * Allocate the quotainfo structure inside the mount struct, and
 * create quotainode(s), and change/rev superblock if necessary.
@@ -410,19 +407,14 @@ xfs_qm_mount_quotas(
 */
if (XFS_QM_NEED_QUOTACHECK(mp) 
!(mfsi_flags  XFS_MFSI_NO_QUOTACHECK)) {
-#ifdef DEBUG
-   cmn_err(CE_NOTE, Doing a quotacheck. Please wait.);
-#endif
if ((error = xfs_qm_quotacheck(mp))) {
/* Quotacheck has failed and quotas have
 * been disabled.
 */
return XFS_ERROR(error);
}
-#ifdef DEBUG
-   cmn_err(CE_NOTE, Done quotacheck.);
-#endif
}
+
  write_changes:
/*
 * We actually don't have to acquire the SB_LOCK at all.
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] fix 3ware raid emulated commands

2005-09-07 Thread Linux Kernel Mailing List
tree 4dcc96b31a31a6e7fbc82de31346f395fe78cb0b
parent f189c5cb8ddde0c01838f2b3bc7650e86c097a14
author James Bottomley [EMAIL PROTECTED] Tue, 28 Jun 2005 19:18:21 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:34:11 
-0500

[SCSI] fix 3ware raid emulated commands

The 3ware emulated commands all expect they are executing in the
use_sg == 0 case, which isn't true either in the block layer rework or
an SG_IO ioctl.

Fix this by adding the correct kmapping of the first element in the sg
list.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/3w-.c |   57 +
 1 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/3w-.c b/drivers/scsi/3w-.c
--- a/drivers/scsi/3w-.c
+++ b/drivers/scsi/3w-.c
@@ -1499,22 +1499,43 @@ static int tw_scsiop_inquiry(TW_Device_E
return 0;
 } /* End tw_scsiop_inquiry() */
 
+static void tw_transfer_internal(TW_Device_Extension *tw_dev, int request_id,
+void *data, unsigned int len)
+{
+   struct scsi_cmnd *cmd = tw_dev-srb[request_id];
+   void *buf;
+   unsigned int transfer_len;
+
+   if (cmd-use_sg) {
+   struct scatterlist *sg =
+   (struct scatterlist *)cmd-request_buffer;
+   buf = kmap_atomic(sg-page, KM_IRQ0) + sg-offset;
+   transfer_len = min(sg-length, len);
+   } else {
+   buf = cmd-request_buffer;
+   transfer_len = min(cmd-request_bufflen, len);
+   }
+
+   memcpy(buf, data, transfer_len);
+   
+   if (cmd-use_sg) {
+   struct scatterlist *sg;
+
+   sg = (struct scatterlist *)cmd-request_buffer;
+   kunmap_atomic(buf - sg-offset, KM_IRQ0);
+   }
+}
+
 /* This function is called by the isr to complete an inquiry command */
 static int tw_scsiop_inquiry_complete(TW_Device_Extension *tw_dev, int 
request_id)
 {
unsigned char *is_unit_present;
-   unsigned char *request_buffer;
+   unsigned char request_buffer[36];
TW_Param *param;
 
dprintk(KERN_NOTICE 3w-: tw_scsiop_inquiry_complete()\n);
 
-   /* Fill request buffer */
-   if (tw_dev-srb[request_id]-request_buffer == NULL) {
-   printk(KERN_WARNING 3w-: tw_scsiop_inquiry_complete(): 
Request buffer NULL.\n);
-   return 1;
-   }
-   request_buffer = tw_dev-srb[request_id]-request_buffer;
-   memset(request_buffer, 0, tw_dev-srb[request_id]-request_bufflen);
+   memset(request_buffer, 0, sizeof(request_buffer));
request_buffer[0] = TYPE_DISK; /* Peripheral device type */
request_buffer[1] = 0; /* Device type modifier */
request_buffer[2] = 0; /* No ansi/iso compliance */
@@ -1522,6 +1543,8 @@ static int tw_scsiop_inquiry_complete(TW
memcpy(request_buffer[8], 3ware   , 8);   /* Vendor ID */
sprintf(request_buffer[16], Logical Disk %-2d , 
tw_dev-srb[request_id]-device-id);
memcpy(request_buffer[32], TW_DRIVER_VERSION, 3);
+   tw_transfer_internal(tw_dev, request_id, request_buffer,
+sizeof(request_buffer));
 
param = (TW_Param *)tw_dev-alignment_virtual_address[request_id];
if (param == NULL) {
@@ -1612,7 +1635,7 @@ static int tw_scsiop_mode_sense_complete
 {
TW_Param *param;
unsigned char *flags;
-   unsigned char *request_buffer;
+   unsigned char request_buffer[8];
 
dprintk(KERN_NOTICE 3w-: tw_scsiop_mode_sense_complete()\n);
 
@@ -1622,8 +1645,7 @@ static int tw_scsiop_mode_sense_complete
return 1;
}
flags = (char *)(param-data[0]);
-   request_buffer = tw_dev-srb[request_id]-buffer;
-   memset(request_buffer, 0, tw_dev-srb[request_id]-request_bufflen);
+   memset(request_buffer, 0, sizeof(request_buffer));
 
request_buffer[0] = 0xf;/* mode data length */
request_buffer[1] = 0;  /* default medium type */
@@ -1635,6 +1657,8 @@ static int tw_scsiop_mode_sense_complete
request_buffer[6] = 0x4;/* WCE on */
else
request_buffer[6] = 0x0;/* WCE off */
+   tw_transfer_internal(tw_dev, request_id, request_buffer,
+sizeof(request_buffer));
 
return 0;
 } /* End tw_scsiop_mode_sense_complete() */
@@ -1701,17 +1725,12 @@ static int tw_scsiop_read_capacity_compl
 {
unsigned char *param_data;
u32 capacity;
-   char *buff;
+   char buff[8];
TW_Param *param;
 
dprintk(KERN_NOTICE 3w-: tw_scsiop_read_capacity_complete()\n);
 
-   buff = tw_dev-srb[request_id]-request_buffer;
-   if (buff == NULL) {
-   printk(KERN_WARNING 3w-: 
tw_scsiop_read_capacity_complete(): Request buffer NULL.\n);
-   return 1;
-   }
-   memset(buff, 

[XFS] Fix sparse warnings in kmem_* functions Patch from Victor Fusco

2005-09-07 Thread Linux Kernel Mailing List
tree a86bef9269c786a073980749044fe495b730ea8d
parent 6f948fbd443255e3a918438ce41cd7581cf8146d
author Christoph Hellwig [EMAIL PROTECTED] Fri, 02 Sep 2005 16:56:02 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:56:02 +1000

[XFS] Fix sparse warnings in kmem_* functions  Patch from Victor Fusco
[EMAIL PROTECTED]

SGI-PV: 940376
SGI-Modid: xfs-linux:xfs-kern:196705a

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/kmem.c  |   23 ---
 fs/xfs/linux-2.6/kmem.h  |   23 ---
 fs/xfs/xfs_log_recover.c |2 +-
 3 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c
--- a/fs/xfs/linux-2.6/kmem.c
+++ b/fs/xfs/linux-2.6/kmem.c
@@ -45,11 +45,11 @@
 
 
 void *
-kmem_alloc(size_t size, int flags)
+kmem_alloc(size_t size, unsigned int __nocast flags)
 {
-   int retries = 0;
-   int lflags = kmem_flags_convert(flags);
-   void*ptr;
+   int retries = 0;
+   unsigned intlflags = kmem_flags_convert(flags);
+   void*ptr;
 
do {
if (size  MAX_SLAB_SIZE || retries  MAX_VMALLOCS)
@@ -67,7 +67,7 @@ kmem_alloc(size_t size, int flags)
 }
 
 void *
-kmem_zalloc(size_t size, int flags)
+kmem_zalloc(size_t size, unsigned int __nocast flags)
 {
void*ptr;
 
@@ -89,7 +89,8 @@ kmem_free(void *ptr, size_t size)
 }
 
 void *
-kmem_realloc(void *ptr, size_t newsize, size_t oldsize, int flags)
+kmem_realloc(void *ptr, size_t newsize, size_t oldsize,
+unsigned int __nocast flags)
 {
void*new;
 
@@ -104,11 +105,11 @@ kmem_realloc(void *ptr, size_t newsize, 
 }
 
 void *
-kmem_zone_alloc(kmem_zone_t *zone, int flags)
+kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags)
 {
-   int retries = 0;
-   int lflags = kmem_flags_convert(flags);
-   void*ptr;
+   int retries = 0;
+   unsigned intlflags = kmem_flags_convert(flags);
+   void*ptr;
 
do {
ptr = kmem_cache_alloc(zone, lflags);
@@ -123,7 +124,7 @@ kmem_zone_alloc(kmem_zone_t *zone, int f
 }
 
 void *
-kmem_zone_zalloc(kmem_zone_t *zone, int flags)
+kmem_zone_zalloc(kmem_zone_t *zone, unsigned int __nocast flags)
 {
void*ptr;
 
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
--- a/fs/xfs/linux-2.6/kmem.h
+++ b/fs/xfs/linux-2.6/kmem.h
@@ -39,10 +39,10 @@
 /*
  * memory management routines
  */
-#define KM_SLEEP   0x0001
-#define KM_NOSLEEP 0x0002
-#define KM_NOFS0x0004
-#define KM_MAYFAIL 0x0008
+#define KM_SLEEP   0x0001u
+#define KM_NOSLEEP 0x0002u
+#define KM_NOFS0x0004u
+#define KM_MAYFAIL 0x0008u
 
 #definekmem_zone   kmem_cache_s
 #define kmem_zone_tkmem_cache_t
@@ -81,9 +81,9 @@ typedef unsigned long xfs_pflags_t;
*(NSTATEP) = *(OSTATEP);\
 } while (0)
 
-static __inline unsigned int kmem_flags_convert(int flags)
+static __inline unsigned int kmem_flags_convert(unsigned int __nocast flags)
 {
-   int lflags = __GFP_NOWARN;  /* we'll report problems, if need be */
+   unsigned intlflags = __GFP_NOWARN;  /* we'll report problems, if 
need be */
 
 #ifdef DEBUG
if (unlikely(flags  ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL))) {
@@ -125,12 +125,13 @@ kmem_zone_destroy(kmem_zone_t *zone)
BUG();
 }
 
-extern void*kmem_zone_zalloc(kmem_zone_t *, int);
-extern void*kmem_zone_alloc(kmem_zone_t *, int);
+extern void*kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast);
+extern void*kmem_zone_alloc(kmem_zone_t *, unsigned int __nocast);
 
-extern void*kmem_alloc(size_t, int);
-extern void*kmem_realloc(void *, size_t, size_t, int);
-extern void*kmem_zalloc(size_t, int);
+extern void*kmem_alloc(size_t, unsigned int __nocast);
+extern void*kmem_realloc(void *, size_t, size_t,
+ unsigned int __nocast);
+extern void*kmem_zalloc(size_t, unsigned int __nocast);
 extern void kmem_free(void *, size_t);
 
 typedef struct shrinker *kmem_shaker_t;
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -1387,7 +1387,7 @@ xlog_recover_add_to_cont_trans(
old_ptr = item-ri_buf[item-ri_cnt-1].i_addr;
old_len = item-ri_buf[item-ri_cnt-1].i_len;
 
-   ptr = kmem_realloc(old_ptr, len+old_len, old_len, 0);
+   ptr = kmem_realloc(old_ptr, len+old_len, old_len, 0u);
memcpy(ptr[old_len], dp, len); /* d, s, l */
item-ri_buf[item-ri_cnt-1].i_len += len;
item-ri_buf[item-ri_cnt-1].i_addr = ptr;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo 

[SCSI] convert SPI transport class to scsi_execute

2005-09-07 Thread Linux Kernel Mailing List
tree dac741e1f3f43a1de2433a21b874a093783717f3
parent 1cf72699c1530c3e4ac3d58344f6a6a40a2f46d3
author James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:31:14 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:31:14 
-0500

[SCSI] convert SPI transport class to scsi_execute

This one's slightly more difficult.  The transport class uses
REQ_FAILFAST, so another interface (scsi_execute) had to be invented to
take the extra flag.  Also, the sense functions are shifted around to
allow spi_execute to place data directly into a struct scsi_sense_hdr.
With this change, there's probably a lot of unnecessary sense buffer
allocation going on which we can fix later.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/scsi_error.c |6 +
 drivers/scsi/scsi_lib.c   |   13 ++-
 drivers/scsi/scsi_transport_spi.c |  124 +-
 include/scsi/scsi_device.h|   13 +++
 include/scsi/scsi_eh.h|8 ++
 include/scsi/scsi_request.h   |4 -
 6 files changed, 90 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1847,12 +1847,16 @@ EXPORT_SYMBOL(scsi_reset_provider);
 int scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
  struct scsi_sense_hdr *sshdr)
 {
-   if (!sense_buffer || !sb_len || (sense_buffer[0]  0x70) != 0x70)
+   if (!sense_buffer || !sb_len)
return 0;
 
memset(sshdr, 0, sizeof(struct scsi_sense_hdr));
 
sshdr-response_code = (sense_buffer[0]  0x7f);
+
+   if (!scsi_sense_valid(sshdr))
+   return 0;
+
if (sshdr-response_code = 0x72) {
/*
 * descriptor format
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -282,7 +282,7 @@ void scsi_wait_req(struct scsi_request *
 EXPORT_SYMBOL(scsi_wait_req);
 
 /**
- * scsi_execute_req - insert request and wait for the result
+ * scsi_execute - insert request and wait for the result
  * @sdev:  scsi device
  * @cmd:   scsi command
  * @data_direction: data direction
@@ -291,13 +291,14 @@ EXPORT_SYMBOL(scsi_wait_req);
  * @sense: optional sense buffer
  * @timeout:   request timeout in seconds
  * @retries:   number of times to retry request
+ * @flags: or into request flags;
  *
  * scsi_execute_req returns the req-errors value which is the
  * the scsi_cmnd result field.
  **/
-int scsi_execute_req(struct scsi_device *sdev, unsigned char *cmd,
-int data_direction, void *buffer, unsigned bufflen,
-unsigned char *sense, int timeout, int retries)
+int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
+int data_direction, void *buffer, unsigned bufflen,
+unsigned char *sense, int timeout, int retries, int flags)
 {
struct request *req;
int write = (data_direction == DMA_TO_DEVICE);
@@ -314,7 +315,7 @@ int scsi_execute_req(struct scsi_device 
req-sense = sense;
req-sense_len = 0;
req-timeout = timeout;
-   req-flags |= REQ_BLOCK_PC | REQ_SPECIAL;
+   req-flags |= flags | REQ_BLOCK_PC | REQ_SPECIAL;
 
/*
 * head injection *required* here otherwise quiesce won't work
@@ -328,7 +329,7 @@ int scsi_execute_req(struct scsi_device 
return ret;
 }
 
-EXPORT_SYMBOL(scsi_execute_req);
+EXPORT_SYMBOL(scsi_execute);
 
 /*
  * Function:scsi_init_cmd_errh()
diff --git a/drivers/scsi/scsi_transport_spi.c 
b/drivers/scsi/scsi_transport_spi.c
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -28,7 +28,7 @@
 #include scsi_priv.h
 #include scsi/scsi_device.h
 #include scsi/scsi_host.h
-#include scsi/scsi_request.h
+#include scsi/scsi_cmnd.h
 #include scsi/scsi_eh.h
 #include scsi/scsi_transport.h
 #include scsi/scsi_transport_spi.h
@@ -108,25 +108,33 @@ static int sprint_frac(char *dest, int v
 
 /* Modification of scsi_wait_req that will clear UNIT ATTENTION conditions
  * resulting from (likely) bus and device resets */
-static void spi_wait_req(struct scsi_request *sreq, const void *cmd,
-void *buffer, unsigned bufflen)
+static int spi_execute(struct scsi_device *sdev, const void *cmd,
+  enum dma_data_direction dir,
+  void *buffer, unsigned bufflen,
+  struct scsi_sense_hdr *sshdr)
 {
-   int i;
+   int i, result;
+   unsigned char sense[SCSI_SENSE_BUFFERSIZE];
 
for(i = 0; i  DV_RETRIES; i++) {
-   sreq-sr_request-flags |= REQ_FAILFAST;
-
-   scsi_wait_req(sreq, cmd, buffer, bufflen,
- DV_TIMEOUT, /* retries */ 1);
-   if (sreq-sr_result  DRIVER_SENSE) {
-   struct 

[XFS] Add a chunk of tracing code to diagnose truncate related issues.

2005-09-07 Thread Linux Kernel Mailing List
tree 9eee863e455b22d18727610e09ff8111af9d62e9
parent eedb5530aad71aecbc1e99cb67f676c26280d3f9
author Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:40:17 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:40:17 +1000

[XFS] Add a chunk of tracing code to diagnose truncate related issues.

SGI-PV: 938410
SGI-Modid: xfs-linux:xfs-kern:22966a

Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_aops.c |   11 +++
 fs/xfs/linux-2.6/xfs_lrw.h  |7 ---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1202,6 +1202,16 @@ out_unlock:
return error;
 }
 
+STATIC int
+linvfs_invalidate_page(
+   struct page *page,
+   unsigned long   offset)
+{
+   xfs_page_trace(XFS_INVALIDPAGE_ENTER,
+   page-mapping-host, page, offset);
+   return block_invalidatepage(page, offset);
+}
+
 /*
  * Called to move a page into cleanable state - and from there
  * to be released. Possibly the page is already clean. We always
@@ -1279,6 +1289,7 @@ struct address_space_operations linvfs_a
.writepage  = linvfs_writepage,
.sync_page  = block_sync_page,
.releasepage= linvfs_release_page,
+   .invalidatepage = linvfs_invalidate_page,
.prepare_write  = linvfs_prepare_write,
.commit_write   = generic_commit_write,
.bmap   = linvfs_bmap,
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
--- a/fs/xfs/linux-2.6/xfs_lrw.h
+++ b/fs/xfs/linux-2.6/xfs_lrw.h
@@ -70,9 +70,10 @@ struct xfs_iomap;
 #defineXFS_SENDFILE_ENTER  21
 #defineXFS_WRITEPAGE_ENTER 22
 #defineXFS_RELEASEPAGE_ENTER   23
-#defineXFS_IOMAP_ALLOC_ENTER   24
-#defineXFS_IOMAP_ALLOC_MAP 25
-#defineXFS_IOMAP_UNWRITTEN 26
+#defineXFS_INVALIDPAGE_ENTER   24
+#defineXFS_IOMAP_ALLOC_ENTER   25
+#defineXFS_IOMAP_ALLOC_MAP 26
+#defineXFS_IOMAP_UNWRITTEN 27
 extern void xfs_rw_enter_trace(int, struct xfs_iocore *,
void *, size_t, loff_t, int);
 extern void xfs_inval_cached_trace(struct xfs_iocore *,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


drm: fix MGA on non AGP systems

2005-09-07 Thread Linux Kernel Mailing List
tree dafb80d522ac9319d4485eb9d189e28c74efa6f0
parent f210973bb6d17aa220c797e8ea23d127d96859b7
author Dave Airlie [EMAIL PROTECTED](none) Mon, 05 Sep 2005 21:51:30 +1000
committer Dave Airlie [EMAIL PROTECTED] Mon, 05 Sep 2005 21:51:30 +1000

drm: fix MGA on non AGP systems

Al Viro noticed that MGA wouldn't build on non AGP systems.

Signed-off-by: Dave Airlie [EMAIL PROTECTED]

 drivers/char/drm/mga_dma.c |   14 +++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c
--- a/drivers/char/drm/mga_dma.c
+++ b/drivers/char/drm/mga_dma.c
@@ -417,6 +417,7 @@ int mga_driver_preinit(drm_device_t *dev
return 0;
 }
 
+#if __OS_HAS_AGP
 /**
  * Bootstrap the driver for AGP DMA.
  * 
@@ -560,6 +561,13 @@ static int mga_do_agp_dma_bootstrap(drm_
DRM_INFO(Initialized card for AGP DMA.\n);
return 0;
 }
+#else
+static int mga_do_agp_dma_bootstrap(drm_device_t * dev,
+   drm_mga_dma_bootstrap_t * dma_bs)
+{
+   return -EINVAL;
+}
+#endif
 
 /**
  * Bootstrap the driver for PCI DMA.
@@ -697,7 +705,6 @@ static int mga_do_dma_bootstrap(drm_devi
 * carve off portions of it for internal uses.  The remaining memory
 * is returned to user-mode to be used for AGP textures.
 */
-
if (is_agp) {
err = mga_do_agp_dma_bootstrap(dev, dma_bs);
}
@@ -932,6 +939,7 @@ static int mga_do_cleanup_dma( drm_devic
drm_core_ioremapfree(dev-agp_buffer_map, dev);
 
if (dev_priv-used_new_dma_init) {
+#if __OS_HAS_AGP
if (dev_priv-agp_mem != NULL) {
dev_priv-agp_textures = NULL;
drm_unbind_agp(dev_priv-agp_mem);
@@ -944,7 +952,7 @@ static int mga_do_cleanup_dma( drm_devic
if ((dev-agp != NULL)  dev-agp-acquired) {
err = drm_agp_release(dev);
}
-
+#endif
dev_priv-used_new_dma_init = 0;
}
 
@@ -965,7 +973,7 @@ static int mga_do_cleanup_dma( drm_devic
}
}
 
-   return 0;
+   return err;
 }
 
 int mga_dma_init( DRM_IOCTL_ARGS )
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] send dmapi events from nopage for mmapped files

2005-09-07 Thread Linux Kernel Mailing List
tree e7943d759656f73490668226b8b1580cb6a47c92
parent 536388be42c938fb6d0eece681526ce13bb50aab
author Dean Roehrich [EMAIL PROTECTED] Fri, 02 Sep 2005 15:43:05 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 15:43:05 +1000

[XFS] send dmapi events from nopage for mmapped files

SGI-PV: 935317
SGI-Modid: xfs-linux:xfs-kern:192007a

Signed-off-by: Dean Roehrich [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_file.c |   90 +++-
 1 files changed, 32 insertions(+), 58 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -311,6 +311,31 @@ linvfs_fsync(
 
 #define nextdp(dp)  ((struct xfs_dirent *)((char *)(dp) + (dp)-d_reclen))
 
+#ifdef CONFIG_XFS_DMAPI
+
+STATIC struct page *
+linvfs_filemap_nopage(
+   struct vm_area_struct   *area,
+   unsigned long   address,
+   int *type)
+{
+   struct inode*inode = area-vm_file-f_dentry-d_inode;
+   vnode_t *vp = LINVFS_GET_VP(inode);
+   xfs_mount_t *mp = XFS_VFSTOM(vp-v_vfsp);
+   int error;
+
+   ASSERT_ALWAYS(vp-v_vfsp-vfs_flag  VFS_DMI);
+
+   error = XFS_SEND_MMAP(mp, area, 0);
+   if (error)
+   return NULL;
+
+   return filemap_nopage(area, address, type);
+}
+
+#endif /* CONFIG_XFS_DMAPI */
+
+
 STATIC int
 linvfs_readdir(
struct file *filp,
@@ -390,14 +415,6 @@ done:
return -error;
 }
 
-#ifdef CONFIG_XFS_DMAPI
-STATIC void
-linvfs_mmap_close(
-   struct vm_area_struct   *vma)
-{
-   xfs_dm_mm_put(vma);
-}
-#endif /* CONFIG_XFS_DMAPI */
 
 STATIC int
 linvfs_file_mmap(
@@ -411,16 +428,11 @@ linvfs_file_mmap(
 
vma-vm_ops = linvfs_file_vm_ops;
 
-   if (vp-v_vfsp-vfs_flag  VFS_DMI) {
-   xfs_mount_t *mp = XFS_VFSTOM(vp-v_vfsp);
-
-   error = -XFS_SEND_MMAP(mp, vma, 0);
-   if (error)
-   return error;
 #ifdef CONFIG_XFS_DMAPI
+   if (vp-v_vfsp-vfs_flag  VFS_DMI) {
vma-vm_ops = linvfs_dmapi_file_vm_ops;
-#endif
}
+#endif /* CONFIG_XFS_DMAPI */
 
VOP_SETATTR(vp, va, XFS_AT_UPDATIME, NULL, error);
if (!error)
@@ -474,6 +486,7 @@ linvfs_ioctl_invis(
return error;
 }
 
+#ifdef CONFIG_XFS_DMAPI
 #ifdef HAVE_VMOP_MPROTECT
 STATIC int
 linvfs_mprotect(
@@ -494,6 +507,7 @@ linvfs_mprotect(
return error;
 }
 #endif /* HAVE_VMOP_MPROTECT */
+#endif /* CONFIG_XFS_DMAPI */
 
 #ifdef HAVE_FOP_OPEN_EXEC
 /* If the user is attempting to execute a file that is offline then
@@ -528,49 +542,10 @@ open_exec_out:
 }
 #endif /* HAVE_FOP_OPEN_EXEC */
 
-/*
- * Temporary workaround to the AIO direct IO write problem.
- * This code can go and we can revert to do_sync_write once
- * the writepage(s) rework is merged.
- */
-STATIC ssize_t
-linvfs_write(
-   struct file *filp,
-   const char  __user *buf,
-   size_t  len,
-   loff_t  *ppos)
-{
-   struct kiocbkiocb;
-   ssize_t ret;
-
-   init_sync_kiocb(kiocb, filp);
-   kiocb.ki_pos = *ppos;
-   ret = __linvfs_write(kiocb, buf, 0, len, kiocb.ki_pos);
-   *ppos = kiocb.ki_pos;
-   return ret;
-}
-STATIC ssize_t
-linvfs_write_invis(
-   struct file *filp,
-   const char  __user *buf,
-   size_t  len,
-   loff_t  *ppos)
-{
-   struct kiocbkiocb;
-   ssize_t ret;
-
-   init_sync_kiocb(kiocb, filp);
-   kiocb.ki_pos = *ppos;
-   ret = __linvfs_write(kiocb, buf, IO_INVIS, len, kiocb.ki_pos);
-   *ppos = kiocb.ki_pos;
-   return ret;
-}
-
-
 struct file_operations linvfs_file_operations = {
.llseek = generic_file_llseek,
.read   = do_sync_read,
-   .write  = linvfs_write,
+   .write  = do_sync_write,
.readv  = linvfs_readv,
.writev = linvfs_writev,
.aio_read   = linvfs_aio_read,
@@ -592,7 +567,7 @@ struct file_operations linvfs_file_opera
 struct file_operations linvfs_invis_file_operations = {
.llseek = generic_file_llseek,
.read   = do_sync_read,
-   .write  = linvfs_write_invis,
+   .write  = do_sync_write,
.readv  = linvfs_readv_invis,
.writev = linvfs_writev_invis,
.aio_read   = linvfs_aio_read_invis,
@@ -626,8 +601,7 @@ static struct vm_operations_struct linvf
 
 #ifdef CONFIG_XFS_DMAPI
 static struct vm_operations_struct linvfs_dmapi_file_vm_ops = {
-   .close  = linvfs_mmap_close,
-   .nopage = filemap_nopage,
+   .nopage = linvfs_filemap_nopage,
.populate   = filemap_populate,
 #ifdef HAVE_VMOP_MPROTECT
.mprotect   = linvfs_mprotect,
-
To unsubscribe from 

[XFS] upate copyrights

2005-09-07 Thread Linux Kernel Mailing List
tree f7727545f1a9e223987127d3001ade533c8c8cd5
parent 616b1c7238f0de5cec12045267a924035f8ed317
author Dean Roehrich [EMAIL PROTECTED] Fri, 02 Sep 2005 15:35:43 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 15:35:43 +1000

[XFS] upate copyrights

SGI-PV: 933765
SGI-Modid: xfs-linux:xfs-kern:190760a

Signed-off-by: Dean Roehrich [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_vnode.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] Need to unlock the AIL before calling xfs_force_shutdown() because

2005-09-07 Thread Linux Kernel Mailing List
tree 86927e218d4ff43672847732f7756f997a01bcfb
parent 0432dab2d2d3b35347a95c01c78a40781b6431fb
author Tim Shimmin [EMAIL PROTECTED] Fri, 02 Sep 2005 16:52:55 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:52:55 +1000

[XFS] Need to unlock the AIL before calling xfs_force_shutdown() because
when it goes to force out the log, and get the tail lsn, it will want to
get the AIL lock.

SGI-PV: 940076
SGI-Modid: xfs-linux:xfs-kern:23260a

Signed-off-by: Tim Shimmin [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/xfs_trans_ail.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -379,8 +379,8 @@ xfs_trans_delete_ail(
else {
xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp,
xfs_trans_delete_ail: attempting to delete a 
log item that is not in the AIL);
-   xfs_force_shutdown(mp, XFS_CORRUPT_INCORE);
AIL_UNLOCK(mp, s);
+   xfs_force_shutdown(mp, XFS_CORRUPT_INCORE);
}
}
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] convert ch to use scsi_execute_req

2005-09-07 Thread Linux Kernel Mailing List
tree a7cf1382f4f77be9e428a7982f7a90f9c0589816
parent 820732b501a5bbdd3bde1263f391891e21b5ed8c
author James Bottomley [EMAIL PROTECTED] Mon, 13 Jun 2005 08:37:10 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:34:08 
-0500

[SCSI] convert ch to use scsi_execute_req

I also tinkered with it's sense recognition routines to make them take
scsi_sense_hdr structures instead of raw sense data.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/ch.c |   38 +-
 1 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -30,7 +30,7 @@
 #include scsi/scsi_ioctl.h
 #include scsi/scsi_host.h
 #include scsi/scsi_device.h
-#include scsi/scsi_request.h
+#include scsi/scsi_eh.h
 #include scsi/scsi_dbg.h
 
 #define CH_DT_MAX   16
@@ -180,17 +180,17 @@ static struct {
 
 /* --- */
 
-static int ch_find_errno(unsigned char *sense_buffer)
+static int ch_find_errno(struct scsi_sense_hdr *sshdr)
 {
int i,errno = 0;
 
/* Check to see if additional sense information is available */
-   if (sense_buffer[7]   5 
-   sense_buffer[12] != 0) {
+   if (scsi_sense_valid(sshdr) 
+   sshdr-asc != 0) {
for (i = 0; err[i].errno != 0; i++) {
-   if (err[i].sense == sense_buffer[ 2] 
-   err[i].asc   == sense_buffer[12] 
-   err[i].ascq  == sense_buffer[13]) {
+   if (err[i].sense == sshdr-sense_key 
+   err[i].asc   == sshdr-asc 
+   err[i].ascq  == sshdr-ascq) {
errno = -err[i].errno;
break;
}
@@ -206,13 +206,9 @@ ch_do_scsi(scsi_changer *ch, unsigned ch
   void *buffer, unsigned buflength,
   enum dma_data_direction direction)
 {
-   int errno, retries = 0, timeout;
-   struct scsi_request *sr;
+   int errno, retries = 0, timeout, result;
+   struct scsi_sense_hdr sshdr;

-   sr = scsi_allocate_request(ch-device, GFP_KERNEL);
-   if (NULL == sr)
-   return -ENOMEM;
-
timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS)
? timeout_init : timeout_move;
 
@@ -223,16 +219,17 @@ ch_do_scsi(scsi_changer *ch, unsigned ch
__scsi_print_command(cmd);
}
 
-scsi_wait_req(sr, cmd, buffer, buflength,
- timeout * HZ, MAX_RETRIES);
+result = scsi_execute_req(ch-device, cmd, direction, buffer,
+ buflength, sshdr, timeout * HZ,
+ MAX_RETRIES);
 
-   dprintk(result: 0x%x\n,sr-sr_result);
-   if (driver_byte(sr-sr_result)  DRIVER_SENSE) {
+   dprintk(result: 0x%x\n,result);
+   if (driver_byte(result)  DRIVER_SENSE) {
if (debug)
-   scsi_print_req_sense(ch-name, sr);
-   errno = ch_find_errno(sr-sr_sense_buffer);
+   scsi_print_sense_hdr(ch-name, sshdr);
+   errno = ch_find_errno(sshdr);
 
-   switch(sr-sr_sense_buffer[2]  0xf) {
+   switch(sshdr.sense_key) {
case UNIT_ATTENTION:
ch-unit_attention = 1;
if (retries++  3)
@@ -240,7 +237,6 @@ ch_do_scsi(scsi_changer *ch, unsigned ch
break;
}
}
-   scsi_release_request(sr);
return errno;
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] libata: Marvell SATA support (PIO mode)

2005-09-07 Thread Linux Kernel Mailing List
tree 6d67e9dbcbc615d00881f466b0ad2b9fc1349e00
parent 7da79312830e6d9b3f6ee06b86c3a35caba2f6e7
author Brett Russ [EMAIL PROTECTED] Fri, 02 Sep 2005 02:26:17 -0400
committer Jeff Garzik [EMAIL PROTECTED] Wed, 07 Sep 2005 09:56:09 -0400

[PATCH] libata: Marvell SATA support (PIO mode)

This is my libata compatible low level driver for the Marvell SATA
family.  Currently it successfully runs in PIO mode on a 6081 chip.
EDMA support is in the works and should be done shortly.  Review,
testing (especially on other flavors of Marvell), comments welcome.

Signed-off-by: Brett Russ [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]

 drivers/scsi/Kconfig   |9 
 drivers/scsi/Makefile  |1 
 drivers/scsi/sata_mv.c |  827 +
 3 files changed, 837 insertions(+)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -459,6 +459,15 @@ config SCSI_ATA_PIIX
 
  If unsure, say N.
 
+config SCSI_SATA_MV
+   tristate Marvell SATA support
+   depends on SCSI_SATA  PCI  EXPERIMENTAL
+   help
+ This option enables support for the Marvell Serial ATA family.
+ Currently supports 88SX[56]0[48][01] chips.
+
+ If unsure, say N.
+
 config SCSI_SATA_NV
tristate NVIDIA SATA support
depends on SCSI_SATA  PCI  EXPERIMENTAL
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -132,6 +132,7 @@ obj-$(CONFIG_SCSI_SATA_SIS) += libata.o 
 obj-$(CONFIG_SCSI_SATA_SX4)+= libata.o sata_sx4.o
 obj-$(CONFIG_SCSI_SATA_NV) += libata.o sata_nv.o
 obj-$(CONFIG_SCSI_SATA_ULI)+= libata.o sata_uli.o
+obj-$(CONFIG_SCSI_SATA_MV) += libata.o sata_mv.o
 
 obj-$(CONFIG_ARM)  += arm/
 
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
new file mode 100644
--- /dev/null
+++ b/drivers/scsi/sata_mv.c
@@ -0,0 +1,827 @@
+/*
+ * sata_mv.c - Marvell SATA support
+ *
+ * Copyright 2005: EMC Corporation, all rights reserved. 
+ *
+ * Please ALWAYS copy linux-ide@vger.kernel.org on emails.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/pci.h
+#include linux/init.h
+#include linux/blkdev.h
+#include linux/delay.h
+#include linux/interrupt.h
+#include linux/sched.h
+#include linux/dma-mapping.h
+#include scsi.h
+#include scsi/scsi_host.h
+#include linux/libata.h
+#include asm/io.h
+
+#define DRV_NAME   sata_mv
+#define DRV_VERSION0.12
+
+enum {
+   /* BAR's are enumerated in terms of pci_resource_start() terms */
+   MV_PRIMARY_BAR  = 0,/* offset 0x10: memory space */
+   MV_IO_BAR   = 2,/* offset 0x18: IO space */
+   MV_MISC_BAR = 3,/* offset 0x1c: FLASH, NVRAM, SRAM */
+
+   MV_MAJOR_REG_AREA_SZ= 0x1,  /* 64KB */
+   MV_MINOR_REG_AREA_SZ= 0x2000,   /* 8KB */
+
+   MV_PCI_REG_BASE = 0,
+   MV_IRQ_COAL_REG_BASE= 0x18000,  /* 6xxx part only */
+   MV_SATAHC0_REG_BASE = 0x2,
+
+   MV_PCI_REG_SZ   = MV_MAJOR_REG_AREA_SZ,
+   MV_SATAHC_REG_SZ= MV_MAJOR_REG_AREA_SZ,
+   MV_SATAHC_ARBTR_REG_SZ  = MV_MINOR_REG_AREA_SZ, /* arbiter */
+   MV_PORT_REG_SZ  = MV_MINOR_REG_AREA_SZ,
+
+   MV_Q_CT = 32,
+   MV_CRQB_SZ  = 32,
+   MV_CRPB_SZ  = 8,
+
+   MV_DMA_BOUNDARY = 0xU,
+   SATAHC_MASK = (~(MV_SATAHC_REG_SZ - 1)),
+
+   MV_PORTS_PER_HC = 4,
+   /* == (port / MV_PORTS_PER_HC) to determine HC from 0-7 port */
+   MV_PORT_HC_SHIFT= 2,
+   /* == (port % MV_PORTS_PER_HC) to determine port from 0-7 port */
+   MV_PORT_MASK= 3,
+
+   /* Host Flags */
+   MV_FLAG_DUAL_HC = (1  30),  /* two SATA Host Controllers */
+   MV_FLAG_IRQ_COALESCE= (1  29),  /* IRQ coalescing capability */
+   MV_FLAG_BDMA= (1  28),  /* Basic DMA */
+
+   chip_504x   = 0,
+   chip_508x   = 1,
+   chip_604x   = 2,
+   chip_608x   = 3,
+
+   /* PCI interface registers */
+
+   PCI_MAIN_CMD_STS_OFS= 0xd30,
+   

[SCSI] quieten messages on scsi_execute commands

2005-09-07 Thread Linux Kernel Mailing List
tree 6dc8162d8b68e0b66846bf7e2ed015eb60d48378
parent ba482ef4b16bad5172d2be693d4b2420b84c84e7
author James Bottomley [EMAIL PROTECTED] Sun, 04 Sep 2005 21:32:05 -0500
committer James Bottomley [EMAIL PROTECTED](none) Wed, 07 Sep 2005 03:37:57 
-0500

[SCSI] quieten messages on scsi_execute commands

scsi_io_completion() can be a bit noisy about certain conditions.
Previously this wasn't a problem for internally generated commands,
since they never hit it.  However, since we do all SCSI commands via
bios, now they do.  user CD testers like magicdev are now getting not
ready messages every time they touch the CD to see if there's anything
in it.

Fix this by making all scsi_execute commands REQ_QUIET and making
scsi_finish_io() not say anything for REQ_QUIET.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/scsi_lib.c |   35 ++-
 1 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -315,7 +315,7 @@ int scsi_execute(struct scsi_device *sde
req-sense = sense;
req-sense_len = 0;
req-timeout = timeout;
-   req-flags |= flags | REQ_BLOCK_PC | REQ_SPECIAL;
+   req-flags |= flags | REQ_BLOCK_PC | REQ_SPECIAL | REQ_QUIET;
 
/*
 * head injection *required* here otherwise quiesce won't work
@@ -927,17 +927,20 @@ void scsi_io_completion(struct scsi_cmnd
scsi_requeue_command(q, cmd);
return;
}
-   printk(KERN_INFO Device %s not ready.\n,
-  req-rq_disk ? req-rq_disk-disk_name : );
+   if (!(req-flags  REQ_QUIET))
+   dev_printk(KERN_INFO,
+  cmd-device-sdev_gendev,
+  Device not ready.\n);
cmd = scsi_end_request(cmd, 0, this_count, 1);
return;
case VOLUME_OVERFLOW:
-   printk(KERN_INFO Volume overflow %d %d %d %d CDB: ,
-  cmd-device-host-host_no,
-  (int)cmd-device-channel,
-  (int)cmd-device-id, (int)cmd-device-lun);
-   __scsi_print_command(cmd-data_cmnd);
-   scsi_print_sense(, cmd);
+   if (!(req-flags  REQ_QUIET)) {
+   dev_printk(KERN_INFO,
+  cmd-device-sdev_gendev,
+  Volume overflow, CDB: );
+   __scsi_print_command(cmd-data_cmnd);
+   scsi_print_sense(, cmd);
+   }
cmd = scsi_end_request(cmd, 0, block_bytes, 1);
return;
default:
@@ -954,15 +957,13 @@ void scsi_io_completion(struct scsi_cmnd
return;
}
if (result) {
-   if (!(req-flags  REQ_SPECIAL))
-   printk(KERN_INFO SCSI error : %d %d %d %d return 
code 
-  = 0x%x\n, cmd-device-host-host_no,
-  cmd-device-channel,
-  cmd-device-id,
-  cmd-device-lun, result);
+   if (!(req-flags  REQ_QUIET)) {
+   dev_printk(KERN_INFO, cmd-device-sdev_gendev,
+  SCSI error: return code = 0x%x\n, result);
 
-   if (driver_byte(result)  DRIVER_SENSE)
-   scsi_print_sense(, cmd);
+   if (driver_byte(result)  DRIVER_SENSE)
+   scsi_print_sense(, cmd);
+   }
/*
 * Mark a single buffer as not uptodate.  Queue the remainder.
 * We sometimes get this cruft in the event that a medium error
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[libata sata_mv] fix build

2005-09-07 Thread Linux Kernel Mailing List
tree c306097b64ec6c647354cb4cd420d49efd293e78
parent 20f733e7d75a16bffc34842b7682c9247dd5f954
author Jeff Garzik [EMAIL PROTECTED] Wed, 07 Sep 2005 10:05:59 -0400
committer Jeff Garzik [EMAIL PROTECTED] Wed, 07 Sep 2005 10:05:59 -0400

[libata sata_mv] fix build

This function will go away when pci_intx() finally makes it
into the core PCI layer.

 drivers/scsi/sata_mv.c |   16 
 1 files changed, 16 insertions(+)

diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -699,6 +699,22 @@ static int mv_host_init(struct ata_probe
return rc;
 }
 
+/* move to PCI layer, integrate w/ MSI stuff */
+static void pci_intx(struct pci_dev *pdev, int enable)
+{
+   u16 pci_command, new;
+
+   pci_read_config_word(pdev, PCI_COMMAND, pci_command);
+
+   if (enable)
+   new = pci_command  ~PCI_COMMAND_INTX_DISABLE;
+   else
+   new = pci_command | PCI_COMMAND_INTX_DISABLE;
+
+   if (new != pci_command)
+   pci_write_config_word(pdev, PCI_COMMAND, pci_command);
+}
+
 static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
static int printed_version = 0;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] convert sr to scsi_execute_req

2005-09-07 Thread Linux Kernel Mailing List
tree caf927bfbc9bd83ae0812e02d59456117106c97c
parent ea73a9f23906c374b697cd5b0d64f6dceced63de
author James Bottomley [EMAIL PROTECTED] Mon, 13 Jun 2005 08:21:29 -0500
committer James Bottomley [EMAIL PROTECTED](none) Sun, 28 Aug 2005 21:34:07 
-0500

[SCSI] convert sr to scsi_execute_req

This follows almost the identical model to sd, except that there's one
ioctl which returns raw sense data, so it had to use scsi_execute()
instead.

Signed-off-by: James Bottomley [EMAIL PROTECTED]

 drivers/scsi/sr.c   |   49 +++--
 drivers/scsi/sr_ioctl.c |   62 
 2 files changed, 37 insertions(+), 74 deletions(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -50,10 +50,10 @@
 #include scsi/scsi_dbg.h
 #include scsi/scsi_device.h
 #include scsi/scsi_driver.h
+#include scsi/scsi_cmnd.h
 #include scsi/scsi_eh.h
 #include scsi/scsi_host.h
 #include scsi/scsi_ioctl.h   /* For the door lock/unlock commands */
-#include scsi/scsi_request.h
 
 #include scsi_logging.h
 #include sr.h
@@ -658,39 +658,27 @@ static void get_sectorsize(struct scsi_c
unsigned char *buffer;
int the_result, retries = 3;
int sector_size;
-   struct scsi_request *SRpnt = NULL;
request_queue_t *queue;
 
buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
if (!buffer)
goto Enomem;
-   SRpnt = scsi_allocate_request(cd-device, GFP_KERNEL);
-   if (!SRpnt)
-   goto Enomem;
 
do {
cmd[0] = READ_CAPACITY;
memset((void *) cmd[1], 0, 9);
-   /* Mark as really busy */
-   SRpnt-sr_request-rq_status = RQ_SCSI_BUSY;
-   SRpnt-sr_cmd_len = 0;
-
memset(buffer, 0, 8);
 
/* Do the command and wait.. */
-   SRpnt-sr_data_direction = DMA_FROM_DEVICE;
-   scsi_wait_req(SRpnt, (void *) cmd, (void *) buffer,
- 8, SR_TIMEOUT, MAX_RETRIES);
+   the_result = scsi_execute_req(cd-device, cmd, DMA_FROM_DEVICE,
+ buffer, 8, NULL, SR_TIMEOUT,
+ MAX_RETRIES);
 
-   the_result = SRpnt-sr_result;
retries--;
 
} while (the_result  retries);
 
 
-   scsi_release_request(SRpnt);
-   SRpnt = NULL;
-
if (the_result) {
cd-capacity = 0x1f;
sector_size = 2048; /* A guess, just in case */
@@ -750,8 +738,6 @@ Enomem:
cd-capacity = 0x1f;
sector_size = 2048; /* A guess, just in case */
cd-needs_sector_size = 1;
-   if (SRpnt)
-   scsi_release_request(SRpnt);
goto out;
 }
 
@@ -759,8 +745,8 @@ static void get_capabilities(struct scsi
 {
unsigned char *buffer;
struct scsi_mode_data data;
-   struct scsi_request *SRpnt;
unsigned char cmd[MAX_COMMAND_SIZE];
+   struct scsi_sense_hdr sshdr;
unsigned int the_result;
int retries, rc, n;
 
@@ -776,19 +762,11 @@ static void get_capabilities(struct scsi

};
 
-   /* allocate a request for the TEST_UNIT_READY */
-   SRpnt = scsi_allocate_request(cd-device, GFP_KERNEL);
-   if (!SRpnt) {
-   printk(KERN_WARNING (get_capabilities:) Request allocation 
-  failure.\n);
-   return;
-   }
 
/* allocate transfer buffer */
buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
if (!buffer) {
printk(KERN_ERR sr: out of memory.\n);
-   scsi_release_request(SRpnt);
return;
}
 
@@ -800,20 +778,15 @@ static void get_capabilities(struct scsi
memset((void *)cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = TEST_UNIT_READY;
 
-   SRpnt-sr_cmd_len = 0;
-   SRpnt-sr_sense_buffer[0] = 0;
-   SRpnt-sr_sense_buffer[2] = 0;
-   SRpnt-sr_data_direction = DMA_NONE;
-
-   scsi_wait_req (SRpnt, (void *) cmd, buffer,
-  0, SR_TIMEOUT, MAX_RETRIES);
+   the_result = scsi_execute_req (cd-device, cmd, DMA_NONE, NULL,
+  0, sshdr, SR_TIMEOUT,
+  MAX_RETRIES);
 
-   the_result = SRpnt-sr_result;
retries++;
} while (retries  5  
 (!scsi_status_is_good(the_result) ||
- ((driver_byte(the_result)  DRIVER_SENSE) 
-  SRpnt-sr_sense_buffer[2] == UNIT_ATTENTION)));
+ (scsi_sense_valid(sshdr) 
+  sshdr.sense_key == UNIT_ATTENTION)));
 
/* ask for mode page 0x2a */
rc = scsi_mode_sense(cd-device, 0, 0x2a, buffer, 128,
@@ -825,7 +798,6 @@ static void 

drm: fix issue with handle lookup for a 0 handle

2005-09-07 Thread Linux Kernel Mailing List
tree 0e5bf395d8c53fcfaf0790b417666a8dabae8a8e
parent f505380ba7b98ec97bf25300c2a58aeae903530b
author Dave Airlie [EMAIL PROTECTED](none) Mon, 05 Sep 2005 21:23:23 +1000
committer Dave Airlie [EMAIL PROTECTED] Mon, 05 Sep 2005 21:23:23 +1000

drm: fix issue with handle lookup for a 0 handle

On 32-bit PPC a 0 handle is valid for AGP space, the 32/64 lookup
doesn't handle 0 correctly.

From: Ben Herrenschmidt [EMAIL PROTECTED] and Paul Mackerras [EMAIL 
PROTECTED]
Signed-off-by: Dave Airlie [EMAIL PROTECTED]

 drivers/char/drm/drm_bufs.c |   64 ++--
 1 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -48,8 +48,8 @@ unsigned long drm_get_resource_len(drm_d
 }
 EXPORT_SYMBOL(drm_get_resource_len);
 
-static drm_local_map_t *drm_find_matching_map(drm_device_t *dev,
- drm_local_map_t *map)
+static drm_map_list_t *drm_find_matching_map(drm_device_t *dev,
+drm_local_map_t *map)
 {
struct list_head *list;
 
@@ -57,7 +57,7 @@ static drm_local_map_t *drm_find_matchin
drm_map_list_t *entry = list_entry(list, drm_map_list_t, head);
if (entry-map  map-type == entry-map-type 
entry-map-offset == map-offset) {
-   return entry-map;
+   return entry;
}
}
 
@@ -114,14 +114,13 @@ static __inline__ unsigned int HandleID(
  * type.  Adds the map to the map list drm_device::maplist. Adds MTRR's where
  * applicable and if supported by the kernel.
  */
-int drm_addmap(drm_device_t * dev, unsigned int offset,
-  unsigned int size, drm_map_type_t type,
-  drm_map_flags_t flags, drm_local_map_t ** map_ptr)
+int drm_addmap_core(drm_device_t * dev, unsigned int offset,
+   unsigned int size, drm_map_type_t type,
+   drm_map_flags_t flags, drm_map_list_t **maplist)
 {
drm_map_t *map;
drm_map_list_t *list;
drm_dma_handle_t *dmah;
-   drm_local_map_t *found_map;
 
map = drm_alloc( sizeof(*map), DRM_MEM_MAPS );
if ( !map )
@@ -166,17 +165,17 @@ int drm_addmap(drm_device_t * dev, unsig
 * needing to be aware of it.  Therefore, we just return success
 * when the server tries to create a duplicate map.
 */
-   found_map = drm_find_matching_map(dev, map);
-   if (found_map != NULL) {
-   if (found_map-size != map-size) {
+   list = drm_find_matching_map(dev, map);
+   if (list != NULL) {
+   if (list-map-size != map-size) {
DRM_DEBUG(Matching maps of type %d with 
   mismatched sizes, (%ld vs %ld)\n,
-   map-type, map-size, found_map-size);
-   found_map-size = map-size;
+   map-type, map-size, list-map-size);
+   list-map-size = map-size;
}
 
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
-   *map_ptr = found_map;
+   *maplist = list;
return 0;
}
 
@@ -264,9 +263,22 @@ int drm_addmap(drm_device_t * dev, unsig
: map-offset, dev);
up(dev-struct_sem);
 
-   *map_ptr = map;
+   *maplist = list;
return 0;
 }
+
+int drm_addmap(drm_device_t *dev, unsigned int offset,
+  unsigned int size, drm_map_type_t type,
+  drm_map_flags_t flags, drm_local_map_t **map_ptr)
+{
+   drm_map_list_t *list;
+   int rc;
+
+   rc = drm_addmap_core(dev, offset, size, type, flags, list);
+   if (!rc)
+   *map_ptr = list-map;
+   return rc;
+}
 EXPORT_SYMBOL(drm_addmap);
 
 int drm_addmap_ioctl(struct inode *inode, struct file *filp,
@@ -275,10 +287,9 @@ int drm_addmap_ioctl(struct inode *inode
drm_file_t *priv = filp-private_data;
drm_device_t *dev = priv-head-dev;
drm_map_t map;
-   drm_map_t *map_ptr;
+   drm_map_list_t *maplist;
drm_map_t __user *argp = (void __user *)arg;
int err;
-   unsigned long handle = 0;
 
if (!(filp-f_mode  3))
return -EACCES; /* Require read/write */
@@ -287,26 +298,15 @@ int drm_addmap_ioctl(struct inode *inode
return -EFAULT;
}
 
-   err = drm_addmap(dev, map.offset, map.size, map.type, map.flags,
-map_ptr);
+   err = drm_addmap_core(dev, map.offset, map.size, map.type, map.flags,
+ maplist);
 
-   if (err) {
+   if (err) 

[XFS] Add in grpid/nogrpid mount option parsing, actual code was always

2005-09-07 Thread Linux Kernel Mailing List
tree fbdf8b56d23ce011ef3a8bb1481ca9a24e1cedb3
parent 7e9c63961558092d584936a874cf3fee80002eb6
author Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:42:26 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:42:26 +1000

[XFS] Add in grpid/nogrpid mount option parsing, actual code was always
there..

SGI-PV: 939444
SGI-Modid: xfs-linux:xfs-kern:23162a

Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/xfs_vfsops.c |   16 +++-
 1 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -1621,6 +1621,10 @@ xfs_vget(
 #define MNTOPT_SWIDTH  swidth/* data volume stripe width */
 #define MNTOPT_NOUUID  nouuid/* ignore filesystem UUID */
 #define MNTOPT_MTPTmtpt  /* filesystem mount point */
+#define MNTOPT_GRPID   grpid /* group-ID from parent directory */
+#define MNTOPT_NOGRPID nogrpid   /* group-ID from current process */
+#define MNTOPT_BSDGROUPSbsdgroups/* group-ID from parent directory */
+#define MNTOPT_SYSVGROUPS   sysvgroups   /* group-ID from current process */
 #define MNTOPT_ALLOCSIZEallocsize/* preferred allocation size */
 #define MNTOPT_IHASHSIZEihashsize/* size of inode hash table */
 #define MNTOPT_NORECOVERY   norecovery   /* don't run XFS recovery */
@@ -1741,6 +1745,12 @@ xfs_parseargs(
}
args-flags |= XFSMNT_IHASHSIZE;
args-ihashsize = simple_strtoul(value, eov, 10);
+   } else if (!strcmp(this_char, MNTOPT_GRPID) ||
+  !strcmp(this_char, MNTOPT_BSDGROUPS)) {
+   vfsp-vfs_flag |= VFS_GRPID;
+   } else if (!strcmp(this_char, MNTOPT_NOGRPID) ||
+  !strcmp(this_char, MNTOPT_SYSVGROUPS)) {
+   vfsp-vfs_flag = ~VFS_GRPID;
} else if (!strcmp(this_char, MNTOPT_WSYNC)) {
args-flags |= XFSMNT_WSYNC;
} else if (!strcmp(this_char, MNTOPT_OSYNCISOSYNC)) {
@@ -1862,6 +1872,7 @@ xfs_showargs(
};
struct proc_xfs_info*xfs_infop;
struct xfs_mount*mp = XFS_BHVTOM(bhv);
+   struct vfs  *vfsp = XFS_MTOVFS(mp);
 
for (xfs_infop = xfs_info; xfs_infop-flag; xfs_infop++) {
if (mp-m_flags  xfs_infop-flag)
@@ -1898,7 +1909,10 @@ xfs_showargs(
 
if (!(mp-m_flags  XFS_MOUNT_32BITINOOPT))
seq_printf(m, , MNTOPT_64BITINODE);
-   
+
+   if (vfsp-vfs_flag  VFS_GRPID)
+   seq_printf(m, , MNTOPT_GRPID);
+
return 0;
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] Update copyrights

2005-09-07 Thread Linux Kernel Mailing List
tree 3383528772be9589e064b6c7b3b056b3f20b12d1
parent 80ac2912f846c01d702774bb6aa7100ec71e88b9
author Dean Roehrich [EMAIL PROTECTED] Fri, 02 Sep 2005 15:30:57 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 15:30:57 +1000

[XFS] Update copyrights

SGI-PV: 933551
SGI-Modid: xfs-linux:xfs-kern:190625a

Signed-off-by: Dean Roehrich [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/xfs_dmapi.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h
--- a/fs/xfs/xfs_dmapi.h
+++ b/fs/xfs/xfs_dmapi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] add infrastructure for waiting on I/O completion at inode reclaim

2005-09-07 Thread Linux Kernel Mailing List
tree edebb01cbfe550a2edb066d5b4185445cfff11ba
parent 592cb26bda6fe69838529acf71e50a6dee7acbb4
author Christoph Hellwig [EMAIL PROTECTED] Fri, 02 Sep 2005 16:58:38 +1000
committer Nathan Scott [EMAIL PROTECTED] Fri, 02 Sep 2005 16:58:38 +1000

[XFS] add infrastructure for waiting on I/O completion at inode reclaim
time

SGI-PV: 934766
SGI-Modid: xfs-linux:xfs-kern:196854a

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_aops.c  |   11 +-
 fs/xfs/linux-2.6/xfs_vnode.c |   28 +
 fs/xfs/linux-2.6/xfs_vnode.h |4 +++
 fs/xfs/xfs_vnodeops.c|   47 ++-
 4 files changed, 32 insertions(+), 58 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -139,7 +139,7 @@ linvfs_unwritten_convert(
XFS_BUF_SET_FSPRIVATE(bp, NULL);
XFS_BUF_CLR_IODONE_FUNC(bp);
XFS_BUF_UNDATAIO(bp);
-   iput(LINVFS_GET_IP(vp));
+   vn_iowake(vp);
pagebuf_iodone(bp, 0, 0);
 }
 
@@ -448,14 +448,7 @@ xfs_map_unwritten(
if (!pb)
return -EAGAIN;
 
-   /* Take a reference to the inode to prevent it from
-* being reclaimed while we have outstanding unwritten
-* extent IO on it.
-*/
-   if ((igrab(inode)) != inode) {
-   pagebuf_free(pb);
-   return -EAGAIN;
-   }
+   atomic_inc(LINVFS_GET_VP(inode)-v_iocount);
 
/* Set the count to 1 initially, this will stop an I/O
 * completion callout which happens before we have started
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -42,17 +42,33 @@ DEFINE_SPINLOCK(vnumber_lock);
  */
 #define NVSYNC  37
 #define vptosync(v) (vsync[((unsigned long)v) % NVSYNC])
-sv_t vsync[NVSYNC];
+STATIC wait_queue_head_t vsync[NVSYNC];
 
 
 void
 vn_init(void)
 {
-   register sv_t *svp;
-   register int i;
+   int i;
 
-   for (svp = vsync, i = 0; i  NVSYNC; i++, svp++)
-   init_sv(svp, SV_DEFAULT, vsy, i);
+   for (i = 0; i  NVSYNC; i++)
+   init_waitqueue_head(vsync[i]);
+}
+
+void
+vn_iowait(
+   struct vnode*vp)
+{
+   wait_queue_head_t *wq = vptosync(vp);
+
+   wait_event(*wq, (atomic_read(vp-v_iocount) == 0));
+}
+
+void
+vn_iowake(
+   struct vnode*vp)
+{
+   if (atomic_dec_and_test(vp-v_iocount))
+   wake_up(vptosync(vp));
 }
 
 /*
@@ -111,6 +127,8 @@ vn_initialize(
/* Initialize the first behavior and the behavior chain head. */
vn_bhv_head_init(VN_BHV_HEAD(vp), vnode);
 
+   atomic_set(vp-v_iocount, 0);
+
 #ifdef XFS_VNODE_TRACE
vp-v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP);
 #endif /* XFS_VNODE_TRACE */
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -80,6 +80,7 @@ typedef struct vnode {
vnumber_t   v_number;   /* in-core vnode number */
vn_bhv_head_t   v_bh;   /* behavior head */
spinlock_t  v_lock; /* VN_LOCK/VN_UNLOCK */
+   atomic_tv_iocount;  /* outstanding I/O count */
 #ifdef XFS_VNODE_TRACE
struct ktrace   *v_trace;   /* trace header structure*/
 #endif
@@ -506,6 +507,9 @@ extern int  vn_revalidate(struct vnode *)
 extern voidvn_revalidate_core(struct vnode *, vattr_t *);
 extern voidvn_remove(struct vnode *);
 
+extern voidvn_iowait(struct vnode *vp);
+extern voidvn_iowake(struct vnode *vp);
+
 static inline int vn_count(struct vnode *vp)
 {
return atomic_read(LINVFS_GET_IP(vp)-i_count);
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -3846,51 +3846,10 @@ xfs_reclaim(
return 0;
}
 
-   if ((ip-i_d.di_mode  S_IFMT) == S_IFREG) {
-   if (ip-i_d.di_size  0) {
-   /*
-* Flush and invalidate any data left around that is
-* a part of this file.
-*
-* Get the inode's i/o lock so that buffers are pushed
-* out while holding the proper lock.  We can't hold
-* the inode lock here since flushing out buffers may
-* cause us to try to get the lock in xfs_strategy().
-*
-* We don't have to call remapf() here, because there
-* cannot be any mapped file references to this vnode
-* since it is being reclaimed.
-*/
-   

[XFS] Add in the new xfs_aops.h header file for I/O completion struct.

2005-09-07 Thread Linux Kernel Mailing List
tree 1cbdd59928b14533efbb8ab87f50f9c31813dec0
parent 0829c3602f4df95898752c402ea90b92a3e33154
author Christoph Hellwig [EMAIL PROTECTED] Mon, 05 Sep 2005 08:18:12 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:18:12 +1000

[XFS] Add in the new xfs_aops.h header file for I/O completion struct.

SGI-PV: 934766
SGI-Modid: xfs-linux:xfs-kern:196857a

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_aops.h |   49 
 1 files changed, 49 insertions(+)

diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/linux-2.6/xfs_aops.h
new file mode 100644
--- /dev/null
+++ b/fs/xfs/linux-2.6/xfs_aops.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_AOPS_H__
+#define __XFS_AOPS_H__
+
+extern struct workqueue_struct *xfsdatad_workqueue;
+extern mempool_t *xfs_ioend_pool;
+
+typedef void (*xfs_ioend_func_t)(void *);
+
+typedef struct xfs_ioend {
+   unsigned intio_uptodate;/* I/O status register */
+   atomic_tio_remaining;   /* hold count */
+   struct vnode*io_vnode;  /* file being written to */
+   size_t  io_size;/* size of the extent */
+   xfs_off_t   io_offset;  /* offset in the file */
+   struct work_struct  io_work;/* xfsdatad work queue */
+} xfs_ioend_t;
+
+#endif /* __XFS_IOPS_H__ */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] Delay I/O completion for unwritten extents after conversion

2005-09-07 Thread Linux Kernel Mailing List
tree 0121a8f6fe10e62bbd943defafe6a92c03e633b6
parent f09738638d3bae6501e8e160c66233832d8c280f
author Christoph Hellwig [EMAIL PROTECTED] Mon, 05 Sep 2005 08:23:35 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:23:35 +1000

[XFS] Delay I/O completion for unwritten extents after conversion

SGI-PV: 936584
SGI-Modid: xfs-linux:xfs-kern:196886a

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_aops.c |   27 +--
 fs/xfs/linux-2.6/xfs_aops.h |1 +
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -136,10 +136,21 @@ xfs_end_bio_unwritten(
vnode_t *vp = ioend-io_vnode;
xfs_off_t   offset = ioend-io_offset;
size_t  size = ioend-io_size;
+   struct buffer_head  *bh, *next;
int error;
 
if (ioend-io_uptodate)
VOP_BMAP(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL, error);
+
+   /* ioend-io_buffer_head is only non-NULL for buffered I/O */
+   for (bh = ioend-io_buffer_head; bh; bh = next) {
+   next = bh-b_private;
+
+   bh-b_end_io = NULL;
+   clear_buffer_unwritten(bh);
+   end_buffer_async_write(bh, ioend-io_uptodate);
+   }
+
xfs_destroy_ioend(ioend);
 }
 
@@ -165,6 +176,7 @@ xfs_alloc_ioend(
atomic_set(ioend-io_remaining, 1);
ioend-io_uptodate = 1; /* cleared if any I/O fails */
ioend-io_vnode = LINVFS_GET_VP(inode);
+   ioend-io_buffer_head = NULL;
atomic_inc(ioend-io_vnode-v_iocount);
ioend-io_offset = 0;
ioend-io_size = 0;
@@ -180,15 +192,26 @@ linvfs_unwritten_done(
int uptodate)
 {
xfs_ioend_t *ioend = bh-b_private;
+   static spinlock_t   unwritten_done_lock = SPIN_LOCK_UNLOCKED;
+   unsigned long   flags;
 
ASSERT(buffer_unwritten(bh));
bh-b_end_io = NULL;
-   clear_buffer_unwritten(bh);
+
if (!uptodate)
ioend-io_uptodate = 0;
 
+   /*
+* Deep magic here.  We reuse b_private in the buffer_heads to build
+* a chain for completing the I/O from user context after we've issued
+* a transaction to convert the unwritten extent.
+*/
+   spin_lock_irqsave(unwritten_done_lock, flags);
+   bh-b_private = ioend-io_buffer_head;
+   ioend-io_buffer_head = bh;
+   spin_unlock_irqrestore(unwritten_done_lock, flags);
+
xfs_finish_ioend(ioend);
-   end_buffer_async_write(bh, uptodate);
 }
 
 STATIC int
diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/linux-2.6/xfs_aops.h
--- a/fs/xfs/linux-2.6/xfs_aops.h
+++ b/fs/xfs/linux-2.6/xfs_aops.h
@@ -41,6 +41,7 @@ typedef struct xfs_ioend {
unsigned intio_uptodate;/* I/O status register */
atomic_tio_remaining;   /* hold count */
struct vnode*io_vnode;  /* file being written to */
+   struct buffer_head  *io_buffer_head;/* buffer linked list head */
size_t  io_size;/* size of the extent */
xfs_off_t   io_offset;  /* offset in the file */
struct work_struct  io_work;/* xfsdatad work queue */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] Need to be able to reset sb_qflags if not mounting with quotas

2005-09-07 Thread Linux Kernel Mailing List
tree d97e390aa0abd15212230b2b61cf0d15b8fbab8f
parent 56d433e430eb399a4b6d0e73d28af6e1d4713547
author Tim Shimmin [EMAIL PROTECTED] Mon, 05 Sep 2005 08:24:10 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:24:10 +1000

[XFS] Need to be able to reset sb_qflags if not mounting with quotas
having previously mounted with quotas.

SGI-PV: 940491
SGI-Modid: xfs-linux:xfs-kern:23388a

Signed-off-by: Tim Shimmin [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/quota/xfs_dquot.h  |   16 -
 fs/xfs/quota/xfs_qm.c |   14 +---
 fs/xfs/quota/xfs_qm.h |2 -
 fs/xfs/quota/xfs_qm_bhv.c |   44 -
 fs/xfs/xfs_qmops.c|   78 --
 fs/xfs/xfs_quota.h|   17 +-
 6 files changed, 95 insertions(+), 76 deletions(-)

diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/quota/xfs_dquot.h
--- a/fs/xfs/quota/xfs_dquot.h
+++ b/fs/xfs/quota/xfs_dquot.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -113,20 +113,6 @@ typedef struct xfs_dquot {
 
 #define XFS_DQHOLD(dqp)((dqp)-q_nrefs++)
 
-/*
- * Quota Accounting/Enforcement flags
- */
-#define XFS_ALL_QUOTA_ACCT \
-   (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT)
-#define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD)
-#define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD)
-
-#define XFS_IS_QUOTA_RUNNING(mp)   ((mp)-m_qflags  XFS_ALL_QUOTA_ACCT)
-#define XFS_IS_QUOTA_ENFORCED(mp)  ((mp)-m_qflags  XFS_ALL_QUOTA_ENFD)
-#define XFS_IS_UQUOTA_RUNNING(mp)  ((mp)-m_qflags  XFS_UQUOTA_ACCT)
-#define XFS_IS_PQUOTA_RUNNING(mp)  ((mp)-m_qflags  XFS_PQUOTA_ACCT)
-#define XFS_IS_GQUOTA_RUNNING(mp)  ((mp)-m_qflags  XFS_GQUOTA_ACCT)
-
 #ifdef DEBUG
 static inline int
 XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp)
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -365,16 +365,6 @@ xfs_qm_mount_quotas(
int error = 0;
uintsbf;
 
-   /*
-* If a file system had quotas running earlier, but decided to
-* mount without -o uquota/pquota/gquota options, revoke the
-* quotachecked license, and bail out.
-*/
-   if (! XFS_IS_QUOTA_ON(mp) 
-   (mp-m_sb.sb_qflags  XFS_ALL_QUOTA_ACCT)) {
-   mp-m_qflags = 0;
-   goto write_changes;
-   }
 
/*
 * If quotas on realtime volumes is not supported, we disable
@@ -2002,7 +1992,7 @@ xfs_qm_quotacheck(
ASSERT(mp-m_quotainfo != NULL);
ASSERT(xfs_Gqm != NULL);
xfs_qm_destroy_quotainfo(mp);
-   xfs_mount_reset_sbqflags(mp);
+   (void)xfs_mount_reset_sbqflags(mp);
} else {
cmn_err(CE_NOTE, XFS quotacheck %s: Done., mp-m_fsname);
}
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h
--- a/fs/xfs/quota/xfs_qm.h
+++ b/fs/xfs/quota/xfs_qm.h
@@ -184,8 +184,6 @@ typedef struct xfs_dquot_acct {
 #define XFS_QM_HOLD(xqm)   ((xqm)-qm_nrefs++)
 #define XFS_QM_RELE(xqm)   ((xqm)-qm_nrefs--)
 
-extern voidxfs_mount_reset_sbqflags(xfs_mount_t *);
-
 extern voidxfs_qm_destroy_quotainfo(xfs_mount_t *);
 extern int xfs_qm_mount_quotas(xfs_mount_t *, int);
 extern voidxfs_qm_mount_quotainit(xfs_mount_t *, uint);
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/quota/xfs_qm_bhv.c
--- a/fs/xfs/quota/xfs_qm_bhv.c
+++ b/fs/xfs/quota/xfs_qm_bhv.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -229,48 +229,6 @@ xfs_qm_syncall(
return error;
 }
 
-/*
- * Clear the quotaflags in memory and in the superblock.
- */
-void
-xfs_mount_reset_sbqflags(
-   xfs_mount_t *mp)
-{
-   xfs_trans_t *tp;
-   unsigned long   s;
-
-   mp-m_qflags = 0;
-   /*
-* It is OK to look at sb_qflags here in mount path,
-* without SB_LOCK.
-*/
-   if (mp-m_sb.sb_qflags == 0)
-   return;
-   s = 

[XFS] Check if there is first behavior before calling VOP_RECLAIM from

2005-09-07 Thread Linux Kernel Mailing List
tree 767fd3c37f9bce54b3412b6c0cb1b0138125a242
parent 4cd4a034a3ef020d9de48fe0a3f5f976e5134669
author Felix Blyakher [EMAIL PROTECTED] Mon, 05 Sep 2005 08:24:49 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:24:49 +1000

[XFS] Check if there is first behavior before calling VOP_RECLAIM from
linvfs_clear_inode(). The behavior may go away in VOP_INACTIVE. 

SGI-PV: 941000
SGI-Modid: xfs-linux:xfs-kern:197355a

Signed-off-by: Felix Blyakher [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_super.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -400,9 +400,11 @@ linvfs_clear_inode(
vp-v_flag = ~VMODIFIED;
VN_UNLOCK(vp, 0);
 
-   VOP_RECLAIM(vp, error);
-   if (error)
-   panic(vn_purge: cannot reclaim);
+   if (vp-v_fbhv) {
+   VOP_RECLAIM(vp, error);
+   if (error)
+   panic(vn_purge: cannot reclaim);
+   }
 
ASSERT(vp-v_fbhv == NULL);
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] add handlers to fix xfs_flock_t alignment issues in compat ioctls

2005-09-07 Thread Linux Kernel Mailing List
tree e76d37e3d61a19bceb6b1d61f662fbc8ce0c16f3
parent 0c147f9a864f043e6f93a4bb3519c1166419bd74
author Eric Sandeen [EMAIL PROTECTED] Mon, 05 Sep 2005 08:25:06 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:25:06 +1000

[XFS] add handlers to fix xfs_flock_t alignment issues in compat ioctls

SGI-PV: 938899
SGI-Modid: xfs-linux:xfs-kern:197403a

Signed-off-by: Eric Sandeen [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_ioctl32.c |   65 +++--
 1 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -47,8 +47,52 @@
 #include xfs_vnode.h
 #include xfs_dfrag.h
 
+#define  _NATIVE_IOC(cmd, type) \
+ _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type))
+
 #if defined(CONFIG_IA64) || defined(CONFIG_X86_64)
 #define BROKEN_X86_ALIGNMENT
+/* on ia32 l_start is on a 32-bit boundary */
+typedef struct xfs_flock64_32 {
+   __s16   l_type;
+   __s16   l_whence;
+   __s64   l_start __attribute__((packed));
+   /* len == 0 means until end of file */
+   __s64   l_len __attribute__((packed));
+   __s32   l_sysid;
+   __u32   l_pid;
+   __s32   l_pad[4];   /* reserve area */
+} xfs_flock64_32_t;
+
+#define XFS_IOC_ALLOCSP_32 _IOW ('X', 10, struct xfs_flock64_32)
+#define XFS_IOC_FREESP_32  _IOW ('X', 11, struct xfs_flock64_32)
+#define XFS_IOC_ALLOCSP64_32   _IOW ('X', 36, struct xfs_flock64_32)
+#define XFS_IOC_FREESP64_32_IOW ('X', 37, struct xfs_flock64_32)
+#define XFS_IOC_RESVSP_32  _IOW ('X', 40, struct xfs_flock64_32)
+#define XFS_IOC_UNRESVSP_32_IOW ('X', 41, struct xfs_flock64_32)
+#define XFS_IOC_RESVSP64_32_IOW ('X', 42, struct xfs_flock64_32)
+#define XFS_IOC_UNRESVSP64_32  _IOW ('X', 43, struct xfs_flock64_32)
+
+/* just account for different alignment */
+STATIC unsigned long
+xfs_ioctl32_flock(
+   unsigned long   arg)
+{
+   xfs_flock64_32_t__user *p32 = (void __user *)arg;
+   xfs_flock64_t   __user *p = compat_alloc_user_space(sizeof(*p));
+
+   if (copy_in_user(p-l_type,p32-l_type,   sizeof(s16)) ||
+   copy_in_user(p-l_whence,  p32-l_whence, sizeof(s16)) ||
+   copy_in_user(p-l_start,   p32-l_start,  sizeof(s64)) ||
+   copy_in_user(p-l_len, p32-l_len,sizeof(s64)) ||
+   copy_in_user(p-l_sysid,   p32-l_sysid,  sizeof(s32)) ||
+   copy_in_user(p-l_pid, p32-l_pid,sizeof(u32)) ||
+   copy_in_user(p-l_pad, p32-l_pad,4*sizeof(u32)))
+   return -EFAULT;
+   
+   return (unsigned long)p;
+}
+
 #else
 
 typedef struct xfs_fsop_bulkreq32 {
@@ -103,7 +147,6 @@ __linvfs_compat_ioctl(int mode, struct f
 /* not handled
case XFS_IOC_FD_TO_HANDLE:
case XFS_IOC_PATH_TO_HANDLE:
-   case XFS_IOC_PATH_TO_HANDLE:
case XFS_IOC_PATH_TO_FSHANDLE:
case XFS_IOC_OPEN_BY_HANDLE:
case XFS_IOC_FSSETDM_BY_HANDLE:
@@ -124,8 +167,21 @@ __linvfs_compat_ioctl(int mode, struct f
case XFS_IOC_ERROR_CLEARALL:
break;
 
-#ifndef BROKEN_X86_ALIGNMENT
-   /* xfs_flock_t and xfs_bstat_t have wrong u32 vs u64 alignment */
+#ifdef BROKEN_X86_ALIGNMENT
+   /* xfs_flock_t has wrong u32 vs u64 alignment */
+   case XFS_IOC_ALLOCSP_32:
+   case XFS_IOC_FREESP_32:
+   case XFS_IOC_ALLOCSP64_32:
+   case XFS_IOC_FREESP64_32:
+   case XFS_IOC_RESVSP_32:
+   case XFS_IOC_UNRESVSP_32:
+   case XFS_IOC_RESVSP64_32:
+   case XFS_IOC_UNRESVSP64_32:
+   arg = xfs_ioctl32_flock(arg);
+   cmd = _NATIVE_IOC(cmd, struct xfs_flock64);
+   break;
+
+#else /* These are handled fine if no alignment issues */
case XFS_IOC_ALLOCSP:
case XFS_IOC_FREESP:
case XFS_IOC_RESVSP:
@@ -134,6 +190,9 @@ __linvfs_compat_ioctl(int mode, struct f
case XFS_IOC_FREESP64:
case XFS_IOC_RESVSP64:
case XFS_IOC_UNRESVSP64:
+   break;
+
+   /* xfs_bstat_t still has wrong u32 vs u64 alignment */
case XFS_IOC_SWAPEXT:
break;
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] Manage spinlock differences between kernel versions a bit.

2005-09-07 Thread Linux Kernel Mailing List
tree 4d0355092af3e324fc7d66d7964f0b7e69105bc6
parent 526c420c44b45b11e25a98f37702cc3044ba9bdc
author Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:27:50 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:27:50 +1000

[XFS] Manage spinlock differences between kernel versions a bit.

SGI-PV: 904196
SGI-Modid: xfs-linux:xfs-kern:23563a

Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/spin.h |3 +++
 1 files changed, 3 insertions(+)

diff --git a/fs/xfs/linux-2.6/spin.h b/fs/xfs/linux-2.6/spin.h
--- a/fs/xfs/linux-2.6/spin.h
+++ b/fs/xfs/linux-2.6/spin.h
@@ -45,6 +45,9 @@
 typedef spinlock_t lock_t;
 
 #define SPLDECL(s) unsigned long s
+#ifndef DEFINE_SPINLOCK
+#define DEFINE_SPINLOCK(s) spinlock_t s = SPIN_LOCK_UNLOCKED
+#endif
 
 #define spinlock_init(lock, name)  spin_lock_init(lock)
 #definespinlock_destroy(lock)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] allow a null behaviour pointer in linvfs_clear_inode

2005-09-07 Thread Linux Kernel Mailing List
tree b85447888ac27b35136d92f4dc25cc55de3b1b97
parent 53937c52c3f1dff6100174f50a85c068f16713ae
author Christoph Hellwig [EMAIL PROTECTED] Mon, 05 Sep 2005 08:28:02 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:28:02 +1000

[XFS] allow a null behaviour pointer in linvfs_clear_inode

SGI-PV: 940531
SGI-Modid: xfs-linux:xfs-kern:197782a

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_super.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -387,14 +387,17 @@ linvfs_clear_inode(
 
vn_trace_entry(vp, clear_inode, (inst_t *)__return_address);
 
-   ASSERT(vp-v_fbhv != NULL);
-
XFS_STATS_INC(vn_rele);
XFS_STATS_INC(vn_remove);
XFS_STATS_INC(vn_reclaim);
XFS_STATS_DEC(vn_active);
 
-   VOP_INACTIVE(vp, NULL, cache);
+   /*
+* This can happen because xfs_iget_core calls xfs_idestroy if we
+* find an inode with di_mode == 0 but without IGET_CREATE set.
+*/
+   if (vp-v_fbhv)
+   VOP_INACTIVE(vp, NULL, cache);
 
VN_LOCK(vp);
vp-v_flag = ~VMODIFIED;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] remove some dead code from pagebuf

2005-09-07 Thread Linux Kernel Mailing List
tree 81f580bcc4729c190d7cd6209d9d61c5f88b84b7
parent 02ba71de98d5eee63e82cc2d88f9ea8430810a9a
author Christoph Hellwig [EMAIL PROTECTED] Mon, 05 Sep 2005 08:28:16 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:28:16 +1000

[XFS] remove some dead code from pagebuf

SGI-PV: 934766
SGI-Modid: xfs-linux:xfs-kern:197783a

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_buf.c |   30 --
 fs/xfs/linux-2.6/xfs_buf.h |7 ---
 2 files changed, 37 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -700,25 +700,6 @@ xfs_buf_read_flags(
 }
 
 /*
- * Create a skeletal pagebuf (no pages associated with it).
- */
-xfs_buf_t *
-pagebuf_lookup(
-   xfs_buftarg_t   *target,
-   loff_t  ioff,
-   size_t  isize,
-   page_buf_flags_tflags)
-{
-   xfs_buf_t   *pb;
-
-   pb = pagebuf_allocate(flags);
-   if (pb) {
-   _pagebuf_initialize(pb, target, ioff, isize, flags);
-   }
-   return pb;
-}
-
-/*
  * If we are not low on memory then do the readahead in a deadlock
  * safe manner.
  */
@@ -891,17 +872,6 @@ pagebuf_rele(
 
PB_TRACE(pb, rele, pb-pb_relse);
 
-   /*
-* pagebuf_lookup buffers are not hashed, not delayed write,
-* and don't have their own release routines.  Special case.
-*/
-   if (unlikely(!hash)) {
-   ASSERT(!pb-pb_relse);
-   if (atomic_dec_and_test(pb-pb_hold))
-   xfs_buf_free(pb);
-   return;
-   }
-
if (atomic_dec_and_lock(pb-pb_hold, hash-bh_lock)) {
int do_free = 1;
 
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -206,13 +206,6 @@ extern xfs_buf_t *xfs_buf_read_flags(  /*
 #define xfs_buf_read(target, blkno, len, flags) \
xfs_buf_read_flags((target), (blkno), (len), PBF_LOCK | PBF_MAPPED)
 
-extern xfs_buf_t *pagebuf_lookup(
-   xfs_buftarg_t *,
-   loff_t, /* starting offset of range */
-   size_t, /* length of range  */
-   page_buf_flags_t);  /* PBF_READ, PBF_WRITE, */
-   /* PBF_FORCEIO, */
-
 extern xfs_buf_t *pagebuf_get_empty(   /* allocate pagebuf struct with */
/*  no memory or disk address   */
size_t len,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] Fixes a bug in the quota code when allocating a new dquot record

2005-09-07 Thread Linux Kernel Mailing List
tree 6955d8a48cb52effb2f2352fab34bdf2291acce3
parent 0f9fffbcc1817c655d6dd40960ae2e0086b0f64f
author Tim Shimmin [EMAIL PROTECTED] Mon, 05 Sep 2005 08:29:01 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:29:01 +1000

[XFS] Fixes a bug in the quota code when allocating a new dquot record
which can cause an extent hole to be filled and a free extent to be
processed. In this case, we make a few mistakes: forget to pass back the
transaction, forget to put a hold on the buffer and forget to add the buf
to the new transaction.

SGI-PV: 940366
SGI-Modid: xfs-linux:xfs-kern:23594a

Signed-off-by: Tim Shimmin [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/quota/xfs_dquot.c |   43 ---
 fs/xfs/xfs_trans.h   |1 +
 fs/xfs/xfs_trans_buf.c   |   23 +++
 3 files changed, 60 insertions(+), 7 deletions(-)

diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -421,7 +421,7 @@ xfs_qm_init_dquot_blk(
  */
 STATIC int
 xfs_qm_dqalloc(
-   xfs_trans_t *tp,
+   xfs_trans_t **tpp,
xfs_mount_t *mp,
xfs_dquot_t *dqp,
xfs_inode_t *quotip,
@@ -433,6 +433,7 @@ xfs_qm_dqalloc(
xfs_bmbt_irec_t map;
int nmaps, error, committed;
xfs_buf_t   *bp;
+   xfs_trans_t *tp = *tpp;
 
ASSERT(tp != NULL);
xfs_dqtrace_entry(dqp, DQALLOC);
@@ -492,10 +493,32 @@ xfs_qm_dqalloc(
xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp-q_core.d_id, ARCH_CONVERT),
  dqp-dq_flags  XFS_DQ_ALLTYPES, bp);
 
-   if ((error = xfs_bmap_finish(tp, flist, firstblock, committed))) {
+   /*
+* xfs_bmap_finish() may commit the current transaction and
+* start a second transaction if the freelist is not empty.
+*
+* Since we still want to modify this buffer, we need to
+* ensure that the buffer is not released on commit of
+* the first transaction and ensure the buffer is added to the
+* second transaction.
+*
+* If there is only one transaction then don't stop the buffer
+* from being released when it commits later on.
+*/
+
+   xfs_trans_bhold(tp, bp);
+
+   if ((error = xfs_bmap_finish(tpp, flist, firstblock, committed))) {
goto error1;
}
 
+   if (committed) {
+   tp = *tpp;
+   xfs_trans_bjoin(tp, bp);
+   } else {
+   xfs_trans_bhold_release(tp, bp);
+   }
+
*O_bpp = bp;
return 0;
 
@@ -514,7 +537,7 @@ xfs_qm_dqalloc(
  */
 STATIC int
 xfs_qm_dqtobp(
-   xfs_trans_t *tp,
+   xfs_trans_t **tpp,
xfs_dquot_t *dqp,
xfs_disk_dquot_t**O_ddpp,
xfs_buf_t   **O_bpp,
@@ -528,6 +551,7 @@ xfs_qm_dqtobp(
xfs_disk_dquot_t *ddq;
xfs_dqid_t  id;
boolean_t   newdquot;
+   xfs_trans_t *tp = (tpp ? *tpp : NULL);
 
mp = dqp-q_mount;
id = INT_GET(dqp-q_core.d_id, ARCH_CONVERT);
@@ -579,9 +603,10 @@ xfs_qm_dqtobp(
return (ENOENT);
 
ASSERT(tp);
-   if ((error = xfs_qm_dqalloc(tp, mp, dqp, quotip,
+   if ((error = xfs_qm_dqalloc(tpp, mp, dqp, quotip,
dqp-q_fileoffset, bp)))
return (error);
+   tp = *tpp;
newdquot = B_TRUE;
} else {
/*
@@ -645,7 +670,7 @@ xfs_qm_dqtobp(
 /* ARGSUSED */
 STATIC int
 xfs_qm_dqread(
-   xfs_trans_t *tp,
+   xfs_trans_t **tpp,
xfs_dqid_t  id,
xfs_dquot_t *dqp,   /* dquot to get filled in */
uintflags)
@@ -653,15 +678,19 @@ xfs_qm_dqread(
xfs_disk_dquot_t *ddqp;
xfs_buf_t*bp;
int  error;
+   xfs_trans_t  *tp;
+
+   ASSERT(tpp);
 
/*
 * get a pointer to the on-disk dquot and the buffer containing it
 * dqp already knows its own type (GROUP/USER).
 */
xfs_dqtrace_entry(dqp, DQREAD);
-   if ((error = xfs_qm_dqtobp(tp, dqp, ddqp, bp, flags))) {
+   if ((error = xfs_qm_dqtobp(tpp, dqp, ddqp, bp, flags))) {
return (error);
}
+   tp = *tpp;
 
/* copy everything from disk dquot to the incore dquot */
memcpy(dqp-q_core, ddqp, sizeof(xfs_disk_dquot_t));
@@ -740,7 +769,7 @@ xfs_qm_idtodq(
 * Read it from disk; xfs_dqread() takes care of
 * all the necessary initialization of dquot's fields (locks, etc)
 */
-   if ((error = xfs_qm_dqread(tp, id, dqp, flags))) {
+   if ((error = xfs_qm_dqread(tp, id, dqp, flags))) {
 

[XFS] Retry linux inode cacech lookup if we found a stale inode. This

2005-09-07 Thread Linux Kernel Mailing List
tree 1262d9ec73d90bd4a73093cdd8afe8d2459dae72
parent efa092f3d4c60be7e81de515db9f06e5f8426afc
author Christoph Hellwig [EMAIL PROTECTED] Mon, 05 Sep 2005 08:33:00 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:33:00 +1000

[XFS] Retry linux inode cacech lookup if we found a stale inode.  This
fixes crashes under high nfs load

SGI-PV: 941429
SGI-Modid: xfs-linux:xfs-kern:197929a

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/xfs_iget.c |   28 
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -30,6 +30,8 @@
  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  */
 
+#include linux/delay.h
+
 #include xfs.h
 
 #include xfs_macros.h
@@ -507,14 +509,13 @@ xfs_iget(
 
XFS_STATS_INC(xs_ig_attempts);
 
+retry:
if ((inode = iget_locked(XFS_MTOVFS(mp)-vfs_super, ino))) {
bhv_desc_t  *bdp;
xfs_inode_t *ip;
-   int newnode;
 
vp = LINVFS_GET_VP(inode);
if (inode-i_state  I_NEW) {
-inode_allocate:
vn_initialize(inode);
error = xfs_iget_core(vp, mp, tp, ino, flags,
lock_flags, ipp, bno);
@@ -525,22 +526,25 @@ inode_allocate:
iput(inode);
}
} else {
-   if (is_bad_inode(inode)) {
+   /*
+* If the inode is not fully constructed due to
+* filehandle mistmatches wait for the inode to go
+* away and try again.
+*
+* iget_locked will call __wait_on_freeing_inode
+* to wait for the inode to go away.
+*/
+   if (is_bad_inode(inode) ||
+   ((bdp = vn_bhv_lookup(VN_BHV_HEAD(vp),
+ xfs_vnodeops)) == NULL)) {
iput(inode);
-   return EIO;
+   delay(1);
+   goto retry;
}
 
-   bdp = vn_bhv_lookup(VN_BHV_HEAD(vp), xfs_vnodeops);
-   if (bdp == NULL) {
-   XFS_STATS_INC(xs_ig_dup);
-   goto inode_allocate;
-   }
ip = XFS_BHVTOI(bdp);
if (lock_flags != 0)
xfs_ilock(ip, lock_flags);
-   newnode = (ip-i_d.di_mode == 0);
-   if (newnode)
-   xfs_iocore_inode_reinit(ip);
XFS_STATS_INC(xs_ig_found);
*ipp = ip;
error = 0;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[XFS] Fix racy access to pb_flags. pagebuf_rele() modified pb_flags after

2005-09-07 Thread Linux Kernel Mailing List
tree f5bfb33cea1c6d7d2ababf5f800e63e2ec89a65a
parent ba403ab43e896c57f32995ccba9a6bd6ec8dd1b9
author David Chinner [EMAIL PROTECTED] Mon, 05 Sep 2005 08:33:35 +1000
committer Nathan Scott [EMAIL PROTECTED] Mon, 05 Sep 2005 08:33:35 +1000

[XFS] Fix racy access to pb_flags.  pagebuf_rele() modified pb_flags after
the pagebuf had been unlocked if the buffer was delwri. At high load, this
could result in a race when the superblock was being synced that would
result the flags being incorrect and the iodone functions being executed
incorrectly. This then leads to iclog callback failures or AIL list
corruptions resulting in filesystem shutdowns.

SGI-PV: 923981
SGI-Modid: xfs-linux:xfs-kern:23616a

Signed-off-by: David Chinner [EMAIL PROTECTED]
Signed-off-by: Nathan Scott [EMAIL PROTECTED]

 fs/xfs/linux-2.6/xfs_buf.c |   66 ++---
 fs/xfs/linux-2.6/xfs_buf.h |3 --
 2 files changed, 51 insertions(+), 18 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -590,8 +590,10 @@ found:
PB_SET_OWNER(pb);
}
 
-   if (pb-pb_flags  PBF_STALE)
+   if (pb-pb_flags  PBF_STALE) {
+   ASSERT((pb-pb_flags  _PBF_DELWRI_Q) == 0);
pb-pb_flags = PBF_MAPPED;
+   }
PB_TRACE(pb, got_lock, 0);
XFS_STATS_INC(pb_get_locked);
return (pb);
@@ -872,6 +874,17 @@ pagebuf_rele(
 
PB_TRACE(pb, rele, pb-pb_relse);
 
+   /*
+* pagebuf_lookup buffers are not hashed, not delayed write,
+* and don't have their own release routines.  Special case.
+*/
+   if (unlikely(!hash)) {
+   ASSERT(!pb-pb_relse);
+   if (atomic_dec_and_test(pb-pb_hold))
+   xfs_buf_free(pb);
+   return;
+   }
+
if (atomic_dec_and_lock(pb-pb_hold, hash-bh_lock)) {
int do_free = 1;
 
@@ -883,22 +896,23 @@ pagebuf_rele(
do_free = 0;
}
 
-   if (pb-pb_flags  PBF_DELWRI) {
-   pb-pb_flags |= PBF_ASYNC;
-   atomic_inc(pb-pb_hold);
-   pagebuf_delwri_queue(pb, 0);
-   do_free = 0;
-   } else if (pb-pb_flags  PBF_FS_MANAGED) {
+   if (pb-pb_flags  PBF_FS_MANAGED) {
do_free = 0;
}
 
if (do_free) {
+   ASSERT((pb-pb_flags  (PBF_DELWRI|_PBF_DELWRI_Q)) == 
0);
list_del_init(pb-pb_hash_list);
spin_unlock(hash-bh_lock);
pagebuf_free(pb);
} else {
spin_unlock(hash-bh_lock);
}
+   } else {
+   /*
+* Catch reference count leaks
+*/
+   ASSERT(atomic_read(pb-pb_hold) = 0);
}
 }
 
@@ -976,13 +990,24 @@ pagebuf_lock(
  * pagebuf_unlock
  *
  * pagebuf_unlock releases the lock on the buffer object created by
- * pagebuf_lock or pagebuf_cond_lock (not any
- * pinning of underlying pages created by pagebuf_pin).
+ * pagebuf_lock or pagebuf_cond_lock (not any pinning of underlying pages
+ * created by pagebuf_pin).
+ *
+ * If the buffer is marked delwri but is not queued, do so before we
+ * unlock the buffer as we need to set flags correctly. We also need to
+ * take a reference for the delwri queue because the unlocker is going to
+ * drop their's and they don't know we just queued it.
  */
 void
 pagebuf_unlock(/* unlock buffer
*/
xfs_buf_t   *pb)/* buffer to unlock */
 {
+   if ((pb-pb_flags  (PBF_DELWRI|_PBF_DELWRI_Q)) == PBF_DELWRI) {
+   atomic_inc(pb-pb_hold);
+   pb-pb_flags |= PBF_ASYNC;
+   pagebuf_delwri_queue(pb, 0);
+   }
+
PB_CLEAR_OWNER(pb);
up(pb-pb_sema);
PB_TRACE(pb, unlock, 0);
@@ -1486,6 +1511,11 @@ again:
ASSERT(btp == bp-pb_target);
if (!(bp-pb_flags  PBF_FS_MANAGED)) {
spin_unlock(hash-bh_lock);
+   /*
+* Catch superblock reference count leaks
+* immediately
+*/
+   BUG_ON(bp-pb_bn == 0);
delay(100);
goto again;
}
@@ -1661,17 +1691,20 @@ pagebuf_delwri_queue(
int unlock)
 {
PB_TRACE(pb, delwri_q, (long)unlock);
-   ASSERT(pb-pb_flags  PBF_DELWRI);
+   ASSERT((pb-pb_flags  (PBF_DELWRI|PBF_ASYNC)) ==
+   

  1   2   3   >