public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] fs:ext4:cleanup: Remove superfluous code
Date: Mon, 05 May 2014 07:20:55 +0200	[thread overview]
Message-ID: <20140505072055.4664a0e8@amdc2363> (raw)
In-Reply-To: <CAPnjgZ1KLqJ3YMSzjsTbxo_8j_Us9EBYd5r-2sxAJb2ro1RDww@mail.gmail.com>

Hi Simon,

> On 30 April 2014 03:39, Lukasz Majewski <l.majewski@samsung.com>
> wrote:
> > Code responsible for handling situation when ext4 has block size of
> > 1024B can be ordered to take less space.
> >
> > This patch does that for ext4 common and write files.
> >
> > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> > ---
> >  fs/ext4/ext4_common.c |    6 ++----
> >  fs/ext4/ext4_write.c  |   50
> > ++++++++++++++++--------------------------------- 2 files changed,
> > 18 insertions(+), 38 deletions(-)
> >
> > diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
> > index 02da75c..62e2e80 100644
> > --- a/fs/ext4/ext4_common.c
> > +++ b/fs/ext4/ext4_common.c
> [snip]
> 
> > @@ -181,10 +179,8 @@ static void
> > delete_double_indirect_block(struct ext2_inode *inode) break;
> >
> >                         debug("DICB releasing %u\n", *di_buffer);
> > -                       if (fs->blksz != 1024) {
> > -                               bg_idx = (*di_buffer) / blk_per_grp;
> > -                       } else {
> > -                               bg_idx = (*di_buffer) / blk_per_grp;
> > +                       bg_idx = (*di_buffer) / blk_per_grp;
> 
> You don't need the brackets here (or below).

Maybe the GIT formatting is a bit misleading, but I've double checked
and it seems that those parenthesis are necessary here.

> 
> > +                       if (fs->blksz == 1024) {
> >                                 remainder = (*di_buffer) %
> > blk_per_grp; if (!remainder)
> >                                         bg_idx--;
> > @@ -213,10 +209,8 @@ static void
> > delete_double_indirect_block(struct ext2_inode *inode)
> >
> >                 /* removing the parent double indirect block */
> >                 blknr = inode->b.blocks.double_indir_block;
> > -               if (fs->blksz != 1024) {
> > -                       bg_idx = blknr / blk_per_grp;
> > -               } else {
> > -                       bg_idx = blknr / blk_per_grp;
> > +               bg_idx = blknr / blk_per_grp;
> > +               if (fs->blksz == 1024) {
> >                         remainder = blknr % blk_per_grp;
> >                         if (!remainder)
> >                                 bg_idx--;
> > @@ -293,11 +287,8 @@ static void
> > delete_triple_indirect_block(struct ext2_inode *inode) for (j = 0;
> > j < fs->blksz / sizeof(int); j++) { if (*tip_buffer == 0)
> >                                         break;
> > -                               if (fs->blksz != 1024) {
> > -                                       bg_idx = (*tip_buffer) /
> > blk_per_grp;
> > -                               } else {
> > -                                       bg_idx = (*tip_buffer) /
> > blk_per_grp; -
> > +                               bg_idx = (*tip_buffer) /
> > blk_per_grp;
> > +                               if (fs->blksz == 1024) {
> >                                         remainder = (*tip_buffer) %
> > blk_per_grp; if (!remainder)
> >                                                 bg_idx--;
> > @@ -336,11 +327,8 @@ static void
> > delete_triple_indirect_block(struct ext2_inode *inode)
> >                          * removing the grand parent blocks
> >                          * which is connected to inode
> >                          */
> > -                       if (fs->blksz != 1024) {
> > -                               bg_idx = (*tigp_buffer) /
> > blk_per_grp;
> > -                       } else {
> > -                               bg_idx = (*tigp_buffer) /
> > blk_per_grp; -
> > +                       bg_idx = (*tigp_buffer) / blk_per_grp;
> > +                       if (fs->blksz == 1024) {
> >                                 remainder = (*tigp_buffer) %
> > blk_per_grp; if (!remainder)
> >                                         bg_idx--;
> > @@ -371,10 +359,8 @@ static void
> > delete_triple_indirect_block(struct ext2_inode *inode)
> >
> >                 /* removing the grand parent triple indirect block
> > */ blknr = inode->b.blocks.triple_indir_block;
> > -               if (fs->blksz != 1024) {
> > -                       bg_idx = blknr / blk_per_grp;
> > -               } else {
> > -                       bg_idx = blknr / blk_per_grp;
> > +               bg_idx = blknr / blk_per_grp;
> > +               if (fs->blksz == 1024) {
> >                         remainder = blknr % blk_per_grp;
> >                         if (!remainder)
> >                                 bg_idx--;
> > @@ -452,10 +438,8 @@ static int ext4fs_delete_file(int inodeno)
> >
> >                 for (i = 0; i < no_blocks; i++) {
> >                         blknr =
> > read_allocated_block(&(node_inode->inode), i);
> > -                       if (fs->blksz != 1024) {
> > -                               bg_idx = blknr / blk_per_grp;
> > -                       } else {
> > -                               bg_idx = blknr / blk_per_grp;
> > +                       bg_idx = blknr / blk_per_grp;
> > +                       if (fs->blksz == 1024) {
> >                                 remainder = blknr % blk_per_grp;
> >                                 if (!remainder)
> >                                         bg_idx--;
> > @@ -499,10 +483,8 @@ static int ext4fs_delete_file(int inodeno)
> >                         no_blocks++;
> >                 for (i = 0; i < no_blocks; i++) {
> >                         blknr = read_allocated_block(&inode, i);
> > -                       if (fs->blksz != 1024) {
> > -                               bg_idx = blknr / blk_per_grp;
> > -                       } else {
> > -                               bg_idx = blknr / blk_per_grp;
> > +                       bg_idx = blknr / blk_per_grp;
> > +                       if (fs->blksz == 1024) {
> >                                 remainder = blknr % blk_per_grp;
> >                                 if (!remainder)
> >                                         bg_idx--;
> > --
> > 1.7.10.4
> >



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

  reply	other threads:[~2014-05-05  5:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 10:39 [U-Boot] [PATCH 0/2] fs:ext4: Fixes and code cleanup Lukasz Majewski
2014-04-30 10:39 ` [U-Boot] [PATCH 1/2] fs:ext4:cleanup: Remove superfluous code Lukasz Majewski
2014-04-30 19:15   ` Simon Glass
2014-05-05  5:20     ` Lukasz Majewski [this message]
2014-05-05 14:24       ` Simon Glass
2014-05-05 21:10         ` Lukasz Majewski
2014-05-05 21:12           ` Simon Glass
2014-04-30 10:39 ` [U-Boot] [PATCH 2/2] fs:ext4:write:fix: Reinitialize global variables after updating a file Lukasz Majewski
2014-04-30 19:21   ` Simon Glass
2014-05-05  5:52     ` Lukasz Majewski
2014-05-06  7:36 ` [U-Boot] [PATCH v2 0/2] fs:ext4: Fixes and code cleanup Lukasz Majewski
2014-05-06  7:36   ` [U-Boot] [PATCH v2 1/2] fs:ext4:cleanup: Remove superfluous code Lukasz Majewski
2014-05-13  1:54     ` [U-Boot] [U-Boot, v2, " Tom Rini
2014-05-06  7:36   ` [U-Boot] [PATCH v2 2/2] fs:ext4:write:fix: Reinitialize global variables after updating a file Lukasz Majewski
2014-05-13  1:54     ` [U-Boot] [U-Boot, v2, " Tom Rini

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=20140505072055.4664a0e8@amdc2363 \
    --to=l.majewski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /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