<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/fs/f2fs/dir.c, branch v3.15</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>f2fs: introduce fi-&gt;i_sem to protect fi's info</title>
<updated>2014-03-20T13:10:11+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-03-20T10:10:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=d928bfbfe77aa457b765c19e9db8cd4cc72b3c89'/>
<id>d928bfbfe77aa457b765c19e9db8cd4cc72b3c89</id>
<content type='text'>
This patch introduces fi-&gt;i_sem to protect fi's info that includes xattr_ver,
pino, i_nlink.
This enables to remove i_mutex during f2fs_sync_file, resulting in performance
improvement when a number of fsync calls are triggered from many concurrent
threads.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch introduces fi-&gt;i_sem to protect fi's info that includes xattr_ver,
pino, i_nlink.
This enables to remove i_mutex during f2fs_sync_file, resulting in performance
improvement when a number of fsync calls are triggered from many concurrent
threads.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: call f2fs_wait_on_page_writeback instead of native function</title>
<updated>2014-03-20T13:10:04+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-03-18T04:29:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=3cb5ad152b54430f3e5f338c15f8cd434e7160c8'/>
<id>3cb5ad152b54430f3e5f338c15f8cd434e7160c8</id>
<content type='text'>
If a page is on writeback, f2fs can face with deadlock due to under writepages.
This is caused by merging IOs inside f2fs, so if it comes to detect, let's throw
merged IOs, which is implemented by f2fs_wait_on_page_writeback.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If a page is on writeback, f2fs can face with deadlock due to under writepages.
This is caused by merging IOs inside f2fs, so if it comes to detect, let's throw
merged IOs, which is implemented by f2fs_wait_on_page_writeback.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: fix wrong kernel coding style</title>
<updated>2014-03-05T01:48:53+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-03-05T01:48:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=20f70751c6b4ac5055be9a0d8a3d3189a81afc5a'/>
<id>20f70751c6b4ac5055be9a0d8a3d3189a81afc5a</id>
<content type='text'>
This patch includes a simple fix to adjust coding style.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch includes a simple fix to adjust coding style.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: introduce large directory support</title>
<updated>2014-02-27T10:56:09+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-02-27T09:20:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=3843154598a00408f4214a68bd536fdf27b1df10'/>
<id>3843154598a00408f4214a68bd536fdf27b1df10</id>
<content type='text'>
This patch introduces an i_dir_level field to support large directory.

Previously, f2fs maintains multi-level hash tables to find a dentry quickly
from a bunch of chiild dentries in a directory, and the hash tables consist of
the following tree structure as below.

In Documentation/filesystems/f2fs.txt,

----------------------
A : bucket
B : block
N : MAX_DIR_HASH_DEPTH
----------------------

level #0   | A(2B)
           |
level #1   | A(2B) - A(2B)
           |
level #2   | A(2B) - A(2B) - A(2B) - A(2B)
     .     |   .       .       .       .
level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
     .     |   .       .       .       .
level #N   | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)

But, if we can guess that a directory will handle a number of child files,
we don't need to traverse the tree from level #0 to #N all the time.
Since the lower level tables contain relatively small number of dentries,
the miss ratio of the target dentry is likely to be high.

In order to avoid that, we can configure the hash tables sparsely from level #0
like this.

level #0   | A(2B) - A(2B) - A(2B) - A(2B)

level #1   | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
     .     |   .       .       .       .
level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
     .     |   .       .       .       .
level #N   | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)

With this structure, we can skip the ineffective tree searches in lower level
hash tables.

This patch adds just a facility for this by introducing i_dir_level in
f2fs_inode.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch introduces an i_dir_level field to support large directory.

Previously, f2fs maintains multi-level hash tables to find a dentry quickly
from a bunch of chiild dentries in a directory, and the hash tables consist of
the following tree structure as below.

In Documentation/filesystems/f2fs.txt,

----------------------
A : bucket
B : block
N : MAX_DIR_HASH_DEPTH
----------------------

level #0   | A(2B)
           |
level #1   | A(2B) - A(2B)
           |
level #2   | A(2B) - A(2B) - A(2B) - A(2B)
     .     |   .       .       .       .
level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
     .     |   .       .       .       .
level #N   | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)

But, if we can guess that a directory will handle a number of child files,
we don't need to traverse the tree from level #0 to #N all the time.
Since the lower level tables contain relatively small number of dentries,
the miss ratio of the target dentry is likely to be high.

In order to avoid that, we can configure the hash tables sparsely from level #0
like this.

