diff mbox series

[3/3] common/populate: change how we describe cached populated images

Message ID 161647319905.3429609.14862078528489327236.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series populate: fix a few bugs with fs pre-population | expand

Commit Message

Darrick J. Wong March 23, 2021, 4:19 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

The device name of a secondary storage device isn't all that important,
but the size is.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/populate |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Christoph Hellwig March 24, 2021, 6:11 p.m. UTC | #1
On Mon, Mar 22, 2021 at 09:19:59PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> The device name of a secondary storage device isn't all that important,
> but the size is.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  common/populate |   14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/common/populate b/common/populate
> index c01b7e0e..94bf5ce9 100644
> --- a/common/populate
> +++ b/common/populate
> @@ -808,13 +808,23 @@ _fill_fs()
>  _scratch_populate_cache_tag() {
>  	local extra_descr=""
>  	local size="$(blockdev --getsz "${SCRATCH_DEV}")"
> +	local logdev="none"
> +	local rtdev="none"
> +
> +	if [ "${USE_EXTERNAL}" = "yes" ] && [ -n "${SCRATCH_LOGDEV}" ]; then
> +		logdev="$(blockdev --getsz "${SCRATCH_LOGDEV}")"
> +	fi
> +
> +	if [ "${USE_EXTERNAL}" = "yes" ] && [ -n "${SCRATCH_RTDEV}" ]; then
> +		rtdev="$(blockdev --getsz "${SCRATCH_RTDEV}")"

Shouldn't these variables be called LOGDEV_SIZE and RTDEV_SIZE?
Darrick J. Wong March 24, 2021, 6:15 p.m. UTC | #2
On Wed, Mar 24, 2021 at 06:11:57PM +0000, Christoph Hellwig wrote:
> On Mon, Mar 22, 2021 at 09:19:59PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > The device name of a secondary storage device isn't all that important,
> > but the size is.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  common/populate |   14 ++++++++++++--
> >  1 file changed, 12 insertions(+), 2 deletions(-)
> > 
> > 
> > diff --git a/common/populate b/common/populate
> > index c01b7e0e..94bf5ce9 100644
> > --- a/common/populate
> > +++ b/common/populate
> > @@ -808,13 +808,23 @@ _fill_fs()
> >  _scratch_populate_cache_tag() {
> >  	local extra_descr=""
> >  	local size="$(blockdev --getsz "${SCRATCH_DEV}")"
> > +	local logdev="none"
> > +	local rtdev="none"
> > +
> > +	if [ "${USE_EXTERNAL}" = "yes" ] && [ -n "${SCRATCH_LOGDEV}" ]; then
> > +		logdev="$(blockdev --getsz "${SCRATCH_LOGDEV}")"
> > +	fi
> > +
> > +	if [ "${USE_EXTERNAL}" = "yes" ] && [ -n "${SCRATCH_RTDEV}" ]; then
> > +		rtdev="$(blockdev --getsz "${SCRATCH_RTDEV}")"
> 
> Shouldn't these variables be called LOGDEV_SIZE and RTDEV_SIZE?

Oops, yeah.

--D
diff mbox series

Patch

diff --git a/common/populate b/common/populate
index c01b7e0e..94bf5ce9 100644
--- a/common/populate
+++ b/common/populate
@@ -808,13 +808,23 @@  _fill_fs()
 _scratch_populate_cache_tag() {
 	local extra_descr=""
 	local size="$(blockdev --getsz "${SCRATCH_DEV}")"
+	local logdev="none"
+	local rtdev="none"
+
+	if [ "${USE_EXTERNAL}" = "yes" ] && [ -n "${SCRATCH_LOGDEV}" ]; then
+		logdev="$(blockdev --getsz "${SCRATCH_LOGDEV}")"
+	fi
+
+	if [ "${USE_EXTERNAL}" = "yes" ] && [ -n "${SCRATCH_RTDEV}" ]; then
+		rtdev="$(blockdev --getsz "${SCRATCH_RTDEV}")"
+	fi
 
 	case "${FSTYP}" in
 	"ext4")
-		extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL}"
+		extra_descr="LOGDEV_SIZE ${logdev}"
 		;;
 	"xfs")
-		extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL} RTDEV ${SCRATCH_RTDEV}"
+		extra_descr="LOGDEV_SIZE ${logdev} RTDEV_SIZE ${rtdev}"
 		_populate_xfs_qmount_option
 		if echo "${MOUNT_OPTIONS}" | grep -q 'usrquota'; then
 			extra_descr="${extra_descr} QUOTAS"