public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* Regarding random grouop search start for allocation of inode.
@ 2015-12-03  7:44 lokesh jaliminche
  2015-12-03  8:07 ` lokesh jaliminche
  0 siblings, 1 reply; 10+ messages in thread
From: lokesh jaliminche @ 2015-12-03  7:44 UTC (permalink / raw)
  To: linux-ext4

hello folks,
                I am new to ext4 code. I was going through the
ext4-source for allocation of inode.
There is one thing that I did not understand while selection of groups
for inode allocation . I came across this code snippet which is part
of find_group_orlov function. question is, why group search start is
random ?

Code snippet:
==========
···if (qstr) {
»·······»·······»·······hinfo.hash_version = LDISKFS_DX_HASH_HALF_MD4;
»·······»·······»·······hinfo.seed = sbi->s_hash_seed;
»·······»·······»·······ldiskfsfs_dirhash(qstr->name, qstr->len, &hinfo);
»·······»·······»·······grp = hinfo.hash;
»·······»·······} else
»·······»·······»·······get_random_bytes(&grp, sizeof(grp));
»·······»·······parent_group = (unsigned)grp % ngroups;
»·······»·······for (i = 0; i < ngroups; i++) {
»·······»·······»·······g = (parent_group + i) % ngroups;
»·······»·······»·······get_orlov_stats(sb, g, flex_size, &stats);
»·······»·······»·······if (!stats.free_inodes)
»·······»·······»·······»·······continue;
»·······»·······»·······if (stats.used_dirs >= best_ndir)
»·······»·······»·······»·······continue;
»·······»·······»·······if (stats.free_inodes < avefreei)
»·······»·······»·······»·······continue;
»·······»·······»·······if (stats.free_blocks < avefreeb)
»·······»·······»·······»·······continue;
»·······»·······»·······grp = g;
»·······»·······»·······ret = 0;
»·······»·······»·······best_ndir = stats.used_dirs;
»·······»·······}

Thanks & Regards,
  Lokesh

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

end of thread, other threads:[~2015-12-21 18:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-03  7:44 Regarding random grouop search start for allocation of inode lokesh jaliminche
2015-12-03  8:07 ` lokesh jaliminche
2015-12-03 17:58   ` Andreas Dilger
2015-12-03 19:13     ` lokesh jaliminche
2015-12-04 21:54       ` Andreas Dilger
2015-12-15 10:33         ` lokesh jaliminche
2015-12-15 21:32           ` Andreas Dilger
2015-12-17 14:34             ` lokesh jaliminche
2015-12-19  5:09             ` lokesh
2015-12-21 18:25               ` Andreas Dilger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox