All of lore.kernel.org
 help / color / mirror / Atom feed
* ext2_find_near
@ 2008-07-31 14:47 Rohit Sharma
  2008-07-31 16:23 ` ext2_find_near Theodore Tso
  0 siblings, 1 reply; 2+ messages in thread
From: Rohit Sharma @ 2008-07-31 14:47 UTC (permalink / raw)
  To: ext4

Hi all,

I was going through the function "ext2_find_near" in inode.c and could not
interpret the meaning of the last part of this code :

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;

       /*
        * It is going to be refered from inode itself? OK, just put it into
        * the same cylinder group then.
        */

       bg_start = ext2_group_first_block_no(inode->i_sb, ei->i_block_group);

       / * what does the code below do?? why its is using pid of
current process?? */

       colour = (current->pid % 16) *
                       (EXT2_BLOCKS_PER_GROUP(inode->i_sb) / 16);
      return bg_start + colour;
}


What I understand from it is that it has something to do with reducing
the chances of a concurrent allocation -- supposedly from a different
PID.

Can someone just explain a bit on this, what exactly is happening ?

Thanks,
Rohit Sharma.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-31 16:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-31 14:47 ext2_find_near Rohit Sharma
2008-07-31 16:23 ` ext2_find_near Theodore Tso

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.