Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278984

[PATCH 02/21] drbd: simplify drbd_md_set_sector_offsets()

From Fabian Frederick <fabf@skynet.be>
Newsgroups linux.kernel
Subject [PATCH 02/21] drbd: simplify drbd_md_set_sector_offsets()
Date 2015-11-27 22:30 +0100
Message-ID <qzyKC-89k-9@gated-at.bofh.it> (permalink)
References <qzyKC-89k-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Some metadata informations were duplicated in layout switch.

Signed-off-by: Fabian Frederick <fabf@skynet.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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/21] drbd: clean-up patchset Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
  [PATCH 02/21] drbd: simplify drbd_md_set_sector_offsets() Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
  [PATCH 01/21] drbd: debugfs: constify drbd_version_fops Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
  [PATCH 06/21] drbd: use const char * const for drbd strings Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
  [PATCH 11/21] drbd: use | for bitmask combination Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
  [PATCH 10/21] drbd: fix typo Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
    [PATCH 17/21] drbd: use bool for growing Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
    [PATCH 13/21] drbd: fix drbd_bm_init() comments Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
    [PATCH 18/21] drbd: remove redundant declarations Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
    [PATCH 14/21] drbd: clean-up receive_SyncParam() Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
    [PATCH 15/21] drbd: introduce peer state union Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
    [PATCH 12/21] drbd: use true/false for bool Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
    [PATCH 19/21] drbd: remove bm_vk_free() Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
    [PATCH 16/21] drbd: fix maybe_pull_ahead() locking comments Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
  [PATCH 09/21] drbd: use bool for peer is_ states Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
  [PATCH 03/21] drbd: use seq_put instead of seq_print where possible Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
  [PATCH 05/21] drbd: rework is_valid_state() Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
  [PATCH 07/21] drbd: kerneldoc warning fix in w_e_end_data_req() Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
  [PATCH 21/21] drbd: replace if/BUG by BUG_ON Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
  [PATCH 20/21] drbd: remove unused definitions Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100

csiph-web