All of lore.kernel.org
 help / color / mirror / Atom feed
From: abhi.c.pawar@gmail.com (Abhijit Pawar)
To: kernelnewbies@lists.kernelnewbies.org
Subject: ext2_find_near()
Date: Thu, 15 Nov 2012 12:30:36 +0530	[thread overview]
Message-ID: <50A49314.4080804@gmail.com> (raw)
In-Reply-To: <1352864697.60457.YahooMailNeo@web164601.mail.gq1.yahoo.com>

On 11/14/2012 09:14 AM, Anders Lind wrote:
> Hi all,
> 
> Sorry to bother.
> for ext2_find_near(), why we tro to find near block by tring priveous block? Why not forward?
> 
> 
> static ext2_fsblk_t ext2_find_near(struct inode *inode, Indirect *ind)
> {
>     struct ext2_inode_info *ei = EXT2_I(inode);
>     __le32 *start = ind->bh ? (__le32 *) ind->bh->b_data : ei->i_data;
>     __le32 *p;
>     ext2_fsblk_t bg_start;
>     ext2_fsblk_t colour;
> 
>     /* Try to find previous block */
>     for (p = ind->p - 1; p >= start; p--)
>         if (*p)
>             return le32_to_cpu(*p);
> 
>     /* No such thing, so let's try location of indirect block */
>     if (ind->bh)
>         return ind->bh->b_blocknr;
> 
> 
> 
> 
> 
> 
> Thank you!
> 
> 
To reduce the file fragmentation problem, EXT2 tries to get the block
near the block which is already allocated. So we backtrack to see if we
have any block free which is already there in our list instead of
allocating a new block in some other group.

> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 


-- 
-
Abhijit

      reply	other threads:[~2012-11-15  7:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14  3:44 ext2_find_near() Anders Lind
2012-11-15  7:00 ` Abhijit Pawar [this message]

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=50A49314.4080804@gmail.com \
    --to=abhi.c.pawar@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.