level #0   | A(2B) - A(2B) - A(2B) - A(2B)

level #1   | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
     .     |   .       .       .       .
level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
     .     |   .       .       .       .
level #N   | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)

With this structure, we can skip the ineffective tree searches in lower level
hash tables.

This patch adds just a facility for this by introducing i_dir_level in
f2fs_inode.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: remove costly bit operations for f2fs_find_entry</title>
<updated>2014-02-27T07:25:20+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-02-27T04:57:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=5d0c667121bfc8be76d1580f485bddbe73465d1a'/>
<id>5d0c667121bfc8be76d1580f485bddbe73465d1a</id>
<content type='text'>
It turns out that a bit operation like find_next_bit is not always fast enough
for f2fs_find_entry.
Instead, it is pretty much simple and fast to traverse each dentries.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It turns out that a bit operation like find_next_bit is not always fast enough
for f2fs_find_entry.
Instead, it is pretty much simple and fast to traverse each dentries.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: clean up redundant function call</title>
<updated>2014-02-17T05:58:53+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-02-07T01:00:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=1fe54f9dd3acfaa3ed4e1d1e3278fd0f1d1e98cd'/>
<id>1fe54f9dd3acfaa3ed4e1d1e3278fd0f1d1e98cd</id>
<content type='text'>
This patch integrates inode_[inc|dec]_dirty_dents with inc_page_count to remove
redundant calls.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch integrates inode_[inc|dec]_dirty_dents with inc_page_count to remove
redundant calls.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: fix to truncate dentry pages in the error case</title>
<updated>2014-02-17T05:58:52+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-02-05T02:16:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bd859c6598dd2b73c517b3a36ecc5dd387eb1eb2'/>
<id>bd859c6598dd2b73c517b3a36ecc5dd387eb1eb2</id>
<content type='text'>
When a new directory is allocated, if an error is occurred, we should truncate
preallocated dentry pages too.

This bug was reported by Andrey Tsyvarev after a while as follows.

mkdir()-&gt;
 f2fs_add_link()-&gt;
  init_inode_metadata()-&gt;
    f2fs_init_acl()-&gt;
      f2fs_get_acl()-&gt;
        f2fs_getxattr()-&gt;
          read_all_xattrs() fails.

Also there was a BUG_ON triggered after the fault in
mkdir()-&gt;
 f2fs_add_link()-&gt;
   init_inode_metadata()-&gt;
    remove_inode_page() -&gt;
      f2fs_bug_on(inode-&gt;i_blocks != 0 &amp;&amp; inode-&gt;i_blocks != 1);

But, previous patch wasn't perfect to resolve that bug, so the following bug
report was also submitted.

kernel BUG at fs/f2fs/inode.c:274!
Call Trace:
 [&lt;ffffffff811fde03&gt;] evict+0xa3/0x1a0
 [&lt;ffffffff811fe615&gt;] iput+0xf5/0x180
 [&lt;ffffffffa01c7f63&gt;] f2fs_mkdir+0xf3/0x150 [f2fs]
 [&lt;ffffffff811f2a77&gt;] vfs_mkdir+0xb7/0x160
 [&lt;ffffffff811f36bf&gt;] SyS_mkdir+0x5f/0xc0
 [&lt;ffffffff81680769&gt;] system_call_fastpath+0x16/0x1b

Finally, this patch resolves all the issues like below.

If an error is occurred after make_empty_dir(),
 1. truncate_inode_pages()
   The make_bad_inode() prior to iput() will change i_mode to S_IFREG, which
   means that f2fs will not decrement fi-&gt;dirty_dents during f2fs_evict_inode.
   But, by calling it here, we can do that.

 2. truncate_blocks()
   Preallocated dentry pages are trucated here to sync i_blocks.

 3. remove_dirty_dir_inode()
   Remove this directory inode from the list.

Reported-and-Tested-by: Andrey Tsyvarev &lt;tsyvarev@ispras.ru&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a new directory is allocated, if an error is occurred, we should truncate
preallocated dentry pages too.

This bug was reported by Andrey Tsyvarev after a while as follows.

mkdir()-&gt;
 f2fs_add_link()-&gt;
  init_inode_metadata()-&gt;
    f2fs_init_acl()-&gt;
      f2fs_get_acl()-&gt;
        f2fs_getxattr()-&gt;
          read_all_xattrs() fails.

Also there was a BUG_ON triggered after the fault in
mkdir()-&gt;
 f2fs_add_link()-&gt;
   init_inode_metadata()-&gt;
    remove_inode_page() -&gt;
      f2fs_bug_on(inode-&gt;i_blocks != 0 &amp;&amp; inode-&gt;i_blocks != 1);

