linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dilger, Andreas" <andreas.dilger@intel.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: return non-zero st_blocks for inline data
Date: Fri, 8 Nov 2013 12:25:30 +0000	[thread overview]
Message-ID: <CEA2256B.7F605%andreas.dilger@intel.com> (raw)
In-Reply-To: <20131108034504.GC11668@thunk.org>

On 2013/11/07 8:45 PM, "Theodore Ts'o" <tytso@mit.edu> wrote:

>On Wed, Nov 06, 2013 at 03:42:32AM -0700, Andreas Dilger wrote:
>> @@ -4542,9 +4551,9 @@ int ext4_getattr(struct vfsmount *mnt, struct
>>dentry *dentry,
>>  	 * blocks for this file.
>>  	 */
>>  	delalloc_blocks = EXT4_C2B(EXT4_SB(inode->i_sb),
>> -				EXT4_I(inode)->i_reserved_data_blocks);
>> +				   EXT4_I(inode)->i_reserved_data_blocks);
>> +	stat->blocks += delalloc_blocks << (inode->i_sb->s_blocksize_bits -
>>9);
>>  
>> -	stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9;
>
>Why this change to the calculation to stat->blocks?

Just code cleanup.  The lack of spaces around ">>9" irked me.

The calculation is the same (s_blocksize_bits can never be less than 10
for ext* filesystems), but avoids doing two separate shifts that the
compiler cannot optimize together due to parenthesis and potential side
effects (e.g. this kind of operation could be used to mask off the top
bits, but isn't doing so here).

Cheers, Andreas
-- 
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division



  reply	other threads:[~2013-11-08 12:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 10:42 [PATCH] ext4: return non-zero st_blocks for inline data Andreas Dilger
2013-11-08  3:45 ` Theodore Ts'o
2013-11-08 12:25   ` Dilger, Andreas [this message]
2013-11-12  3:44 ` Theodore Ts'o

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=CEA2256B.7F605%andreas.dilger@intel.com \
    --to=andreas.dilger@intel.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).