@@ -41,6 +41,10 @@
#include <asm/atomic.h>
+/* XXX This has to be included before scsi.h to pickup ARCH_HAS_SG_CHAIN
+ * There is a patch for this floating on LKML and linus-scsi now
+ */
+#include <linux/scatterlist.h>
#include <scsi/scsi.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_dbg.h>
@@ -1845,7 +1849,12 @@ static struct scsi_host_template srp_template = {
.this_id = -1,
.cmd_per_lun = SRP_CMD_SQ_SIZE,
.use_clustering = ENABLE_CLUSTERING,
- .shost_attrs = srp_host_attrs
+ .shost_attrs = srp_host_attrs,
+
+ /* XXX Force a new SG entry for every page crossing to simulate
+ * maxmimum fragmentation.
+ */
+ .dma_boundary = (4096 - 1),
};
static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
@@ -583,6 +583,7 @@ static int dio_new_bio(struct dio *dio, sector_t start_sector)
goto out;
sector = start_sector << (dio->blkbits - 9);
nr_pages = min(dio->pages_in_io, bio_get_nr_vecs(dio->map_bh.b_bdev));
+ nr_pages = min(nr_pages, BIO_MAX_PAGES);
BUG_ON(nr_pages <= 0);
ret = dio_bio_alloc(dio, dio->map_bh.b_bdev, sector, nr_pages);
dio->boundary = 0;