But, previous patch wasn't perfect to resolve that bug, so the following bug
report was also submitted.

kernel BUG at fs/f2fs/inode.c:274!
Call Trace:
 [&lt;ffffffff811fde03&gt;] evict+0xa3/0x1a0
 [&lt;ffffffff811fe615&gt;] iput+0xf5/0x180
 [&lt;ffffffffa01c7f63&gt;] f2fs_mkdir+0xf3/0x150 [f2fs]
 [&lt;ffffffff811f2a77&gt;] vfs_mkdir+0xb7/0x160
 [&lt;ffffffff811f36bf&gt;] SyS_mkdir+0x5f/0xc0
 [&lt;ffffffff81680769&gt;] system_call_fastpath+0x16/0x1b

Finally, this patch resolves all the issues like below.

If an error is occurred after make_empty_dir(),
 1. truncate_inode_pages()
   The make_bad_inode() prior to iput() will change i_mode to S_IFREG, which
   means that f2fs will not decrement fi-&gt;dirty_dents during f2fs_evict_inode.
   But, by calling it here, we can do that.

 2. truncate_blocks()
   Preallocated dentry pages are trucated here to sync i_blocks.

 3. remove_dirty_dir_inode()
   Remove this directory inode from the list.

Reported-and-Tested-by: Andrey Tsyvarev &lt;tsyvarev@ispras.ru&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: fix the potential mismatch between dir's i_size and i_blocks</title>
<updated>2014-02-17T05:58:52+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-02-03T08:24:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=924a2ddbd0c2829ebca9ac899522cbb16a9b6d8c'/>
<id>924a2ddbd0c2829ebca9ac899522cbb16a9b6d8c</id>
<content type='text'>
This is the erroneous scenario.

                             i_size    on-disk i_size    i_blocks
__f2fs_add_link()             4096           4096           2
 get_new_data_page            8192           4096           3
 -ENOSPC = init_inode_metadata
 checkpoint                     -            4096           3
 POR and reboot

__f2fs_add_link()             4096           4096           3
 page = get_new_data_page (page-&gt;index = 1 by NEW_ADDR)
 add a dentry to the page successfully

f2fs_rmdir()
 f2fs_empty_dir()             4096           4096           3
 f2fs_unlink() goes, since there is no valid dentry due to i_size = 4096.
 But, still there is one dentry in page-&gt;index = 1.

So this patch moves the code to write dir-&gt;i_size into on-disk i_size in order
to sync dir's i_size, on-disk i_size, and its i_blocks.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is the erroneous scenario.

                             i_size    on-disk i_size    i_blocks
__f2fs_add_link()             4096           4096           2
 get_new_data_page            8192           4096           3
 -ENOSPC = init_inode_metadata
 checkpoint                     -            4096           3
 POR and reboot

__f2fs_add_link()             4096           4096           3
 page = get_new_data_page (page-&gt;index = 1 by NEW_ADDR)
 add a dentry to the page successfully

f2fs_rmdir()
 f2fs_empty_dir()             4096           4096           3
 f2fs_unlink() goes, since there is no valid dentry due to i_size = 4096.
 But, still there is one dentry in page-&gt;index = 1.

So this patch moves the code to write dir-&gt;i_size into on-disk i_size in order
to sync dir's i_size, on-disk i_size, and its i_blocks.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: move a branch for code redability</title>
<updated>2014-01-22T09:41:07+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-01-21T09:31:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=e8dae6045882e32a067326f47b7ccd3aaf8814e2'/>
<id>e8dae6045882e32a067326f47b7ccd3aaf8814e2</id>
<content type='text'>
This patch moves a function in f2fs_delete_entry for code readability.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch moves a function in f2fs_delete_entry for code readability.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: call mark_inode_dirty to flush dirty pages</title>
<updated>2014-01-22T09:40:34+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-01-21T04:32:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a18ff063406dd6aec41fda598eabe2691007a30d'/>
<id>a18ff063406dd6aec41fda598eabe2691007a30d</id>
<content type='text'>
If a dentry page is updated, we should call mark_inode_dirty to add the inode
into the dirty list, so that its dentry pages are flushed to the disk.
Otherwise, the inode can be evicted without flush.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If a dentry page is updated, we should call mark_inode_dirty to add the inode
into the dirty list, so that its dentry pages are flushed to the disk.
Otherwise, the inode can be evicted without flush.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
