forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "zpool reopen should detect expanded devices"
This reverts commit 2a16d4c. The commit was causing a "attempt to access beyond the end of device" error: list.zfsonlinux.org/pipermail/zfs-discuss/2018-September/032217.html
- Loading branch information
1 parent
d126980
commit 99310c0
Showing
6 changed files
with
42 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,23 +23,11 @@ | |
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). | ||
* Written by Brian Behlendorf <[email protected]>. | ||
* LLNL-CODE-403049. | ||
* Copyright (c) 2018 by Delphix. All rights reserved. | ||
*/ | ||
|
||
#ifndef _SYS_VDEV_DISK_H | ||
#define _SYS_VDEV_DISK_H | ||
|
||
/* | ||
* Don't start the slice at the default block of 34; many storage | ||
* devices will use a stripe width of 128k, other vendors prefer a 1m | ||
* alignment. It is best to play it safe and ensure a 1m alignment | ||
* given 512B blocks. When the block size is larger by a power of 2 | ||
* we will still be 1m aligned. Some devices are sensitive to the | ||
* partition ending alignment as well. | ||
*/ | ||
#define NEW_START_BLOCK 2048 | ||
#define PARTITION_END_ALIGNMENT 2048 | ||
|
||
#ifdef _KERNEL | ||
#include <sys/vdev.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
/* | ||
* Copyright 2015 Nexenta Systems, Inc. All rights reserved. | ||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2011, 2018 by Delphix. All rights reserved. | ||
* Copyright (c) 2011, 2014 by Delphix. All rights reserved. | ||
* Copyright 2016 Igor Kozhukhov <[email protected]> | ||
* Copyright (c) 2017 Datto Inc. | ||
*/ | ||
|
@@ -42,7 +42,6 @@ | |
#include <sys/efi_partition.h> | ||
#include <sys/vtoc.h> | ||
#include <sys/zfs_ioctl.h> | ||
#include <sys/vdev_disk.h> | ||
#include <dlfcn.h> | ||
|
||
#include "zfs_namecheck.h" | ||
|
@@ -935,6 +934,17 @@ zpool_prop_get_feature(zpool_handle_t *zhp, const char *propname, char *buf, | |
return (0); | ||
} | ||
|
||
/* | ||
* Don't start the slice at the default block of 34; many storage | ||
* devices will use a stripe width of 128k, other vendors prefer a 1m | ||
* alignment. It is best to play it safe and ensure a 1m alignment | ||
* given 512B blocks. When the block size is larger by a power of 2 | ||
* we will still be 1m aligned. Some devices are sensitive to the | ||
* partition ending alignment as well. | ||
*/ | ||
#define NEW_START_BLOCK 2048 | ||
#define PARTITION_END_ALIGNMENT 2048 | ||
|
||
/* | ||
* Validate the given pool name, optionally putting an extended error message in | ||
* 'buf'. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
|
||
/* | ||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2011, 2018 by Delphix. All rights reserved. | ||
* Copyright (c) 2011, 2015 by Delphix. All rights reserved. | ||
* Copyright 2017 Nexenta Systems, Inc. | ||
* Copyright (c) 2014 Integros [integros.com] | ||
* Copyright 2016 Toomas Soome <[email protected]> | ||
|
@@ -3039,6 +3039,7 @@ vdev_get_stats_ex(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx) | |
vd->vdev_max_asize - vd->vdev_asize, | ||
1ULL << tvd->vdev_ms_shift); | ||
} | ||
vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize; | ||
if (vd->vdev_aux == NULL && vd == vd->vdev_top && | ||
!vd->vdev_ishole) { | ||
vs->vs_fragmentation = vd->vdev_mg->mg_fragmentation; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). | ||
* Rewritten for Linux by Brian Behlendorf <[email protected]>. | ||
* LLNL-CODE-403049. | ||
* Copyright (c) 2012, 2018 by Delphix. All rights reserved. | ||
* Copyright (c) 2012, 2015 by Delphix. All rights reserved. | ||
*/ | ||
|
||
#include <sys/zfs_context.h> | ||
|
@@ -35,14 +35,10 @@ | |
#include <sys/zio.h> | ||
#include <sys/sunldi.h> | ||
#include <linux/mod_compat.h> | ||
#include <linux/msdos_fs.h> | ||
|
||
char *zfs_vdev_scheduler = VDEV_SCHEDULER; | ||
static void *zfs_vdev_holder = VDEV_HOLDER; | ||
|
||
/* size of the "reserved" partition, in blocks */ | ||
#define EFI_MIN_RESV_SIZE (16 * 1024) | ||
|
||
/* | ||
* Virtual device vector for disks. | ||
*/ | ||
|
@@ -86,39 +82,17 @@ vdev_bdev_mode(int smode) | |
} | ||
#endif /* HAVE_OPEN_BDEV_EXCLUSIVE */ | ||
|
||
/* The capacity (in bytes) of a bdev that is available to be used by a vdev */ | ||
static uint64_t | ||
bdev_capacity(struct block_device *bdev, boolean_t wholedisk) | ||
bdev_capacity(struct block_device *bdev) | ||
{ | ||
struct hd_struct *part = bdev->bd_part; | ||
uint64_t sectors = get_capacity(bdev->bd_disk); | ||
/* If there are no paritions, return the entire device capacity */ | ||
if (part == NULL) | ||
return (sectors << SECTOR_BITS); | ||
|
||
/* | ||
* If there are partitions, decide if we are using a `wholedisk` | ||
* layout (composed of part1 and part9) or just a single partition. | ||
*/ | ||
if (wholedisk) { | ||
/* Verify the expected device layout */ | ||
ASSERT3P(bdev, !=, bdev->bd_contains); | ||
/* | ||
* Sectors used by the EFI partition (part9) as well as | ||
* partion alignment. | ||
*/ | ||
uint64_t used = EFI_MIN_RESV_SIZE + NEW_START_BLOCK + | ||
PARTITION_END_ALIGNMENT; | ||
|
||
/* Space available to the vdev, i.e. the size of part1 */ | ||
if (sectors <= used) | ||
return (0); | ||
uint64_t available = sectors - used; | ||
return (available << SECTOR_BITS); | ||
} else { | ||
/* The partition capacity referenced by the block device */ | ||
return (part->nr_sects << SECTOR_BITS); | ||
} | ||
/* The partition capacity referenced by the block device */ | ||
if (part) | ||
return (part->nr_sects << 9); | ||
|
||
/* Otherwise assume the full device capacity */ | ||
return (get_capacity(bdev->bd_disk) << 9); | ||
} | ||
|
||
static void | ||
|
@@ -352,7 +326,9 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize, | |
v->vdev_nonrot = blk_queue_nonrot(bdev_get_queue(vd->vd_bdev)); | ||
|
||
/* Physical volume size in bytes */ | ||
*psize = bdev_capacity(vd->vd_bdev, v->vdev_wholedisk); | ||
*psize = bdev_capacity(vd->vd_bdev); | ||
|
||
/* TODO: report possible expansion size */ | ||
*max_psize = *psize; | ||
|
||
/* Based on the minimum sector size set the block size */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters