xfs
[Top] [All Lists]

Re: [PATCH 15/19] mkfs: don't treat files as though they are block devic

To: xfs@xxxxxxxxxxx
Subject: Re: [PATCH 15/19] mkfs: don't treat files as though they are block devices
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 7 Apr 2016 19:32:35 -0500
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <5706FA7C.7020103@xxxxxxxxxxx>
References: <1458818136-56043-1-git-send-email-jtulak@xxxxxxxxxx> <1458818136-56043-16-git-send-email-jtulak@xxxxxxxxxx> <5706FA7C.7020103@xxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

On 4/7/16 7:25 PM, Eric Sandeen wrote:
>> @@ -1299,15 +1370,23 @@ zero_old_xfs_structures(
>> >    }
>> >    memset(buf, 0, new_sb->sb_sectsize);
>> >  
>> > -  tmp = pread(xi->dfd, buf, new_sb->sb_sectsize, 0);
>> > -  if (tmp < 0) {
>> > +  off = pread(xi->dfd, buf, new_sb->sb_sectsize, 0);
>> > +  if (off < 0) {
>> >            fprintf(stderr, _("existing superblock read failed: %s\n"),
>> >                    strerror(errno));
>> >            goto done;
>> >    }
>> > -  if (tmp != new_sb->sb_sectsize) {
>> > -          fprintf(stderr,
>> > -  _("warning: could not read existing superblock, skip zeroing\n"));
>> > +  /*
>> > +   * If we are creating an image file, it might be of zero length at this
>> > +   * point in time. Hence reading the existing superblock is going to
>> > +   * return zero bytes. It's not a failure we need to warn about in this
>> > +   * case.
>> > +   */
> except you already did "if (off < 0) fail" above this.

(oh, right, < 0 is different than == 0, sorry; so that part is ok)

Possibly better as:

if (off < 0 || (tmp != new_sb->sb_sectsize && !xi->disfile))
        fprintf("error reading existing superblock ...")

I still think this patch might need a reset though :)

Thanks,
-Eric

> Ok, at this point I think it might be best to revert to Dave's original 
> version.
> 
> If there were specific problems you were trying to address, can you point 
> them out?
> 
> Thanks,
> -Eric
> 

<Prev in Thread] Current Thread [Next in Thread>