linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Dave Chinner <david@fromorbit.com>,
	Eric Sandeen <sandeen@redhat.com>,
	linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 1/3] libxfs: handle 0 blocksize or sectorsize in cvtnum
Date: Wed, 23 Aug 2017 13:24:00 -0700	[thread overview]
Message-ID: <20170823202400.GB4796@magnolia> (raw)
In-Reply-To: <c7dfc3a9-25a2-fc6a-e429-4933a908a4ca@sandeen.net>

On Wed, Aug 23, 2017 at 03:18:45PM -0500, Eric Sandeen wrote:
> 
> 
> On 8/23/17 3:14 PM, Darrick J. Wong wrote:
> > On Tue, Aug 22, 2017 at 09:13:03PM -0500, Eric Sandeen wrote:
> >> On 8/22/17 8:01 PM, Dave Chinner wrote:
> >>> On Tue, Aug 22, 2017 at 04:12:48PM -0500, Eric Sandeen wrote:
> >>>> Blocksize and sectorsize are unique in that they must
> >>>> be provided, unlike every other suffix which can be
> >>>> calculated from constants.
> >>>>
> >>>> Nothing protects against unspecified block & sector size,
> >>>> so catch it if it happens and return a parsing error.
> >>>>
> >>>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> >>>> ---
> >>>>
> >>>> diff --git a/libxcmd/input.c b/libxcmd/input.c
> >>>> index 7a69dc1..7b86225 100644
> >>>> --- a/libxcmd/input.c
> >>>> +++ b/libxcmd/input.c
> >>>> @@ -330,8 +330,12 @@ cvtnum(
> >>>>  	c = tolower(*sp);
> >>>>  	switch (c) {
> >>>>  	case 'b':
> >>>> +		if (!blocksize)
> >>>> +			return -1LL;
> >>>>  		return i * blocksize;
> >>>>  	case 's':
> >>>> +		if (!sectorsize)
> >>>> +			return -1LL;
> >>>>  		return i * sectorsize;
> >>>>  	case 'k':
> >>>>  		return KILOBYTES(i);
> >>>
> >>> With this you could have mkfs call the generic function, too.
> >>
> >> Yep, or at least closer; mkfs does a printf and usage()/exit()
> >> and it indicates a user error (most likely)
> >>
> >> in libxcmd/xfs_io it's more of a programming error, with no 
> >> printf to the user at least today... so would need a little more
> >> finessing.
> > 
> > This series looks mostly fine to me, but I'm wondering if io_cvtnum
> > should be promoted so that mkfs/spaceman/quota/etc can take advantage of
> > it too?
> 
> I thought about that, but it relies on the global var "file" that io uses,
> which seems a bit unique to io, no?

Spaceman has it too.

I guess quota does its own weird thing...

--D

> 
> -Eric
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-08-23 20:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 21:11 [PATCH 0/3] libxfs: tidy up cvtnum junk Eric Sandeen
2017-08-22 21:12 ` [PATCH 1/3] libxfs: handle 0 blocksize or sectorsize in cvtnum Eric Sandeen
2017-08-23  1:01   ` Dave Chinner
2017-08-23  2:13     ` Eric Sandeen
2017-08-23 20:14       ` Darrick J. Wong
2017-08-23 20:18         ` Eric Sandeen
2017-08-23 20:24           ` Darrick J. Wong [this message]
2017-08-22 21:16 ` [PATCH 2/3] xfs_io: get foreign blocksize & sector size in openfile Eric Sandeen
2017-08-22 21:19 ` [PATCH 3/3] xfs_io: add io_cvtnum wrapper Eric Sandeen
2017-08-22 21:22 ` [PATCH 4/3] xfs_quota: remove dodgy init_cvtnum Eric Sandeen

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=20170823202400.GB4796@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=sandeen@sandeen.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).