2012-11-29 13:28:09 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: expose f2fs_write_cache_pages
If there are gced dirty pages and normal dirty pages in the mapping
of one inode, we might writeback them alternately with discontinuous
block address, resulting in low performance.
This patch introduces f2fs_write_cache_pages with codes copied from
write_cache_pages in mm/page-writeback.c.
In this function, we refactor flow with two steps:
1) writeback all cold type pages.
2) writeback all non-cold type pages.
By using this method, f2fs will writeback dirty pages with the same
temperature in bunch mode, it makes writeouted block being with
more continuous address, so they can be merged as much as possible
in f2fs bio cache, and also it will reduce the chance of submiting
small IO from block layer.
Test environment: 8g nokia sd card (very old sd card, but it shows
better effect when testing with this patch, and with a 32g kingston
sd card, I didn't see much more improvement).
Test step:
1. touch testfile;
2. truncate -s 512K testfile;
3. write all pages with odd index;
4. trigger gc by ioctl;
5. write all pages with even index;
6. time fsync testfile.
before:
real 0m0.402s
user 0m0.000s
sys 0m0.000s
after:
real 0m0.143s
user 0m0.004s
sys 0m0.004s
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-07-14 18:56:10 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2012-12-19 22:19:30 +01:00
|
|
|
|
2015-02-22 08:58:50 -08:00
|
|
|
|
2015-04-09 11:20:42 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-17 20:04:08 -08:00
|
|
|
|
2013-04-23 16:38:02 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-07-20 15:29:37 +02:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2014-01-30 11:19:05 -08:00
|
|
|
|
|
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2015-05-25 18:03:38 +08:00
|
|
|
|
2015-07-20 15:29:37 +02:00
|
|
|
|
2015-05-25 18:03:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-30 11:19:05 -08:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
2015-07-20 15:29:37 +02:00
|
|
|
|
2014-01-30 11:19:05 -08:00
|
|
|
|
|
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-30 11:19:05 -08:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-20 15:29:37 +02:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2014-02-03 10:50:22 +09:00
|
|
|
|
2014-01-30 11:19:05 -08:00
|
|
|
|
|
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2014-01-30 11:19:05 -08:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
|
|
|
|
|
2015-07-20 15:29:37 +02:00
|
|
|
|
2014-08-11 18:37:46 -07:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2014-01-24 09:42:16 +09:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-30 11:19:05 -08:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-20 17:39:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-14 11:43:56 -07:00
|
|
|
|
2013-12-20 17:39:59 +08:00
|
|
|
|
|
|
|
|
|
2014-09-15 18:01:10 +08:00
|
|
|
|
2013-12-20 17:39:59 +08:00
|
|
|
|
2015-05-25 18:03:38 +08:00
|
|
|
|
2013-12-20 17:39:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-29 14:37:22 -07:00
|
|
|
|
2014-12-24 16:08:14 +08:00
|
|
|
|
2014-10-29 14:37:22 -07:00
|
|
|
|
2014-12-24 16:08:14 +08:00
|
|
|
|
2013-12-20 17:39:59 +08:00
|
|
|
|
2014-10-29 14:37:22 -07:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-22 14:57:23 +08:00
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-23 09:57:31 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
|
|
|
|
|
2014-03-22 14:57:23 +08:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2014-12-24 16:08:14 +08:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2013-12-20 17:39:59 +08:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2013-12-20 17:39:59 +08:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2014-03-22 14:57:23 +08:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2013-12-20 17:39:59 +08:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
|
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
2014-09-22 16:21:07 -07:00
|
|
|
|
2013-12-20 17:39:59 +08:00
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
2014-03-22 14:57:23 +08:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2013-11-30 12:51:14 +09:00
|
|
|
|
|
|
|
|
|
2012-11-29 13:28:09 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-19 19:23:32 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-10 07:26:14 +00:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-07-15 17:57:38 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-30 22:57:55 -08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-02 15:31:18 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-12-06 15:00:58 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-12-05 17:15:22 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2013-04-23 17:00:52 +09:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-03-19 19:23:32 +08:00
|
|
|
|
2014-01-21 13:32:12 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-10 23:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-27 17:04:17 +09:00
|
|
|
|
2013-11-10 23:13:18 +08:00
|
|
|
|
|
|
|
|
|
2013-12-27 17:04:17 +09:00
|
|
|
|
2013-11-10 23:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-05 15:52:16 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-03-19 19:26:02 +08:00
|
|
|
|
2015-08-05 15:52:16 +08:00
|
|
|
|
2015-03-19 19:26:02 +08:00
|
|
|
|
2015-08-05 15:52:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-05 17:54:31 +08:00
|
|
|
|
|
|
|
|
|
2015-08-05 15:52:16 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2015-10-09 15:11:38 -07:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-05 18:03:40 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-09 15:11:38 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-05 18:03:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-13 08:38:35 +09:00
|
|
|
|
|
|
|
|
|
2015-07-15 13:08:21 -07:00
|
|
|
|
|
|
|
|
|
2013-05-13 08:38:35 +09:00
|
|
|
|
|
|
|
|
|
2013-12-06 15:00:58 +09:00
|
|
|
|
2015-07-15 13:08:21 -07:00
|
|
|
|
|
|
|
|
|
2013-05-13 08:38:35 +09:00
|
|
|
|
2015-02-05 18:03:40 +08:00
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-08-20 19:13:07 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
2013-08-20 19:13:07 +09:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
|
|
|
|
|
2013-03-08 21:29:23 +09:00
|
|
|
|
2015-07-15 13:08:21 -07:00
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
2015-07-15 13:08:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
2013-03-08 21:29:23 +09:00
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-09 15:11:38 -07:00
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-09 15:11:38 -07:00
|
|
|
|
|
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-09 15:11:38 -07:00
|
|
|
|
2015-04-30 17:00:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-08 21:29:23 +09:00
|
|
|
|
2013-12-06 15:00:58 +09:00
|
|
|
|
2013-03-08 21:29:23 +09:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-12-06 15:00:58 +09:00
|
|
|
|
2013-04-26 11:55:17 +09:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-29 13:28:09 +09:00
|
|
|
|
2012-11-02 17:10:12 +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
|
|
|
|
2013-12-21 18:02:14 +08:00
|
|
|
|
|
|
|
|
|
2015-07-14 18:14:06 +08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-05-20 09:55:50 +09:00
|
|
|
|
2013-12-27 17:04:17 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-29 11:18:42 -07:00
|
|
|
|
2015-10-09 15:11:38 -07:00
|
|
|
|
2015-07-14 18:14:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-29 11:18:42 -07:00
|
|
|
|
2015-07-14 18:14:06 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-12-27 17:04:17 +09:00
|
|
|
|
2013-11-10 23:13:18 +08:00
|
|
|
|
2015-04-29 11:18:42 -07:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-12-27 17:04:17 +09:00
|
|
|
|
2015-04-29 11:18:42 -07:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2015-04-29 11:18:42 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-08 21:29:23 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
2013-12-27 17:04:17 +09:00
|
|
|
|
2015-10-09 15:11:38 -07:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
2013-04-26 11:55:17 +09:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-29 11:18:42 -07:00
|
|
|
|
2015-09-11 14:43:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-07 22:08:23 +09:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
2014-09-02 15:31:18 -07:00
|
|
|
|
2014-09-15 19:32:16 -07:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
2015-01-05 16:02:20 -08:00
|
|
|
|
2014-09-15 19:32:16 -07:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: preallocate fallocated blocks for direct IO
Normally, due to DIO_SKIP_HOLES flag is set by default, blockdev_direct_IO in
f2fs_direct_IO tries to skip DIO in holes when writing inside i_size, this
makes us falling back to buffered IO which shows lower performance.
So in commit 59b802e5a453 ("f2fs: allocate data blocks in advance for
f2fs_direct_IO"), we improve perfromance by allocating data blocks in advance
if we meet holes no matter in i_size or not, since with it we can avoid falling
back to buffered IO.
But we forget to consider for unwritten fallocated block in this commit.
This patch tries to fix it for fallocate case, this helps to improve
performance.
Test result:
Storage info: sandisk ultra 64G micro sd card.
touch /mnt/f2fs/file
truncate -s 67108864 /mnt/f2fs/file
fallocate -o 0 -l 67108864 /mnt/f2fs/file
time dd if=/dev/zero of=/mnt/f2fs/file bs=1M count=64 conv=notrunc oflag=direct
Time before applying the patch:
67108864 bytes (67 MB) copied, 36.16 s, 1.9 MB/s
real 0m36.162s
user 0m0.000s
sys 0m0.180s
Time after applying the patch:
67108864 bytes (67 MB) copied, 27.7776 s, 2.4 MB/s
real 0m27.780s
user 0m0.000s
sys 0m0.036s
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-23 10:33:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: preallocate fallocated blocks for direct IO
Normally, due to DIO_SKIP_HOLES flag is set by default, blockdev_direct_IO in
f2fs_direct_IO tries to skip DIO in holes when writing inside i_size, this
makes us falling back to buffered IO which shows lower performance.
So in commit 59b802e5a453 ("f2fs: allocate data blocks in advance for
f2fs_direct_IO"), we improve perfromance by allocating data blocks in advance
if we meet holes no matter in i_size or not, since with it we can avoid falling
back to buffered IO.
But we forget to consider for unwritten fallocated block in this commit.
This patch tries to fix it for fallocate case, this helps to improve
performance.
Test result:
Storage info: sandisk ultra 64G micro sd card.
touch /mnt/f2fs/file
truncate -s 67108864 /mnt/f2fs/file
fallocate -o 0 -l 67108864 /mnt/f2fs/file
time dd if=/dev/zero of=/mnt/f2fs/file bs=1M count=64 conv=notrunc oflag=direct
Time before applying the patch:
67108864 bytes (67 MB) copied, 36.16 s, 1.9 MB/s
real 0m36.162s
user 0m0.000s
sys 0m0.180s
Time after applying the patch:
67108864 bytes (67 MB) copied, 27.7776 s, 2.4 MB/s
real 0m27.780s
user 0m0.000s
sys 0m0.036s
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-23 10:33:37 +08:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-05 16:02:20 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: preallocate fallocated blocks for direct IO
Normally, due to DIO_SKIP_HOLES flag is set by default, blockdev_direct_IO in
f2fs_direct_IO tries to skip DIO in holes when writing inside i_size, this
makes us falling back to buffered IO which shows lower performance.
So in commit 59b802e5a453 ("f2fs: allocate data blocks in advance for
f2fs_direct_IO"), we improve perfromance by allocating data blocks in advance
if we meet holes no matter in i_size or not, since with it we can avoid falling
back to buffered IO.
But we forget to consider for unwritten fallocated block in this commit.
This patch tries to fix it for fallocate case, this helps to improve
performance.
Test result:
Storage info: sandisk ultra 64G micro sd card.
touch /mnt/f2fs/file
truncate -s 67108864 /mnt/f2fs/file
fallocate -o 0 -l 67108864 /mnt/f2fs/file
time dd if=/dev/zero of=/mnt/f2fs/file bs=1M count=64 conv=notrunc oflag=direct
Time before applying the patch:
67108864 bytes (67 MB) copied, 36.16 s, 1.9 MB/s
real 0m36.162s
user 0m0.000s
sys 0m0.180s
Time after applying the patch:
67108864 bytes (67 MB) copied, 27.7776 s, 2.4 MB/s
real 0m27.780s
user 0m0.000s
sys 0m0.036s
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-23 10:33:37 +08:00
|
|
|
|
|
|
|
|
|
2015-03-19 19:23:32 +08:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
2014-09-15 19:32:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-11 14:43:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-15 19:32:16 -07:00
|
|
|
|
2015-06-19 17:53:26 -07:00
|
|
|
|
2015-07-08 17:59:36 +08:00
|
|
|
|
2015-06-19 17:53:26 -07:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-09 12:09:53 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-12 17:04:24 +08:00
|
|
|
|
|
|
|
|
|
2015-09-21 20:17:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-12 17:04:24 +08:00
|
|
|
|
f2fs: preallocate fallocated blocks for direct IO
Normally, due to DIO_SKIP_HOLES flag is set by default, blockdev_direct_IO in
f2fs_direct_IO tries to skip DIO in holes when writing inside i_size, this
makes us falling back to buffered IO which shows lower performance.
So in commit 59b802e5a453 ("f2fs: allocate data blocks in advance for
f2fs_direct_IO"), we improve perfromance by allocating data blocks in advance
if we meet holes no matter in i_size or not, since with it we can avoid falling
back to buffered IO.
But we forget to consider for unwritten fallocated block in this commit.
This patch tries to fix it for fallocate case, this helps to improve
performance.
Test result:
Storage info: sandisk ultra 64G micro sd card.
touch /mnt/f2fs/file
truncate -s 67108864 /mnt/f2fs/file
fallocate -o 0 -l 67108864 /mnt/f2fs/file
time dd if=/dev/zero of=/mnt/f2fs/file bs=1M count=64 conv=notrunc oflag=direct
Time before applying the patch:
67108864 bytes (67 MB) copied, 36.16 s, 1.9 MB/s
real 0m36.162s
user 0m0.000s
sys 0m0.180s
Time after applying the patch:
67108864 bytes (67 MB) copied, 27.7776 s, 2.4 MB/s
real 0m27.780s
user 0m0.000s
sys 0m0.036s
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-23 10:33:37 +08:00
|
|
|
|
2015-02-09 12:09:53 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-29 13:28:09 +09:00
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
|
|
|
|
|
2013-12-21 18:02:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-09-21 20:17:52 +08:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-05 17:50:30 +08:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-02-05 17:51:34 +08:00
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
2015-02-05 17:50:30 +08:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
2015-02-09 12:09:53 -08:00
|
|
|
|
2014-09-02 15:31:18 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
2013-12-26 16:55:22 +09:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-23 16:38:02 +09:00
|
|
|
|
2015-09-18 16:51:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-21 20:17:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 16:51:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-09-18 16:51:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
2014-04-26 19:59:52 +08:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-26 16:55:22 +09:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
2014-04-26 19:59:52 +08:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
2015-09-18 16:51:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-21 20:17:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 16:51:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
2015-09-18 16:51:51 +08:00
|
|
|
|
2014-08-06 23:22:50 +09:00
|
|
|
|
2015-05-08 19:30:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
|
|
|
|
|
2014-09-02 15:31:18 -07:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
2013-12-16 19:04:05 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
2015-04-06 19:55:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-13 13:02:11 +09:00
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
2014-06-13 13:02:11 +09:00
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
2014-06-13 13:02:11 +09:00
|
|
|
|
|
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
2014-06-13 13:02:11 +09:00
|
|
|
|
|
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-13 13:02:11 +09:00
|
|
|
|
|
|
|
|
|
2015-05-08 19:30:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-08 04:30:14 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-08 19:30:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-15 11:34:49 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-08 19:30:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
|
|
|
|
|
2015-05-08 19:30:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-08 04:30:14 +09:00
|
|
|
|
|
|
|
|
|
2015-04-09 11:20:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-18 16:54:16 +08:00
|
|
|
|
|
|
|
|
|
2015-04-09 11:20:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-08 13:27:34 +08:00
|
|
|
|
|
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
|
|
|
|
|
2015-04-09 11:20:42 -07:00
|
|
|
|
2015-05-19 14:31:01 +02:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-09 11:20:42 -07:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
2015-04-09 11:20:42 -07:00
|
|
|
|
|
|
|
|
|
2015-05-25 18:03:38 +08:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
2015-04-09 11:20:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
f2fs: handle inline data operations
Hook inline data read/write, truncate, fallocate, setattr, etc.
Files need meet following 2 requirement to inline:
1) file size is not greater than MAX_INLINE_DATA;
2) file doesn't pre-allocate data blocks by fallocate().
FI_INLINE_DATA will not be set while creating a new regular inode because
most of the files are bigger than ~3.4K. Set FI_INLINE_DATA only when
data is submitted to block layer, ranther than set it while creating a new
inode, this also avoids converting data from inline to normal data block
and vice versa.
While writting inline data to inode block, the first data block should be
released if the file has a block indexed by i_addr[0].
On the other hand, when a file operation is appied to a file with inline
data, we need to test if this file can remain inline by doing this
operation, otherwise it should be convert into normal file by reserving
a new data block, copying inline data to this new block and clear
FI_INLINE_DATA flag. Because reserve a new data block here will make use
of i_addr[0], if we save inline data in i_addr[0..872], then the first
4 bytes would be overwriten. This problem can be avoided simply by
not using i_addr[0] for inline data.
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Weihong Xu <weihong.xu@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-11-10 23:13:20 +08:00
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
f2fs: handle inline data operations
Hook inline data read/write, truncate, fallocate, setattr, etc.
Files need meet following 2 requirement to inline:
1) file size is not greater than MAX_INLINE_DATA;
2) file doesn't pre-allocate data blocks by fallocate().
FI_INLINE_DATA will not be set while creating a new regular inode because
most of the files are bigger than ~3.4K. Set FI_INLINE_DATA only when
data is submitted to block layer, ranther than set it while creating a new
inode, this also avoids converting data from inline to normal data block
and vice versa.
While writting inline data to inode block, the first data block should be
released if the file has a block indexed by i_addr[0].
On the other hand, when a file operation is appied to a file with inline
data, we need to test if this file can remain inline by doing this
operation, otherwise it should be convert into normal file by reserving
a new data block, copying inline data to this new block and clear
FI_INLINE_DATA flag. Because reserve a new data block here will make use
of i_addr[0], if we save inline data in i_addr[0..872], then the first
4 bytes would be overwriten. This problem can be avoided simply by
not using i_addr[0] for inline data.
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Weihong Xu <weihong.xu@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-11-10 23:13:20 +08:00
|
|
|
|
2014-05-06 16:53:08 +08:00
|
|
|
|
|
|
|
|
|
2014-08-06 23:22:50 +09:00
|
|
|
|
f2fs: handle inline data operations
Hook inline data read/write, truncate, fallocate, setattr, etc.
Files need meet following 2 requirement to inline:
1) file size is not greater than MAX_INLINE_DATA;
2) file doesn't pre-allocate data blocks by fallocate().
FI_INLINE_DATA will not be set while creating a new regular inode because
most of the files are bigger than ~3.4K. Set FI_INLINE_DATA only when
data is submitted to block layer, ranther than set it while creating a new
inode, this also avoids converting data from inline to normal data block
and vice versa.
While writting inline data to inode block, the first data block should be
released if the file has a block indexed by i_addr[0].
On the other hand, when a file operation is appied to a file with inline
data, we need to test if this file can remain inline by doing this
operation, otherwise it should be convert into normal file by reserving
a new data block, copying inline data to this new block and clear
FI_INLINE_DATA flag. Because reserve a new data block here will make use
of i_addr[0], if we save inline data in i_addr[0..872], then the first
4 bytes would be overwriten. This problem can be avoided simply by
not using i_addr[0] for inline data.
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Weihong Xu <weihong.xu@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-11-10 23:13:20 +08:00
|
|
|
|
|
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
2015-04-09 11:20:42 -07:00
|
|
|
|
f2fs: handle inline data operations
Hook inline data read/write, truncate, fallocate, setattr, etc.
Files need meet following 2 requirement to inline:
1) file size is not greater than MAX_INLINE_DATA;
2) file doesn't pre-allocate data blocks by fallocate().
FI_INLINE_DATA will not be set while creating a new regular inode because
most of the files are bigger than ~3.4K. Set FI_INLINE_DATA only when
data is submitted to block layer, ranther than set it while creating a new
inode, this also avoids converting data from inline to normal data block
and vice versa.
While writting inline data to inode block, the first data block should be
released if the file has a block indexed by i_addr[0].
On the other hand, when a file operation is appied to a file with inline
data, we need to test if this file can remain inline by doing this
operation, otherwise it should be convert into normal file by reserving
a new data block, copying inline data to this new block and clear
FI_INLINE_DATA flag. Because reserve a new data block here will make use
of i_addr[0], if we save inline data in i_addr[0..872], then the first
4 bytes would be overwriten. This problem can be avoided simply by
not using i_addr[0] for inline data.
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Weihong Xu <weihong.xu@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-11-10 23:13:20 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: handle inline data operations
Hook inline data read/write, truncate, fallocate, setattr, etc.
Files need meet following 2 requirement to inline:
1) file size is not greater than MAX_INLINE_DATA;
2) file doesn't pre-allocate data blocks by fallocate().
FI_INLINE_DATA will not be set while creating a new regular inode because
most of the files are bigger than ~3.4K. Set FI_INLINE_DATA only when
data is submitted to block layer, ranther than set it while creating a new
inode, this also avoids converting data from inline to normal data block
and vice versa.
While writting inline data to inode block, the first data block should be
released if the file has a block indexed by i_addr[0].
On the other hand, when a file operation is appied to a file with inline
data, we need to test if this file can remain inline by doing this
operation, otherwise it should be convert into normal file by reserving
a new data block, copying inline data to this new block and clear
FI_INLINE_DATA flag. Because reserve a new data block here will make use
of i_addr[0], if we save inline data in i_addr[0..872], then the first
4 bytes would be overwriten. This problem can be avoided simply by
not using i_addr[0] for inline data.
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Weihong Xu <weihong.xu@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-11-10 23:13:20 +08:00
|
|
|
|
2015-10-12 17:02:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: handle inline data operations
Hook inline data read/write, truncate, fallocate, setattr, etc.
Files need meet following 2 requirement to inline:
1) file size is not greater than MAX_INLINE_DATA;
2) file doesn't pre-allocate data blocks by fallocate().
FI_INLINE_DATA will not be set while creating a new regular inode because
most of the files are bigger than ~3.4K. Set FI_INLINE_DATA only when
data is submitted to block layer, ranther than set it while creating a new
inode, this also avoids converting data from inline to normal data block
and vice versa.
While writting inline data to inode block, the first data block should be
released if the file has a block indexed by i_addr[0].
On the other hand, when a file operation is appied to a file with inline
data, we need to test if this file can remain inline by doing this
operation, otherwise it should be convert into normal file by reserving
a new data block, copying inline data to this new block and clear
FI_INLINE_DATA flag. Because reserve a new data block here will make use
of i_addr[0], if we save inline data in i_addr[0..872], then the first
4 bytes would be overwriten. This problem can be avoided simply by
not using i_addr[0] for inline data.
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Weihong Xu <weihong.xu@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-11-10 23:13:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-09 11:20:42 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-26 13:10:46 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2015-02-25 19:25:01 -08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-02-25 19:25:01 -08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
2015-10-08 13:27:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2013-06-13 16:59:29 +08:00
|
|
|
|
|
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2014-07-25 07:40:59 -07:00
|
|
|
|
2015-03-17 17:58:08 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2015-03-19 19:23:32 +08:00
|
|
|
|
2015-02-05 17:51:34 +08:00
|
|
|
|
2015-03-17 17:58:08 -07:00
|
|
|
|
2014-07-25 07:40:59 -07:00
|
|
|
|
2015-03-17 17:16:35 -07:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-02 15:31:18 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: handle inline data operations
Hook inline data read/write, truncate, fallocate, setattr, etc.
Files need meet following 2 requirement to inline:
1) file size is not greater than MAX_INLINE_DATA;
2) file doesn't pre-allocate data blocks by fallocate().
FI_INLINE_DATA will not be set while creating a new regular inode because
most of the files are bigger than ~3.4K. Set FI_INLINE_DATA only when
data is submitted to block layer, ranther than set it while creating a new
inode, this also avoids converting data from inline to normal data block
and vice versa.
While writting inline data to inode block, the first data block should be
released if the file has a block indexed by i_addr[0].
On the other hand, when a file operation is appied to a file with inline
data, we need to test if this file can remain inline by doing this
operation, otherwise it should be convert into normal file by reserving
a new data block, copying inline data to this new block and clear
FI_INLINE_DATA flag. Because reserve a new data block here will make use
of i_addr[0], if we save inline data in i_addr[0..872], then the first
4 bytes would be overwriten. This problem can be avoided simply by
not using i_addr[0] for inline data.
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Weihong Xu <weihong.xu@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-11-10 23:13:20 +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
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
2014-01-17 14:44:39 -06:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-05-06 16:48:26 +08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +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
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-15 16:04:15 +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
|
|
|
|
2012-11-02 17:10:12 +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
|
|
|
|
2015-01-28 17:48:42 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-12-09 06:08:59 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +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
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-08-11 18:37:46 -07:00
|
|
|
|
|
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2014-02-17 19:29:27 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-02-17 19:29:27 +09:00
|
|
|
|
2014-08-11 18:37:46 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-12 15:53:45 -07:00
|
|
|
|
2014-08-11 18:37:46 -07:00
|
|
|
|
|
|
|
|
|
2014-02-17 19:29:27 +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
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
2014-02-17 19:29:27 +09:00
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2014-02-17 19:29:27 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +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-09-12 15:53:45 -07:00
|
|
|
|
2015-02-25 19:25:01 -08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +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
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-04-24 09:49:52 +09:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-15 16:04:15 +09:00
|
|
|
|
2014-02-17 19:29:27 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2013-01-15 16:45:24 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: expose f2fs_write_cache_pages
If there are gced dirty pages and normal dirty pages in the mapping
of one inode, we might writeback them alternately with discontinuous
block address, resulting in low performance.
This patch introduces f2fs_write_cache_pages with codes copied from
write_cache_pages in mm/page-writeback.c.
In this function, we refactor flow with two steps:
1) writeback all cold type pages.
2) writeback all non-cold type pages.
By using this method, f2fs will writeback dirty pages with the same
temperature in bunch mode, it makes writeouted block being with
more continuous address, so they can be merged as much as possible
in f2fs bio cache, and also it will reduce the chance of submiting
small IO from block layer.
Test environment: 8g nokia sd card (very old sd card, but it shows
better effect when testing with this patch, and with a 32g kingston
sd card, I didn't see much more improvement).
Test step:
1. touch testfile;
2. truncate -s 512K testfile;
3. write all pages with odd index;
4. trigger gc by ioctl;
5. write all pages with even index;
6. time fsync testfile.
before:
real 0m0.402s
user 0m0.000s
sys 0m0.000s
after:
real 0m0.143s
user 0m0.004s
sys 0m0.004s
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-07-14 18:56:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-17 12:56:00 +08:00
|
|
|
|
f2fs: expose f2fs_write_cache_pages
If there are gced dirty pages and normal dirty pages in the mapping
of one inode, we might writeback them alternately with discontinuous
block address, resulting in low performance.
This patch introduces f2fs_write_cache_pages with codes copied from
write_cache_pages in mm/page-writeback.c.
In this function, we refactor flow with two steps:
1) writeback all cold type pages.
2) writeback all non-cold type pages.
By using this method, f2fs will writeback dirty pages with the same
temperature in bunch mode, it makes writeouted block being with
more continuous address, so they can be merged as much as possible
in f2fs bio cache, and also it will reduce the chance of submiting
small IO from block layer.
Test environment: 8g nokia sd card (very old sd card, but it shows
better effect when testing with this patch, and with a 32g kingston
sd card, I didn't see much more improvement).
Test step:
1. touch testfile;
2. truncate -s 512K testfile;
3. write all pages with odd index;
4. trigger gc by ioctl;
5. write all pages with even index;
6. time fsync testfile.
before:
real 0m0.402s
user 0m0.000s
sys 0m0.000s
after:
real 0m0.143s
user 0m0.004s
sys 0m0.004s
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-07-14 18:56:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-28 16:12:41 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-02 15:31:18 -07:00
|
|
|
|
2015-04-21 10:40:54 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-03-18 13:47:11 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-05-06 16:51:24 +08:00
|
|
|
|
|
|
|
|
|
2013-04-03 11:38:00 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-17 18:02:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-08 10:40:07 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-27 13:37:39 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-18 13:47:11 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-21 10:40:54 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: expose f2fs_write_cache_pages
If there are gced dirty pages and normal dirty pages in the mapping
of one inode, we might writeback them alternately with discontinuous
block address, resulting in low performance.
This patch introduces f2fs_write_cache_pages with codes copied from
write_cache_pages in mm/page-writeback.c.
In this function, we refactor flow with two steps:
1) writeback all cold type pages.
2) writeback all non-cold type pages.
By using this method, f2fs will writeback dirty pages with the same
temperature in bunch mode, it makes writeouted block being with
more continuous address, so they can be merged as much as possible
in f2fs bio cache, and also it will reduce the chance of submiting
small IO from block layer.
Test environment: 8g nokia sd card (very old sd card, but it shows
better effect when testing with this patch, and with a 32g kingston
sd card, I didn't see much more improvement).
Test step:
1. touch testfile;
2. truncate -s 512K testfile;
3. write all pages with odd index;
4. trigger gc by ioctl;
5. write all pages with even index;
6. time fsync testfile.
before:
real 0m0.402s
user 0m0.000s
sys 0m0.000s
after:
real 0m0.143s
user 0m0.004s
sys 0m0.004s
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-07-14 18:56:10 +08:00
|
|
|
|
f2fs: enhance multithread performance
In ->writepages, we use writepages mutex lock to serialize all block
address allocation and page submitting pairs from different inodes.
This method makes our delayed dirty pages of one inode being written
continously as many as possible.
But there is one problem that we did not submit current cached bio in
protection region of writepages mutex lock, so there is a small chance
that we submit the one of other thread's as below, resulting in
splitting more bios.
thread 1 thread 2
->writepages
lock(writepages)
->write_cache_pages
unlock(writepages)
lock(writepages)
->write_cache_pages
->f2fs_submit_merged_bio
->writepage
unlock(writepages)
fs_mark-6535 [002] .... 2242.270230: f2fs_submit_write_bio: dev = (1,0), WRITE_SYNC, DATA, sector = 5766152, size = 524288
fs_mark-6536 [000] .... 2242.270361: f2fs_submit_write_bio: dev = (1,0), WRITE_SYNC, DATA, sector = 5767176, size = 4096
fs_mark-6536 [000] .... 2242.270370: f2fs_submit_write_bio: dev = (1,0), WRITE_SYNC, NODE, sector = 8138112, size = 4096
fs_mark-6535 [002] .... 2242.270776: f2fs_submit_write_bio: dev = (1,0), WRITE_SYNC, DATA, sector = 5767184, size = 516096
This may really increase time of block layer works, and may cause
larger IO lantency.
This patch moves the submitting operation into region of writepages
mutex lock to avoid bio splits when concurrently writebacking is
intensive.
my test environment: virtual machine,
intel cpu i5 2500, 8GB size memory, 4GB size ramdisk
time fs_mark -t 16 -L 1 -s 524288 -S 1 -d /mnt/f2fs/
before:
real 0m4.244s
user 0m0.088s
sys 0m12.336s
after:
real 0m3.822s
user 0m0.072s
sys 0m10.760s
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-07-06 20:31:49 +08:00
|
|
|
|
2015-04-21 10:40:54 -07:00
|
|
|
|
|
|
|
|
|
2013-12-11 13:54:01 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2014-03-18 13:47:11 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-03-18 13:43:05 +09:00
|
|
|
|
|
|
|
|
|
2014-09-12 15:53:45 -07:00
|
|
|
|
2014-03-18 13:43:05 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2014-07-02 13:25:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-14 16:32:54 -07:00
|
|
|
|
2014-07-02 13:25:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-02 15:31:18 -07:00
|
|
|
|
2015-07-15 13:08:21 -07:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-05-06 16:46:04 +08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-11-25 10:59:45 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-26 11:55:17 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-07-02 13:25:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-30 09:22:45 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
f2fs: use rw_sem instead of fs_lock(locks mutex)
The fs_locks is used to block other ops(ex, recovery) when doing checkpoint.
And each other operate routine(besides checkpoint) needs to acquire a fs_lock,
there is a terrible problem here, if these are too many concurrency threads acquiring
fs_lock, so that they will block each other and may lead to some performance problem,
but this is not the phenomenon we want to see.
Though there are some optimization patches introduced to enhance the usage of fs_lock,
but the thorough solution is using a *rw_sem* to replace the fs_lock.
Checkpoint routine takes write_sem, and other ops take read_sem, so that we can block
other ops(ex, recovery) when doing checkpoint, and other ops will not disturb each other,
this can avoid the problem described above completely.
Because of the weakness of rw_sem, the above change may introduce a potential problem
that the checkpoint thread might get starved if other threads are intensively locking
the read semaphore for I/O.(Pointed out by Xu Jin)
In order to avoid this, a wait_list is introduced, the appending read semaphore ops
will be dropped into the wait_list if checkpoint thread is waiting for write semaphore,
and will be waked up when checkpoint thread gives up write semaphore.
Thanks to Kim's previous review and test, and will be very glad to see other guys'
performance tests about this patch.
V2:
-fix the potential starvation problem.
-use more suitable func name suggested by Xu Jin.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
[Jaegeuk Kim: adjust minor coding standard]
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-09-27 18:08:30 +08:00
|
|
|
|
2014-10-17 20:33:55 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-01 11:30:20 +08:00
|
|
|
|
|
|
|
|
|
2014-10-17 20:33:55 -07:00
|
|
|
|
2014-12-01 11:30:20 +08:00
|
|
|
|
2014-10-17 20:33:55 -07:00
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
2014-10-17 20:33:55 -07:00
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-25 10:59:45 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
2015-08-05 15:52:16 +08:00
|
|
|
|
|
|
|
|
|
2014-10-17 20:33:55 -07:00
|
|
|
|
2014-11-17 16:14:11 -08:00
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
2014-10-17 20:33:55 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
|
|
|
|
|
2015-10-08 13:27:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-08 18:24:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-08 18:24:38 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
2014-12-17 19:33:13 -08:00
|
|
|
|
2015-04-23 14:38:15 -07:00
|
|
|
|
2014-10-22 15:21:47 +02:00
|
|
|
|
|
|
|
|
|
2014-03-29 15:30:40 +08:00
|
|
|
|
2013-03-08 21:29:23 +09:00
|
|
|
|
2013-12-06 15:00:58 +09:00
|
|
|
|
2014-07-02 13:25:04 +08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-12-06 15:00:58 +09:00
|
|
|
|
2013-04-26 11:55:17 +09:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-15 13:08:21 -07:00
|
|
|
|
2015-04-23 12:04:33 -07:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-07-08 18:24:38 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-07-08 18:24:38 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2014-10-17 20:33:55 -07:00
|
|
|
|
2014-11-17 16:14:11 -08:00
|
|
|
|
|
|
|
|
|
2014-10-17 20:33:55 -07:00
|
|
|
|
|
|
|
|
|
2014-07-02 13:25:04 +08:00
|
|
|
|
2015-07-15 13:08:21 -07:00
|
|
|
|
2014-07-02 13:25:04 +08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2013-06-27 13:04:08 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-05-06 16:47:23 +08:00
|
|
|
|
|
|
|
|
|
2014-10-09 13:19:53 -07:00
|
|
|
|
2013-06-27 13:04:08 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-16 14:15:59 +08:00
|
|
|
|
2013-06-27 13:04:08 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-16 04:33:52 -07:00
|
|
|
|
|
|
|
|
|
2013-12-26 20:15:09 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-16 18:07:34 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-26 20:15:09 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-16 04:33:53 -07:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2014-07-02 13:25:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-26 20:15:09 +09:00
|
|
|
|
2014-10-23 19:48:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f2fs: handle inline data operations
Hook inline data read/write, truncate, fallocate, setattr, etc.
Files need meet following 2 requirement to inline:
1) file size is not greater than MAX_INLINE_DATA;
2) file doesn't pre-allocate data blocks by fallocate().
FI_INLINE_DATA will not be set while creating a new regular inode because
most of the files are bigger than ~3.4K. Set FI_INLINE_DATA only when
data is submitted to block layer, ranther than set it while creating a new
inode, this also avoids converting data from inline to normal data block
and vice versa.
While writting inline data to inode block, the first data block should be
released if the file has a block indexed by i_addr[0].
On the other hand, when a file operation is appied to a file with inline
data, we need to test if this file can remain inline by doing this
operation, otherwise it should be convert into normal file by reserving
a new data block, copying inline data to this new block and clear
FI_INLINE_DATA flag. Because reserve a new data block here will make use
of i_addr[0], if we save inline data in i_addr[0..872], then the first
4 bytes would be overwriten. This problem can be avoided simply by
not using i_addr[0] for inline data.
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Weihong Xu <weihong.xu@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-11-10 23:13:20 +08:00
|
|
|
|
2015-04-21 20:39:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-07 18:39:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-26 20:15:09 +09:00
|
|
|
|
2015-03-16 04:33:52 -07:00
|
|
|
|
2014-07-31 21:11:22 +08:00
|
|
|
|
2015-09-21 20:17:52 +08:00
|
|
|
|
2015-02-09 12:09:53 -08:00
|
|
|
|
2015-09-21 20:17:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-09 12:09:53 -08:00
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
2015-09-21 20:17:52 +08:00
|
|
|
|
2015-03-16 04:33:52 -07:00
|
|
|
|
2014-07-02 13:25:04 +08:00
|
|
|
|
2014-07-31 21:11:22 +08:00
|
|
|
|
2015-03-16 04:33:52 -07:00
|
|
|
|
2014-07-31 21:11:22 +08:00
|
|
|
|
2014-07-02 13:25:04 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2015-02-05 17:44:29 +08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2015-02-05 17:44:29 +08:00
|
|
|
|
2014-09-12 15:53:45 -07:00
|
|
|
|
2015-02-05 17:44:29 +08:00
|
|
|
|
|
|
|
|
|
2014-09-12 15:53:45 -07:00
|
|
|
|
|
|
|
|
|
2015-02-05 17:44:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-07 18:42:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-05 17:44:29 +08:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-01-30 11:39:08 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-07 18:42:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-03-14 09:24:32 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-24 17:53:29 +09:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2014-10-09 13:19:53 -07:00
|
|
|
|
2014-12-09 06:08:59 -08:00
|
|
|
|
2015-08-07 18:42:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-09 13:19:53 -07:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
2014-09-12 15:53:45 -07:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-17 20:30:23 +09:00
|
|
|
|
|
|
|
|
|
2014-04-22 13:34:01 +08:00
|
|
|
|
|
|
|
|
|
2015-10-19 10:29:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-19 19:11:19 +08:00
|
|
|
|
2015-02-05 17:54:31 +08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-27 13:04:08 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2015-02-05 17:44:29 +08:00
|
|
|
|
|
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|
2013-01-17 20:30:23 +09:00
|
|
|
|
2012-11-02 17:10:12 +09:00
|
|
|
|