All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <mason@suse.com>
To: linux-lvm@sistina.com
Subject: [linux-lvm] [PATCH] snapshots on unaligned lvs
Date: Thu, 11 Oct 2001 14:16:36 -0400	[thread overview]
Message-ID: <1383150000.1002824196@tiny> (raw)

Hello everyone,

This patch fixes 1.0.1-rc4 to be able to take snapshots of unaligned
logical volumes (created by some of the betas).  It also fixes
a counting error in the loop in lvm_snapshot_COW.

Nothing fancy here, I just changed it to use the hard sector size
as the blocksize sent to brw_kiovec.  I've tested with beta7 and
rc4 logical volumes, additional testing is more than welcome.

-chris

--- 0.36/drivers/md/lvm-snap.c Thu, 11 Oct 2001 10:17:22 -0400 
+++ 0.36(w)/drivers/md/lvm-snap.c Thu, 11 Oct 2001 14:11:50 -0400 
@@ -326,6 +326,7 @@
 {
 	const char * reason;
 	unsigned long org_start, snap_start, snap_phys_dev, virt_start, pe_off;
+	unsigned long phys_start ;
 	int idx = lv_snap->lv_remap_ptr, chunk_size = lv_snap->lv_chunk_size;
 	struct kiobuf * iobuf;
 	unsigned long blocks[KIO_MAX_SECTORS];
@@ -360,8 +361,14 @@
 
 	iobuf = lv_snap->lv_iobuf;
 
-	blksize_org = lvm_get_blksize(org_phys_dev);
-	blksize_snap = lvm_get_blksize(snap_phys_dev);
+	blksize_org = get_hardsect_size(org_phys_dev);
+	blksize_snap = get_hardsect_size(snap_phys_dev);
+
+	/* org_start must not change, we use it later on to fill in the
+	** exception table
+	*/
+	phys_start = org_start ;
+
 	max_blksize = max(blksize_org, blksize_snap);
 	min_blksize = min(blksize_org, blksize_snap);
 	max_sectors = KIO_MAX_SECTORS * (min_blksize>>9);
@@ -376,7 +383,7 @@
 
 		iobuf->length = nr_sectors << 9;
 
-		if(!lvm_snapshot_prepare_blocks(blocks, org_start,
+		if(!lvm_snapshot_prepare_blocks(blocks, phys_start,
 						nr_sectors, blksize_org))
 			goto fail_prepare;
 
@@ -391,6 +398,9 @@
 		if (__brw_kiovec(WRITE, 1, &iobuf, snap_phys_dev, blocks,
 				 blksize_snap, lv_snap) != (nr_sectors<<9))
 			goto fail_raw_write;
+
+		phys_start += nr_sectors ;
+		snap_start += nr_sectors ;
 	}
 
 #ifdef DEBUG_SNAPSHOT
@@ -605,7 +615,7 @@
 	snap_phys_dev = lv_snap->lv_block_exception[idx].rdev_new;
 	snap_pe_start = lv_snap->lv_block_exception[idx - (idx % COW_entries_per_pe)].rsector_new - lv_snap->lv_chunk_size;
 
-	blksize_snap = lvm_get_blksize(snap_phys_dev);
+	blksize_snap = get_hardsect_size(snap_phys_dev);
 
         COW_entries_per_block = blksize_snap / sizeof(lv_COW_table_disk_t);
         idx_COW_table = idx % COW_entries_per_pe % COW_entries_per_block;
@@ -654,7 +664,7 @@
 			idx++;
 			snap_phys_dev = lv_snap->lv_block_exception[idx].rdev_new;
 			snap_pe_start = lv_snap->lv_block_exception[idx - (idx % COW_entries_per_pe)].rsector_new - lv_snap->lv_chunk_size;
-			blksize_snap = lvm_get_blksize(snap_phys_dev);
+			blksize_snap = get_hardsect_size(snap_phys_dev);
 			blocks[0] = snap_pe_start >> (blksize_snap >> 10);
 		} else blocks[0]++;
 

             reply	other threads:[~2001-10-11 18:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-11 18:16 Chris Mason [this message]
2001-10-11 20:56 ` [linux-lvm] [PATCH] snapshots on unaligned lvs Andreas Dilger

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=1383150000.1002824196@tiny \
    --to=mason@suse.com \
    --cc=linux-lvm@sistina.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.