public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Andreas Dilger <adilger@sun.com>
Cc: Josef Bacik <jbacik@redhat.com>, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] fiemap support for ext3
Date: Wed, 23 Apr 2008 18:48:25 -0500	[thread overview]
Message-ID: <480FCAC9.8050105@redhat.com> (raw)
In-Reply-To: <20080423232725.GK3095@webber.adilger.int>

Andreas Dilger wrote:
> On Apr 23, 2008  15:39 -0400, Josef Bacik wrote:

>> +	/*
>> +	 * we want the comparisons to be unsigned, in case somebody passes -1,
>> +	 * meaning they want they want the entire file, but the result has to be
>> +	 * signed so we can handle the case where we get more blocks than the
>> +	 * size of the file
>> +	 */
>> +	length = (long)min((unsigned long)fiemap_s->fm_length,
>> +			   (unsigned long)i_size_read(inode));
> 
> This might be written as:
> 
> 	length = (long)min_t(unsigned long,fiemap_s->fm_len,i_size_read(inode));
> 
> Also, what about files that have blocks mapped after i_size?

That'll be tough for ext3, though I guess for a generic interface it
could happen, so I guess it needs to be handled.  Maybe check i_blocks
against i_size, see if i_blocks indicates blocks past EOF?  Hm, I guess
that's not going to work in general; you could be completely sparse up
to an EOF at 100G and have 100M of blocks past that...

I don't know how you'd handle this in the generic case...?

-Eric

  reply	other threads:[~2008-04-23 23:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-23 19:39 [PATCH] fiemap support for ext3 Josef Bacik
2008-04-23 23:27 ` Andreas Dilger
2008-04-23 23:48   ` Eric Sandeen [this message]
2008-04-24  2:56     ` Andreas Dilger
2008-04-24  2:58   ` Andreas Dilger
2008-04-24 12:36     ` Josef Bacik
2008-04-24 12:52       ` Eric Sandeen
2008-04-24 12:46         ` Josef Bacik
2008-04-24 14:59       ` Andreas Dilger

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=480FCAC9.8050105@redhat.com \
    --to=sandeen@redhat.com \
    --cc=adilger@sun.com \
    --cc=jbacik@redhat.com \
    --cc=linux-ext4@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