common/populate: change how we describe cached populated images
authorDarrick J. Wong <djwong@kernel.org>
Wed, 24 Mar 2021 18:17:48 +0000 (11:17 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 28 Mar 2021 15:16:41 +0000 (23:16 +0800)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/populate

index c01b7e0..d484866 100644 (file)
@@ -808,13 +808,23 @@ _fill_fs()
 _scratch_populate_cache_tag() {
        local extra_descr=""
        local size="$(blockdev --getsz "${SCRATCH_DEV}")"
+       local logdev_sz="none"
+       local rtdev_sz="none"
+
+       if [ "${USE_EXTERNAL}" = "yes" ] && [ -n "${SCRATCH_LOGDEV}" ]; then
+               logdev_sz="$(blockdev --getsz "${SCRATCH_LOGDEV}")"
+       fi
+
+       if [ "${USE_EXTERNAL}" = "yes" ] && [ -n "${SCRATCH_RTDEV}" ]; then
+               rtdev_sz="$(blockdev --getsz "${SCRATCH_RTDEV}")"
+       fi
 
        case "${FSTYP}" in
        "ext4")
-               extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL}"
+               extra_descr="LOGDEV_SIZE ${logdev_sz}"
                ;;
        "xfs")
-               extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL} RTDEV ${SCRATCH_RTDEV}"
+               extra_descr="LOGDEV_SIZE ${logdev_sz} RTDEV_SIZE ${rtdev_sz}"
                _populate_xfs_qmount_option
                if echo "${MOUNT_OPTIONS}" | grep -q 'usrquota'; then
                        extra_descr="${extra_descr} QUOTAS"