]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[SCSI] tgt: fix the user/kernel ring buffer interface
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 13 Feb 2007 14:21:52 +0000 (23:21 +0900)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Fri, 16 Feb 2007 15:40:56 +0000 (09:40 -0600)
This patches fixes two bugs in the scsi target infrastructure's
user/kernel interface.

- It wrongly assumes that the ring buffer size of the interface (64KB)
is larger than or equal to the system page size. This patch sets the
ring buffer size to PAGE_SIZE if the system page size is larger.

- It uses PAGE_SIZE in the header file exported to userspace. This
patch removes it.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsi_tgt_if.c
include/scsi/scsi_tgt_if.h

index f2344ab8deff882b3dc00f20351626562c0085f3..0e08817fdecff73540e2c35bbddb1c4f266acb42 100644 (file)
 
 #include "scsi_tgt_priv.h"
 
+#if TGT_RING_SIZE < PAGE_SIZE
+#  define TGT_RING_SIZE PAGE_SIZE
+#endif
+
+#define TGT_RING_PAGES (TGT_RING_SIZE >> PAGE_SHIFT)
+#define TGT_EVENT_PER_PAGE (PAGE_SIZE / sizeof(struct tgt_event))
+#define TGT_MAX_EVENTS (TGT_EVENT_PER_PAGE * TGT_RING_PAGES)
+
 struct tgt_ring {
        u32 tr_idx;
        unsigned long tr_pages[TGT_RING_PAGES];
index 46d5e70d72157bcca6b0ca4abefb8da76e1d940a..07d6e77ae895638b031e70e7411d36da4ebae93f 100644 (file)
@@ -83,8 +83,5 @@ struct tgt_event {
 } __attribute__ ((aligned (sizeof(uint64_t))));
 
 #define TGT_RING_SIZE (1UL << 16)
-#define TGT_RING_PAGES (TGT_RING_SIZE >> PAGE_SHIFT)
-#define TGT_EVENT_PER_PAGE (PAGE_SIZE / sizeof(struct tgt_event))
-#define TGT_MAX_EVENTS (TGT_EVENT_PER_PAGE * TGT_RING_PAGES)
 
 #endif