[PATCH] 2.4.27 scsi PHYS_4G merging doesn't work

From: Badari Pulavarty
Date: Mon Aug 16 2004 - 14:03:38 EST


Hi Marcelo,

We recently found that, BH_PHYS_4G() handling in scsi-merge
code is broken. Instead of creating new segment when the IO
crosses 4G boundary, its forcing to create a new request.
So we end up not merging IOs and start doing small IOs.

Only requirement is, driver can't handle crossing 4G boundary
in a single segment - but we can have multiple segments doing
IOs all over the place.

Here is the patch to fix it (suggested by Jens Axboe).

Thanks,
Badari


--- linux-2.4.27.org/drivers/scsi/scsi_merge.c 2004-08-16 11:20:59.957655240 -0700
+++ linux-2.4.27/drivers/scsi/scsi_merge.c 2004-08-16 11:24:30.150701040 -0700
@@ -418,7 +418,7 @@ __inline static int __scsi_back_merge_fn
return 0;

if (!BH_PHYS_4G(req->bhtail, bh))
- return 0;
+ goto new_end_segment;

if (use_clustering) {
/*
@@ -477,7 +477,7 @@ __inline static int __scsi_front_merge_f
return 0;

if (!BH_PHYS_4G(bh, req->bh))
- return 0;
+ goto new_start_segment;

if (use_clustering) {
/*
@@ -640,7 +640,7 @@ __inline static int __scsi_merge_request
return 0;

if (!BH_PHYS_4G(req->bhtail, next->bh))
- return 0;
+ goto dont_combine;

/*
* The main question is whether the two segments at the boundaries