linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <Anand.Jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] btrfs-progs: mkfs should check for small vol well before
Date: Sat, 31 Aug 2013 13:29:53 +0800	[thread overview]
Message-ID: <52217F51.4000706@oracle.com> (raw)
In-Reply-To: <20130830232233.GV23113@twin.jikos.cz>




On 08/31/2013 07:22 AM, David Sterba wrote:
> On Fri, Aug 30, 2013 at 04:50:37PM +0800, Anand Jain wrote:
>> This fix the regression introduced by 830427d
>
> ie. that's
> "btrfs-progs: avoid write to the disk before sure to create fs"
>
> please note that the commit id is not stable and may change during
> integration branch updates.
>
> I was not sure if the patch is all ok and had put it into
> integration-next branch (that serves me as a unstable area for things
> that I'd like to look at again). The patch caused Josef some headaches
> and I've left it out from recent integration branches until the problems
> are resolved. With the patch in this email you do so, but let me do more
> testing and then I'll integrate it.

  Thanks for taking care of this David. Let me know if anywhere
  needs more explanation.
  I have been introducing series of device related changes in
  btrfs-progs/mkfs which were/is essential bug fix. Fixes looks
  complex since originally btrfs-progs/mkfs didn't create and
  use much of helper functions in this area, now with these
  fixes its much modular and better.


>> --- a/utils.c
>> +++ b/utils.c
>> @@ -1964,3 +1964,32 @@ int scan_for_btrfs(int where, int update_kernel)
>> +int is_vol_small(char *file)
>> +{
>> +	int fd = -1;
>> +	int e;
>> +	struct stat st;
>> +	u64 size;
>> +
>> +	fd = open(file, O_RDONLY);
>> +	if (fd < 0)
>> +		return -errno;
>> +	if (fstat(fd, &st) < 0) {
>> +		e = -errno;
>> +		close(fd);
>> +		return e;
>> +	}
>> +	size = btrfs_device_size(fd, &st);
>> +	if (size == 0) {
>> +		close(fd);
>> +		return -1;
>> +	}
>> +	if (size < 1024 * 1024 * 1024) {
>
> Would be good to use a properly named constant instead of the magic
> number.

  Yeah I notice that, but didn't want to change from the Original.
  There are other places where this constant is needed as well,
  will spin a separate patch for that hope that's fine.

Thanks
Anand

> thanks,
> david
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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:[~2013-08-31  5:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-16 12:52 [PATCH] btrfs-progs: mkfs should check for small vol well before Anand Jain
2013-08-30  8:42 ` [PATCH] btrfs-progs: use btrfs error code for kernel errors Anand Jain
2013-08-30  8:50 ` [PATCH v2] btrfs-progs: mkfs should check for small vol well before Anand Jain
2013-08-30 23:22   ` David Sterba
2013-08-31  5:29     ` Anand Jain [this message]
2013-09-03 17:53       ` David Sterba

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=52217F51.4000706@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /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).