All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - lvresize: use standard extent conversion function
Date: Mon, 16 Jan 2023 11:39:11 +0000 (GMT)	[thread overview]
Message-ID: <20230116113911.CD2673858D32@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f486eb60d5cfb72f084b9e2c02e4dc962f26bb69
Commit:        f486eb60d5cfb72f084b9e2c02e4dc962f26bb69
Parent:        bb34ebd4e4facb3a12b799bc0541af798e091459
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Tue Jan 10 18:09:51 2023 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Jan 16 12:35:00 2023 +0100

lvresize: use standard extent conversion function

We need to validate whether the requested resizing size can be
expressed with given extent_size.
---
 lib/metadata/lv_manip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index f8eae0447..305be8578 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5197,7 +5197,8 @@ static int _lvresize_adjust_size(struct volume_group *vg,
 					display_size(vg->cmd, size));
 	}
 
-	*extents = size / extent_size;
+	if (!(*extents = extents_from_size(vg->cmd, size, extent_size)))
+		return_0;
 
 	return 1;
 }


                 reply	other threads:[~2023-01-16 11:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230116113911.CD2673858D32@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.