2012-11-29 13:28:09 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: fix handling errors got by f2fs_write_inode
Ruslan reported that f2fs hangs with an infinite loop in f2fs_sync_file():
while (sync_node_pages(sbi, inode->i_ino, &wbc) == 0)
f2fs_write_inode(inode, NULL);
The reason was revealed that the cold flag is not set even thought this inode is
a normal file. Therefore, sync_node_pages() skips to write node blocks since it
only writes cold node blocks.
The cold flag is stored to the node_footer in node block, and whenever a new
node page is allocated, it is set according to its file type, file or directory.
But, after sudden-power-off, when recovering the inode page, f2fs doesn't recover
its cold flag.
So, let's assign the cold flag in more right places.
One more thing:
If f2fs_write_inode() returns an error due to whatever situations, there would
be no dirty node pages so that sync_node_pages() returns zero.
(i.e., zero means nothing was written.)
Reported-by: Ruslan N. Marchenko <me@ruff.mobi>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2012-12-19 15:28:39 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2013-06-03 19:46:19 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros
PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
ago with promise that one day it will be possible to implement page
cache with bigger chunks than PAGE_SIZE.
This promise never materialized. And unlikely will.
We have many places where PAGE_CACHE_SIZE assumed to be equal to
PAGE_SIZE. And it's constant source of confusion on whether
PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
especially on the border between fs and mm.
Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
breakage to be doable.
Let's stop pretending that pages in page cache are special. They are
not.
The changes are pretty straight-forward:
- <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
- <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
- PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
- page_cache_get() -> get_page();
- page_cache_release() -> put_page();
This patch contains automated changes generated with coccinelle using
script below. For some reason, coccinelle doesn't patch header files.
I've called spatch for them manually.
The only adjustment after coccinelle is revert of changes to
PAGE_CAHCE_ALIGN definition: we are going to drop it later.
There are few places in the code where coccinelle didn't reach. I'll
fix them manually in a separate patch. Comments and documentation also
will be addressed with the separate patch.
virtual patch
@@
expression E;
@@
- E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E
@@
expression E;
@@
- E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E
@@
@@
- PAGE_CACHE_SHIFT
+ PAGE_SHIFT
@@
@@
- PAGE_CACHE_SIZE
+ PAGE_SIZE
@@
@@
- PAGE_CACHE_MASK
+ PAGE_MASK
@@
expression E;
@@
- PAGE_CACHE_ALIGN(E)
+ PAGE_ALIGN(E)
@@
expression E;
@@
- page_cache_get(E)
+ get_page(E)
@@
expression E;
@@
- page_cache_release(E)
+ put_page(E)
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-04-01 15:29:47 +03:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2014-02-27 18:20:00 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2014-05-28 08:56:09 +08:00
|
|
|
|
2014-02-27 18:20:00 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2014-05-28 08:56:09 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-18 23:30:03 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-27 18:20:00 +09:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-27 18:20:00 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
|
|
|
|
|
2014-10-13 17:26:14 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
2014-10-13 17:26:14 -07:00
|
|
|
|
|
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
2014-10-13 17:26:14 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2014-02-27 13:57:53 +09:00
|
|
|
|
|
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-27 13:57:53 +09:00
|
|
|
|
2015-03-09 17:33:16 +08:00
|
|
|
|
2014-02-27 13:57:53 +09:00
|
|
|
|
|
|
|
|
|
2015-03-09 17:33:16 +08:00
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
2016-04-27 22:22:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-24 10:00:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-24 10:00:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fscrypt: avoid collisions when presenting long encrypted filenames
commit 6b06cdee81d68a8a829ad8e8d0f31d6836744af9 upstream.
When accessing an encrypted directory without the key, userspace must
operate on filenames derived from the ciphertext names, which contain
arbitrary bytes. Since we must support filenames as long as NAME_MAX,
we can't always just base64-encode the ciphertext, since that may make
it too long. Currently, this is solved by presenting long names in an
abbreviated form containing any needed filesystem-specific hashes (e.g.
to identify a directory block), then the last 16 bytes of ciphertext.
This needs to be sufficient to identify the actual name on lookup.
However, there is a bug. It seems to have been assumed that due to the
use of a CBC (ciphertext block chaining)-based encryption mode, the last
16 bytes (i.e. the AES block size) of ciphertext would depend on the
full plaintext, preventing collisions. However, we actually use CBC
with ciphertext stealing (CTS), which handles the last two blocks
specially, causing them to appear "flipped". Thus, it's actually the
second-to-last block which depends on the full plaintext.
This caused long filenames that differ only near the end of their
plaintexts to, when observed without the key, point to the wrong inode
and be undeletable. For example, with ext4:
# echo pass | e4crypt add_key -p 16 edir/
# seq -f "edir/abcdefghijklmnopqrstuvwxyz012345%.0f" 100000 | xargs touch
# find edir/ -type f | xargs stat -c %i | sort | uniq | wc -l
100000
# sync
# echo 3 > /proc/sys/vm/drop_caches
# keyctl new_session
# find edir/ -type f | xargs stat -c %i | sort | uniq | wc -l
2004
# rm -rf edir/
rm: cannot remove 'edir/_A7nNFi3rhkEQlJ6P,hdzluhODKOeWx5V': Structure needs cleaning
...
To fix this, when presenting long encrypted filenames, encode the
second-to-last block of ciphertext rather than the last 16 bytes.
Although it would be nice to solve this without depending on a specific
encryption mode, that would mean doing a cryptographic hash like SHA-256
which would be much less efficient. This way is sufficient for now, and
it's still compatible with encryption modes like HEH which are strong
pseudorandom permutations. Also, changing the presented names is still
allowed at any time because they are only provided to allow applications
to do things like delete encrypted directories. They're not designed to
be used to persistently identify files --- which would be hard to do
anyway, given that they're encrypted after all.
For ease of backports, this patch only makes the minimal fix to both
ext4 and f2fs. It leaves ubifs as-is, since ubifs doesn't compare the
ciphertext block yet. Follow-on patches will clean things up properly
and make the filesystems use a shared helper function.
Fixes: 5de0b4d0cd15 ("ext4 crypto: simplify and speed up filename encryption")
Reported-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-24 10:00:09 -07:00
|
|
|
|
|
|
|
|
|
2017-04-24 10:00:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-13 17:26:14 -07:00
|
|
|
|
2017-04-24 10:00:08 -07:00
|
|
|
|
2015-03-09 17:33:16 +08:00
|
|
|
|
2014-02-27 13:57:53 +09:00
|
|
|
|
2015-03-09 17:33:16 +08:00
|
|
|
|
2014-07-10 12:37:46 +08:00
|
|
|
|
2014-02-27 13:57:53 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
2014-02-27 13:57:53 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-13 17:26:14 -07:00
|
|
|
|
2017-04-24 10:00:08 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2014-02-27 18:20:00 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2014-02-27 18:20:00 +09:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2016-05-25 14:29:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-14 09:54:37 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-29 11:27:56 +08:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
|
|
|
|
|
2016-05-25 14:29:11 -07:00
|
|
|
|
2016-08-29 11:27:56 +08:00
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
|
|
|
|
|
2014-09-24 18:19:10 +08:00
|
|
|
|
2016-05-25 14:29:11 -07:00
|
|
|
|
|
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
2016-05-25 14:29:11 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2015-12-31 10:28:52 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-20 09:52:20 -07:00
|
|
|
|
2015-12-31 10:28:52 -08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2016-05-25 14:29:11 -07:00
|
|
|
|
2016-08-29 11:27:56 +08:00
|
|
|
|
2016-05-25 14:29:11 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2015-04-27 17:12:39 -07:00
|
|
|
|
2016-08-29 11:27:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-04 22:01:28 +08:00
|
|
|
|
2014-09-24 18:19:10 +08:00
|
|
|
|
2016-06-04 22:01:28 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2016-08-06 09:49:02 -04:00
|
|
|
|
2016-07-19 08:27:47 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-19 08:27:47 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2016-07-19 08:27:47 +08:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-13 19:34:26 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2016-01-20 23:43:51 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
2014-12-13 13:13:11 -08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
f2fs: fix tracking parent inode number
Previously, f2fs didn't track the parent inode number correctly which is stored
in each f2fs_inode. In the case of the following scenario, a bug can be occured.
Let's suppose there are one directory, "/b", and two files, "/a" and "/b/a".
- pino of "/a" is ROOT_INO.
- pino of "/b/a" is DIR_B_INO.
Then,
# sync
: The inode pages of "/a" and "/b/a" contain the parent inode numbers as
ROOT_INO and DIR_B_INO respectively.
# mv /a /b/a
: The parent inode number of "/a" should be changed to DIR_B_INO, but f2fs
didn't do that. Ref. f2fs_set_link().
In order to fix this clearly, I added i_pino in f2fs_inode_info, and whenever
it needs to be changed like in f2fs_add_link() and f2fs_set_link(), it is
updated temporarily in f2fs_inode_info.
And later, f2fs_write_inode() stores the latest information to the inode pages.
For power-off-recovery, f2fs_sync_file() triggers simply f2fs_write_inode().
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2012-12-10 17:52:48 +09:00
|
|
|
|
2016-09-14 07:48:04 -07:00
|
|
|
|
2016-06-30 19:09:37 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2013-12-26 16:30:41 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2016-01-20 23:43:51 +08:00
|
|
|
|
2014-04-29 17:28:32 +09:00
|
|
|
|
2013-01-25 16:01:21 -05:00
|
|
|
|
2013-12-26 16:30:41 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-29 17:02:18 -07:00
|
|
|
|
|
|
|
|
|
2013-07-18 18:02:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-29 17:02:18 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-02 15:31:18 -07:00
|
|
|
|
2013-07-18 18:02:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-18 23:06:41 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-09 22:07:28 +08:00
|
|
|
|
|
|
|
|
|
2014-10-18 23:06:41 -07:00
|
|
|
|
2016-03-09 22:07:28 +08:00
|
|
|
|
|
|
|
|
|
2014-10-18 23:06:41 -07:00
|
|
|
|
2016-03-09 22:07:28 +08:00
|
|
|
|
|
|
|
|
|
2014-10-18 23:06:41 -07:00
|
|
|
|
|
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
|
|
|
|
|
f2fs: introduce a new global lock scheme
In the previous version, f2fs uses global locks according to the usage types,
such as directory operations, block allocation, block write, and so on.
Reference the following lock types in f2fs.h.
enum lock_type {
RENAME, /* for renaming operations */
DENTRY_OPS, /* for directory operations */
DATA_WRITE, /* for data write */
DATA_NEW, /* for data allocation */
DATA_TRUNC, /* for data truncate */
NODE_NEW, /* for node allocation */
NODE_TRUNC, /* for node truncate */
NODE_WRITE, /* for node write */
NR_LOCK_TYPE,
};
In that case, we lose the performance under the multi-threading environment,
since every types of operations must be conducted one at a time.
In order to address the problem, let's share the locks globally with a mutex
array regardless of any types.
So, let users grab a mutex and perform their jobs in parallel as much as
possbile.
For this, I propose a new global lock scheme as follows.
0. Data structure
- f2fs_sb_info -> mutex_lock[NR_GLOBAL_LOCKS]
- f2fs_sb_info -> node_write
1. mutex_lock_op(sbi)
- try to get an avaiable lock from the array.
- returns the index of the gottern lock variable.
2. mutex_unlock_op(sbi, index of the lock)
- unlock the given index of the lock.
3. mutex_lock_all(sbi)
- grab all the locks in the array before the checkpoint.
4. mutex_unlock_all(sbi)
- release all the locks in the array after checkpoint.
5. block_operations()
- call mutex_lock_all()
- sync_dirty_dir_inodes()
- grab node_write
- sync_node_pages()
Note that,
the pairs of mutex_lock_op()/mutex_unlock_op() and
mutex_lock_all()/mutex_unlock_all() should be used together.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2012-11-22 16:21:29 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-18 23:06:41 -07:00
|
|
|
|
f2fs: introduce a new global lock scheme
In the previous version, f2fs uses global locks according to the usage types,
such as directory operations, block allocation, block write, and so on.
Reference the following lock types in f2fs.h.
enum lock_type {
RENAME, /* for renaming operations */
DENTRY_OPS, /* for directory operations */
DATA_WRITE, /* for data write */
DATA_NEW, /* for data allocation */
DATA_TRUNC, /* for data truncate */
NODE_NEW, /* for node allocation */
NODE_TRUNC, /* for node truncate */
NODE_WRITE, /* for node write */
NR_LOCK_TYPE,
};
In that case, we lose the performance under the multi-threading environment,
since every types of operations must be conducted one at a time.
In order to address the problem, let's share the locks globally with a mutex
array regardless of any types.
So, let users grab a mutex and perform their jobs in parallel as much as
possbile.
For this, I propose a new global lock scheme as follows.
0. Data structure
- f2fs_sb_info -> mutex_lock[NR_GLOBAL_LOCKS]
- f2fs_sb_info -> node_write
1. mutex_lock_op(sbi)
- try to get an avaiable lock from the array.
- returns the index of the gottern lock variable.
2. mutex_unlock_op(sbi, index of the lock)
- unlock the given index of the lock.
3. mutex_lock_all(sbi)
- grab all the locks in the array before the checkpoint.
4. mutex_unlock_all(sbi)
- release all the locks in the array after checkpoint.
5. block_operations()
- call mutex_lock_all()
- sync_dirty_dir_inodes()
- grab node_write
- sync_node_pages()
Note that,
the pairs of mutex_lock_op()/mutex_unlock_op() and
mutex_lock_all()/mutex_unlock_all() should be used together.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2012-11-22 16:21:29 +09:00
|
|
|
|
2014-09-24 18:19:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
f2fs: introduce a new global lock scheme
In the previous version, f2fs uses global locks according to the usage types,
such as directory operations, block allocation, block write, and so on.
Reference the following lock types in f2fs.h.
enum lock_type {
RENAME, /* for renaming operations */
DENTRY_OPS, /* for directory operations */
DATA_WRITE, /* for data write */
DATA_NEW, /* for data allocation */
DATA_TRUNC, /* for data truncate */
NODE_NEW, /* for node allocation */
NODE_TRUNC, /* for node truncate */
NODE_WRITE, /* for node write */
NR_LOCK_TYPE,
};
In that case, we lose the performance under the multi-threading environment,
since every types of operations must be conducted one at a time.
In order to address the problem, let's share the locks globally with a mutex
array regardless of any types.
So, let users grab a mutex and perform their jobs in parallel as much as
possbile.
For this, I propose a new global lock scheme as follows.
0. Data structure
- f2fs_sb_info -> mutex_lock[NR_GLOBAL_LOCKS]
- f2fs_sb_info -> node_write
1. mutex_lock_op(sbi)
- try to get an avaiable lock from the array.
- returns the index of the gottern lock variable.
2. mutex_unlock_op(sbi, index of the lock)
- unlock the given index of the lock.
3. mutex_lock_all(sbi)
- grab all the locks in the array before the checkpoint.
4. mutex_unlock_all(sbi)
- release all the locks in the array after checkpoint.
5. block_operations()
- call mutex_lock_all()
- sync_dirty_dir_inodes()
- grab node_write
- sync_node_pages()
Note that,
the pairs of mutex_lock_op()/mutex_unlock_op() and
mutex_lock_all()/mutex_unlock_all() should be used together.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2012-11-22 16:21:29 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-27 17:57:04 +08:00
|
|
|
|
f2fs: introduce a new global lock scheme
In the previous version, f2fs uses global locks according to the usage types,
such as directory operations, block allocation, block write, and so on.
Reference the following lock types in f2fs.h.
enum lock_type {
RENAME, /* for renaming operations */
DENTRY_OPS, /* for directory operations */
DATA_WRITE, /* for data write */
DATA_NEW, /* for data allocation */
DATA_TRUNC, /* for data truncate */
NODE_NEW, /* for node allocation */
NODE_TRUNC, /* for node truncate */
NODE_WRITE, /* for node write */
NR_LOCK_TYPE,
};
In that case, we lose the performance under the multi-threading environment,
since every types of operations must be conducted one at a time.
In order to address the problem, let's share the locks globally with a mutex
array regardless of any types.
So, let users grab a mutex and perform their jobs in parallel as much as
possbile.
For this, I propose a new global lock scheme as follows.
0. Data structure
- f2fs_sb_info -> mutex_lock[NR_GLOBAL_LOCKS]
- f2fs_sb_info -> node_write
1. mutex_lock_op(sbi)
- try to get an avaiable lock from the array.
- returns the index of the gottern lock variable.
2. mutex_unlock_op(sbi, index of the lock)
- unlock the given index of the lock.
3. mutex_lock_all(sbi)
- grab all the locks in the array before the checkpoint.
4. mutex_unlock_all(sbi)
- release all the locks in the array after checkpoint.
5. block_operations()
- call mutex_lock_all()
- sync_dirty_dir_inodes()
- grab node_write
- sync_node_pages()
Note that,
the pairs of mutex_lock_op()/mutex_unlock_op() and
mutex_lock_all()/mutex_unlock_all() should be used together.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2012-11-22 16:21:29 +09:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
2014-10-18 23:06:41 -07:00
|
|
|
|
f2fs: introduce a new global lock scheme
In the previous version, f2fs uses global locks according to the usage types,
such as directory operations, block allocation, block write, and so on.
Reference the following lock types in f2fs.h.
enum lock_type {
RENAME, /* for renaming operations */
DENTRY_OPS, /* for directory operations */
DATA_WRITE, /* for data write */
DATA_NEW, /* for data allocation */
DATA_TRUNC, /* for data truncate */
NODE_NEW, /* for node allocation */
NODE_TRUNC, /* for node truncate */
NODE_WRITE, /* for node write */
NR_LOCK_TYPE,
};
In that case, we lose the performance under the multi-threading environment,
since every types of operations must be conducted one at a time.
In order to address the problem, let's share the locks globally with a mutex
array regardless of any types.
So, let users grab a mutex and perform their jobs in parallel as much as
possbile.
For this, I propose a new global lock scheme as follows.
0. Data structure
- f2fs_sb_info -> mutex_lock[NR_GLOBAL_LOCKS]
- f2fs_sb_info -> node_write
1. mutex_lock_op(sbi)
- try to get an avaiable lock from the array.
- returns the index of the gottern lock variable.
2. mutex_unlock_op(sbi, index of the lock)
- unlock the given index of the lock.
3. mutex_lock_all(sbi)
- grab all the locks in the array before the checkpoint.
4. mutex_unlock_all(sbi)
- release all the locks in the array after checkpoint.
5. block_operations()
- call mutex_lock_all()
- sync_dirty_dir_inodes()
- grab node_write
- sync_node_pages()
Note that,
the pairs of mutex_lock_op()/mutex_unlock_op() and
mutex_lock_all()/mutex_unlock_all() should be used together.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2012-11-22 16:21:29 +09:00
|
|
|
|
2014-06-27 17:57:04 +08:00
|
|
|
|
f2fs: introduce a new global lock scheme
In the previous version, f2fs uses global locks according to the usage types,
such as directory operations, block allocation, block write, and so on.
Reference the following lock types in f2fs.h.
enum lock_type {
RENAME, /* for renaming operations */
DENTRY_OPS, /* for directory operations */
DATA_WRITE, /* for data write */
DATA_NEW, /* for data allocation */
DATA_TRUNC, /* for data truncate */
NODE_NEW, /* for node allocation */
NODE_TRUNC, /* for node truncate */
NODE_WRITE, /* for node write */
NR_LOCK_TYPE,
};
In that case, we lose the performance under the multi-threading environment,
since every types of operations must be conducted one at a time.
In order to address the problem, let's share the locks globally with a mutex
array regardless of any types.
So, let users grab a mutex and perform their jobs in parallel as much as
possbile.
For this, I propose a new global lock scheme as follows.
0. Data structure
- f2fs_sb_info -> mutex_lock[NR_GLOBAL_LOCKS]
- f2fs_sb_info -> node_write
1. mutex_lock_op(sbi)
- try to get an avaiable lock from the array.
- returns the index of the gottern lock variable.
2. mutex_unlock_op(sbi, index of the lock)
- unlock the given index of the lock.
3. mutex_lock_all(sbi)
- grab all the locks in the array before the checkpoint.
4. mutex_unlock_all(sbi)
- release all the locks in the array after checkpoint.
5. block_operations()
- call mutex_lock_all()
- sync_dirty_dir_inodes()
- grab node_write
- sync_node_pages()
Note that,
the pairs of mutex_lock_op()/mutex_unlock_op() and
mutex_lock_all()/mutex_unlock_all() should be used together.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2012-11-22 16:21:29 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-13 19:42:53 -07:00
|
|
|
|
2016-08-28 18:57:55 +08:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-20 10:13:22 -07:00
|
|
|
|
2014-06-20 21:44:02 -07:00
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2016-05-02 12:34:48 -07:00
|
|
|
|
|
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
2016-05-02 12:34:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2014-10-13 19:42:53 -07:00
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
2013-12-27 17:04:17 +09:00
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
2016-08-28 18:57:55 +08:00
|
|
|
|
2013-06-03 19:46:19 +09:00
|
|
|
|
2013-12-27 17:04:17 +09:00
|
|
|
|
2015-04-21 20:39:58 -07:00
|
|
|
|
|
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2015-04-21 20:39:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2014-09-02 15:31:18 -07:00
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
2016-08-28 18:57:55 +08:00
|
|
|
|
|
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
2013-05-28 12:25:47 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-20 10:13:22 -07:00
|
|
|
|
2013-06-14 08:52:35 +09:00
|
|
|
|
2014-06-19 16:23:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-02 15:31:18 -07:00
|
|
|
|
2016-05-20 09:43:20 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
|
|
|
|
|
2013-12-27 17:04:17 +09:00
|
|
|
|
2016-05-02 12:34:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2014-09-24 18:17:04 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2016-05-20 10:13:22 -07:00
|
|
|
|
2016-05-20 16:32:49 -07:00
|
|
|
|
2016-05-20 09:43:20 -07:00
|
|
|
|
2016-05-20 10:13:22 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2016-09-14 07:48:04 -07:00
|
|
|
|
2016-06-30 19:09:37 -07:00
|
|
|
|
2014-01-21 13:32:12 +09:00
|
|
|
|
2016-05-20 16:32:49 -07:00
|
|
|
|
2016-05-20 09:52:20 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2016-05-20 10:13:22 -07:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2014-10-13 16:28:13 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-13 16:28:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-13 16:28:13 -07:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
2015-02-16 16:17:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
|
|
|
|
|
2016-02-12 14:29:28 -08:00
|
|
|
|
2016-08-31 16:20:37 -07:00
|
|
|
|
2016-02-12 14:29:28 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-16 16:17:20 +08:00
|
|
|
|
|
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
2016-08-28 18:57:55 +08:00
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-16 16:17:20 +08:00
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
2014-09-24 18:19:10 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
2017-04-24 10:00:08 -07:00
|
|
|
|
2015-04-27 14:51:02 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-29 16:29:22 -07:00
|
|
|
|
2016-09-23 21:30:09 +08:00
|
|
|
|
2016-04-29 16:29:22 -07:00
|
|
|
|
|
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-27 18:20:00 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2014-02-27 18:20:00 +09:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2013-05-20 09:55:50 +09:00
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2014-10-13 16:28:13 -07:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-20 23:43:51 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
|
|
|
|
|
2016-08-28 18:57:55 +08:00
|
|
|
|
|
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-29 17:02:18 -07:00
|
|
|
|
|
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
2015-02-16 16:17:20 +08:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
2015-02-16 16:17:20 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
f2fs: fix tracking parent inode number
Previously, f2fs didn't track the parent inode number correctly which is stored
in each f2fs_inode. In the case of the following scenario, a bug can be occured.
Let's suppose there are one directory, "/b", and two files, "/a" and "/b/a".
- pino of "/a" is ROOT_INO.
- pino of "/b/a" is DIR_B_INO.
Then,
# sync
: The inode pages of "/a" and "/b/a" contain the parent inode numbers as
ROOT_INO and DIR_B_INO respectively.
# mv /a /b/a
: The parent inode number of "/a" should be changed to DIR_B_INO, but f2fs
didn't do that. Ref. f2fs_set_link().
In order to fix this clearly, I added i_pino in f2fs_inode_info, and whenever
it needs to be changed like in f2fs_add_link() and f2fs_set_link(), it is
updated temporarily in f2fs_inode_info.
And later, f2fs_write_inode() stores the latest information to the inode pages.
For power-off-recovery, f2fs_sync_file() triggers simply f2fs_write_inode().
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2012-12-10 17:52:48 +09:00
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
2016-05-20 09:52:20 -07:00
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
|
|
|
|
|
2013-05-20 10:10:29 +09:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2015-03-30 15:07:16 -07:00
|
|
|
|
|
|
|
|
|
2014-03-20 19:10:08 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-29 11:27:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-14 09:54:37 -08:00
|
|
|
|
|
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-14 09:54:37 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-20 21:37:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-28 18:57:55 +08:00
|
|
|
|
2014-06-20 21:37:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-20 10:13:22 -07:00
|
|
|
|
2014-06-20 21:37:02 -07:00
|
|
|
|
|
|
|
|
|
2016-01-08 16:57:48 -08:00
|
|
|
|
2014-06-20 21:37:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 21:18:25 -07:00
|
|
|
|
2014-09-24 18:17:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-20 16:32:49 -07:00
|
|
|
|
2016-05-20 09:43:20 -07:00
|
|
|
|
2016-09-14 07:48:04 -07:00
|
|
|
|
2014-09-24 18:17:04 +08:00
|
|
|
|
2016-05-20 09:43:20 -07:00
|
|
|
|
2014-09-24 18:17:04 +08:00
|
|
|
|
2016-05-20 09:43:20 -07:00
|
|
|
|
2016-05-20 09:22:03 -07:00
|
|
|
|
2014-09-24 18:17:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-13 18:27:02 -07:00
|
|
|
|
2014-09-24 18:17:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-29 13:28:09 +09:00
|
|
|
|
2014-08-06 23:22:50 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-24 18:17:04 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-08 14:54:50 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2016-01-08 16:57:48 -08:00
|
|
|
|
|
|
|
|
|
2014-09-24 18:19:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2016-01-20 23:43:51 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2014-06-27 17:57:04 +08:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2014-10-23 14:40:20 +02:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-14 07:48:04 -07:00
|
|
|
|
2016-06-30 19:09:37 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2014-09-24 18:17:04 +08:00
|
|
|
|
2016-06-01 21:18:25 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2015-08-12 17:48:21 +08:00
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2015-02-25 19:25:01 -08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2014-09-12 15:53:45 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2012-12-08 14:54:35 +09:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-24 18:17:04 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2014-09-24 18:19:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2015-10-09 15:11:38 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-27 17:57:04 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-27 17:57:04 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2014-10-15 21:29:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2014-10-15 21:29:51 -07:00
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
2014-10-15 21:29:51 -07:00
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-15 21:29:51 -07:00
|
|
|
|
|
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
2016-02-12 14:29:28 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: fix to convert inline directory correctly
With below serials, we will lose parts of dirents:
1) mount f2fs with inline_dentry option
2) echo 1 > /sys/fs/f2fs/sdX/dir_level
3) mkdir dir
4) touch 180 files named [1-180] in dir
5) touch 181 in dir
6) echo 3 > /proc/sys/vm/drop_caches
7) ll dir
ls: cannot access 2: No such file or directory
ls: cannot access 4: No such file or directory
ls: cannot access 5: No such file or directory
ls: cannot access 6: No such file or directory
ls: cannot access 8: No such file or directory
ls: cannot access 9: No such file or directory
...
total 360
drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
-rw-r--r-- 1 root root 0 Feb 19 15:12 1
-rw-r--r-- 1 root root 0 Feb 19 15:12 10
-rw-r--r-- 1 root root 0 Feb 19 15:12 100
-????????? ? ? ? ? ? 101
-????????? ? ? ? ? ? 102
-????????? ? ? ? ? ? 103
...
The reason is: when doing the inline dir conversion, we didn't consider
that directory has hierarchical hash structure which can be configured
through sysfs interface 'dir_level'.
By default, dir_level of directory inode is 0, it means we have one bucket
in hash table located in first level, all dirents will be hashed in this
bucket, so it has no problem for us to do the duplication simply between
inline dentry page and converted normal dentry page.
However, if we configured dir_level with the value N (greater than 0), it
will expand the bucket number of first level hash table by 2^N - 1, it
hashs dirents into different buckets according their hash value, if we
still move all dirents to first bucket, it makes incorrent locating for
inline dirents, the result is, although we can iterate all dirents through
->readdir, we can't stat some of them in ->lookup which based on hash
table searching.
This patch fixes this issue by rehashing dirents into correct position
when converting inline directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-02-22 18:29:18 +08:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-15 17:25:55 -04:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
2016-09-15 17:25:55 -04:00
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
|
|
|
|
|
2016-09-15 17:25:55 -04:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
2015-09-03 13:38:23 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-15 21:29:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-17 18:02:17 -04:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2013-01-23 17:07:38 -05:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-28 17:59:43 +08:00
|
|
|
|
2013-05-17 18:02:17 -04:00
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2016-02-23 09:21:37 -08:00
|
|
|
|
2015-05-19 22:26:54 -07:00
|
|
|
|
|
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-24 18:19:10 +08:00
|
|
|
|
2014-04-28 17:59:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-17 14:44:39 -06:00
|
|
|
|
2015-10-09 15:11:38 -07:00
|
|
|
|
2015-11-19 16:09:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2013-07-05 17:28:12 +09:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
2014-10-18 22:52:52 -07:00
|
|
|
|
2015-12-01 11:41:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-15 21:29:51 -07:00
|
|
|
|
2013-05-17 18:02:17 -04:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-27 20:32:37 +08:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2015-04-27 16:26:24 -07:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
2016-02-14 18:56:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-15 16:26:10 -07:00
|
|
|
|
2016-02-14 18:56:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-10 16:41:13 -04:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2016-02-14 18:56:55 +08:00
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|
2015-05-12 16:05:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 16:59:04 +09:00
|
|
|
|