lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 27 Nov 2015 22:26:07 +0100
From:	Fabian Frederick <fabf@...net.be>
To:	linux-kernel@...r.kernel.org
Cc:	Philipp Reisner <philipp.reisner@...bit.com>,
	Fabian Frederick <fabf@...net.be>,
	Lars Ellenberg <lars.ellenberg@...bit.com>,
	drbd-dev@...ts.linbit.com
Subject: [PATCH 02/21] drbd: simplify drbd_md_set_sector_offsets()

Some metadata informations were duplicated in layout switch.

Signed-off-by: Fabian Frederick <fabf@...net.be>
---
 drivers/block/drbd/drbd_nl.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index c055c5e..ef136a9 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -794,20 +794,9 @@ static void drbd_md_set_sector_offsets(struct drbd_device *device,
 	unsigned int al_size_sect = bdev->md.al_size_4k * 8;
 
 	bdev->md.md_offset = drbd_md_ss(bdev);
+	md_size_sect = MD_128MB_SECT;
 
 	switch (bdev->md.meta_dev_idx) {
-	default:
-		/* v07 style fixed size indexed meta data */
-		bdev->md.md_size_sect = MD_128MB_SECT;
-		bdev->md.al_offset = MD_4kB_SECT;
-		bdev->md.bm_offset = MD_4kB_SECT + al_size_sect;
-		break;
-	case DRBD_MD_INDEX_FLEX_EXT:
-		/* just occupy the full device; unit: sectors */
-		bdev->md.md_size_sect = drbd_get_capacity(bdev->md_bdev);
-		bdev->md.al_offset = MD_4kB_SECT;
-		bdev->md.bm_offset = MD_4kB_SECT + al_size_sect;
-		break;
 	case DRBD_MD_INDEX_INTERNAL:
 	case DRBD_MD_INDEX_FLEX_INT:
 		/* al size is still fixed */
@@ -822,11 +811,20 @@ static void drbd_md_set_sector_offsets(struct drbd_device *device,
 		 * and the activity log; */
 		md_size_sect += MD_4kB_SECT + al_size_sect;
 
-		bdev->md.md_size_sect = md_size_sect;
 		/* bitmap offset is adjusted by 'super' block size */
 		bdev->md.bm_offset   = -md_size_sect + MD_4kB_SECT;
 		break;
+	case DRBD_MD_INDEX_FLEX_EXT:
+		/* just occupy the full device; unit: sectors */
+		md_size_sect = drbd_get_capacity(bdev->md_bdev);
+	default:
+		/* v07 style fixed size indexed meta data */
+		bdev->md.al_offset = MD_4kB_SECT;
+		bdev->md.bm_offset = MD_4kB_SECT + al_size_sect;
+		break;
 	}
+
+	bdev->md.md_size_sect = md_size_sect;
 }
 
 /* input size is expected to be in KB */
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists