From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org, torvalds@osdl.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
"Theodore Ts'o" <tytso@mit.edu>,
Randy Dunlap <rdunlap@xenotime.net>,
Dave Jones <davej@redhat.com>,
Chuck Wolber <chuckw@quantumlinux.com>,
akpm@osdl.org, alan@lxorguk.ukuu.org.uk, abhishekgupt@gmail.com,
danms@us.ibm.com, agk@redhat.com,
Chris Wright <chrisw@sous-sol.org>,
Greg Kroah-Hartman <gregkh@suse.de>
Subject: [patch 14/20] dm: bio split bvec fix
Date: Fri, 24 Mar 2006 20:27:38 -0800 [thread overview]
Message-ID: <20060325042738.GO21260@kroah.com> (raw)
In-Reply-To: <20060325042556.GA21260@kroah.com>
[-- Attachment #1: dm-bio-split-bvec-fix.patch --]
[-- Type: text/plain, Size: 2364 bytes --]
-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alasdair G Kergon <agk@redhat.com>
The code that handles bios that span table target boundaries by breaking
them up into smaller bios will not split an individual struct bio_vec into
more than two pieces. Sometimes more than that are required.
This patch adds a loop to break the second piece up into as many pieces as
are necessary.
Cc: "Abhishek Gupta" <abhishekgupt@gmail.com>
Cc: Dan Smith <danms@us.ibm.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/md/dm.c | 45 +++++++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 20 deletions(-)
--- linux-2.6.16.orig/drivers/md/dm.c
+++ linux-2.6.16/drivers/md/dm.c
@@ -533,30 +533,35 @@ static void __clone_and_map(struct clone
} else {
/*
- * Create two copy bios to deal with io that has
- * been split across a target.
+ * Handle a bvec that must be split between two or more targets.
*/
struct bio_vec *bv = bio->bi_io_vec + ci->idx;
+ sector_t remaining = to_sector(bv->bv_len);
+ unsigned int offset = 0;
- clone = split_bvec(bio, ci->sector, ci->idx,
- bv->bv_offset, max);
- __map_bio(ti, clone, tio);
-
- ci->sector += max;
- ci->sector_count -= max;
- ti = dm_table_find_target(ci->map, ci->sector);
-
- len = to_sector(bv->bv_len) - max;
- clone = split_bvec(bio, ci->sector, ci->idx,
- bv->bv_offset + to_bytes(max), len);
- tio = alloc_tio(ci->md);
- tio->io = ci->io;
- tio->ti = ti;
- memset(&tio->info, 0, sizeof(tio->info));
- __map_bio(ti, clone, tio);
+ do {
+ if (offset) {
+ ti = dm_table_find_target(ci->map, ci->sector);
+ max = max_io_len(ci->md, ci->sector, ti);
+
+ tio = alloc_tio(ci->md);
+ tio->io = ci->io;
+ tio->ti = ti;
+ memset(&tio->info, 0, sizeof(tio->info));
+ }
+
+ len = min(remaining, max);
+
+ clone = split_bvec(bio, ci->sector, ci->idx,
+ bv->bv_offset + offset, len);
+
+ __map_bio(ti, clone, tio);
+
+ ci->sector += len;
+ ci->sector_count -= len;
+ offset += to_bytes(len);
+ } while (remaining -= len);
- ci->sector += len;
- ci->sector_count -= len;
ci->idx++;
}
}
--
next prev parent reply other threads:[~2006-03-25 4:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060325041355.180237000@quad.kroah.org>
2006-03-25 4:25 ` [patch 00/20] 2.6.16.1 Stable review Greg KH
2006-03-25 4:26 ` [patch 01/20] sata_mv: fix irq port status usage Greg KH
2006-03-25 4:26 ` [patch 02/20] V4L/DVB (3324): Fix Samsung tuner frequency ranges Greg KH
2006-03-25 4:26 ` [patch 03/20] Kconfig: VIDEO_DECODER must select FW_LOADER Greg KH
2006-03-25 13:23 ` Mauro Carvalho Chehab
2006-03-25 4:26 ` [patch 04/20] 2.6.xx: sata_mv: another critical fix Greg KH
2006-03-25 4:26 ` [patch 05/20] TCP: Do not use inet->id of global tcp_socket when sending RST (CVE-2006-1242) Greg KH
2006-03-25 4:26 ` [patch 06/20] sysfs: sysfs_remove_dir() needs to invalidate the dentry Greg KH
2006-03-25 4:26 ` [patch 07/20] firmware: fix BUG: in fw_realloc_buffer Greg KH
2006-03-25 4:27 ` [patch 08/20] get_cpu_sysdev() signedness fix Greg KH
2006-03-25 4:27 ` [patch 09/20] sysfs: fix a kobject leak in sysfs_add_link on the error path Greg KH
2006-03-25 4:27 ` [patch 10/20] XFS writeout fix Greg KH
2006-03-25 4:27 ` [patch 11/20] NET: Ensure device name passed to SO_BINDTODEVICE is NULL terminated Greg KH
2006-03-25 4:27 ` [patch 12/20] i810fb_cursor(): use GFP_ATOMIC Greg KH
2006-03-25 4:27 ` [patch 13/20] v9fs: assign dentry ops to negative dentries Greg KH
2006-03-25 4:27 ` Greg KH [this message]
2006-03-25 4:27 ` [patch 15/20] rtc.h broke strace(1) builds Greg KH
2006-03-25 4:27 ` [patch 16/20] proc: fix duplicate line in /proc/devices Greg KH
2006-03-25 4:27 ` [patch 17/20] fix scheduler deadlock Greg KH
2006-03-25 4:27 ` [patch 18/20] DM: Fix bug: BIO_RW_BARRIER requests to md/raid1 hang Greg KH
2006-03-25 4:28 ` [patch 19/20] cciss: fix use-after-free in cciss_init_one Greg KH
2006-03-25 4:28 ` [patch 20/20] DMI: fix DMI onboard device discovery Greg KH
2006-03-25 6:48 ` [patch 21/20] Fix speedstep-smi assembly bug in speedstep_smi_ownership Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060325042738.GO21260@kroah.com \
--to=gregkh@suse.de \
--cc=abhishekgupt@gmail.com \
--cc=agk@redhat.com \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=chrisw@sous-sol.org \
--cc=chuckw@quantumlinux.com \
--cc=danms@us.ibm.com \
--cc=davej@redhat.com \
--cc=jmforbes@linuxtx.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=stable@kernel.org \
--cc=torvalds@osdl.org \
--cc=tytso@mit.edu \
--cc=zwane@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox