Reply: Reply: Reply: [PATCH -next 2/4] f2fs: extent cache: support extent for no-compressed file
Quoted 64 lines · zhangqilong
Quoted 58 lines
Quoted 49 lines · zhangqilong
Quoted 5 lines
Quoted 5 lines · zhangqilong
Quoted 4 lines
Quoted 4 lines · Zhang Qilong
Quoted 3 lines
No-compressed file may suffer read performance issue due to it can't use extent cache or the largest extent in inode can't covered other parts of continuous blocks in readonly format f2fs
image.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Now it won't build extent cacge tree for no-compressed file in readonly format f2fs image.
For readonly format f2fs image, maybe the no-compressed file
don't
Quoted 14 lines
Quoted 14 lines
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines
have the largest extent, or it have more than one part which have
Why it can not have largest extent in
f2fs_inode?The following several situations may occur:
1) Wrote w/o the extent when the filesystem is read-write fs.2) Largest extent have been drop after being re-wrote, or
it havebeen split to smaller parts.
Quoted 3 lines
3) The largest extent only covered one part of continuous
blocks,Quoted 7 lines
Quoted 7 lines
like:
Quoted 1 line
|------parts 1(continuous blocks)-----|----notcontinuous---|---------------------parts 2 (continuous continuous---|blocks)-----------|---------|
Quoted 2 lines
The largest extent is part 2, but other parts (like
part1, ) can't bemapped in readonly format f2fs image which should have been
mapped.
Quoted 9 lines
Quoted 3 lines
largest extent of non-compressed file should be updated during sload in a ro f2fs image?
Hi,
I am sorry, I don't fully understand what you mean. I want to show that the extent of file in readonly format f2fs image could not existed or
can't covered other parts that contain continuous blocks.
Well, I mean the extent should be updated due to below flow? during the file was loaded into a formated f2fs image w/ ro feature.
Quoted 8 lines
-
f2fs_sload
-build_directory
-f2fs_build_fileif (!c.compress.enabled || (c.feature &
cpu_to_le32(F2FS_FEATURE_RO)))update_largest_extent(sbi, de->ino);Quoted 5 lines
Hi,
I get it. I think we could consider this flow.
But it will change the metadata of the file, is it was a little inappropriate? Maybe users does not want to do that during being loaded and will
Quoted 6 lines
refuse this change.
I don't get it.
IIUC, we can only load files into ro f2fs image w/ sload, and sload has updated largest extent for file, or am I missing something?
Ah, maybe I misunderstood your idea just now. We could updated largest extent for file when loading into ro f2fs image w/ sload, but it will not solve situations 3) issue for the no-compressed file that be mentioned previously.
Thanks,
Quoted 130 lines
Thanks,
Quoted 27 lines
Thanks,
Quoted 24 lines
Thanks,
Quoted 2 lines
Whether it exists or not, we will not change or update largest extent
during sload in a ro f2fs image.
Quoted 19 lines
Thanks,
Quoted 16 lines
Thanks,
Quoted 13 lines
Thanks,
Quoted 9 lines
Thanks,
Quoted 6 lines
internally continuous blocks. So we add extent cache tree for the no-compressed file in readonly format f2fs image.
The cache policy is almost same with compressed file. The difference is that, the no-compressed file part will set min-number of continuous blocks
F2FS_MIN_EXTENT_LENinorder
Quoted 10 lines
Quoted 10 lines
to
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
reduce cache
fragmentation.
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Signed-off-by Zhang Qilong <[email protected]>--- fs/f2fs/extent_cache.c | 52++++++++++++++++++++++++++++++++++--------
Quoted 2 lines
1 file changed, 42 insertions(+), 10 deletions(-)Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
fs/f2fs/extent_cache.c static void
Quoted 6 lines
fs/f2fs/extent_cache.c +0
-0index
387d53a61270..7e39381edca0100644fs/f2fs/extent_cache.c +0
-0@@ -695,9 +695,12 @@ static voidf2fs_update_extent_tree_range_compressed(struct inode
*inode,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
fs/f2fs/extent_cache.c static void · line 698
Quoted 4 lines
fs/f2fs/extent_cache.c +0
-1set_extent_info (&ei, fofs, blkaddr, llen); ei.c_len = c_len; - if (!__try_merge_extent_node(sbi, et, &ei, prev_en,
next_en))Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
fs/f2fs/extent_cache.c static void · line 698
Quoted 1 line
fs/f2fs/extent_cache.c +1
-0+ if (!__try_merge_extent_node(sbi, et, &ei, prev_en,
next_en)) {Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 10 lines
Quoted 10 lines
fs/f2fs/extent_cache.c static unsigned int
Quoted 9 lines
fs/f2fs/extent_cache.c +3
-0+if (!c_len && llen <F2FS_MIN_EXTENT_LEN ) + goto unlock_out;__insert_extent_tree (sbi, et, &ei, insert_p, insert_parent, leftmost); + } unlock_out:write_unlock (&et->lock); }@@ -726,24 +729,53 @@ static unsigned int
f2fs_cluster_blocks_are_contiguous(struct dnode_of_data *dn)Quoted 7 lines
Quoted 7 lines
fs/f2fs/extent_cache.c static unsigned int · line 735
Quoted 7 lines
fs/f2fs/extent_cache.c +4
-0return compressed ? i -1 : i; } +/* +* check whether normal file blocks are contiguous, and add +extent cache +* entry only if remained blocks are logically and physically contiguous.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/extent_cache.c static unsigned int · line 743
Quoted 8 lines
fs/f2fs/extent_cache.c +8
-0+*/ +static unsigned int f2fs_normal_blocks_are_contiguous (struct +dnode_of_data *dn) { +int i =0 ; +struct inode *inode = dn->inode; +block_t first_blkaddr =data_blkaddr (inode, dn->node_page, + dn->ofs_in_node); + unsigned int max_blocks =ADDRS_PER_PAGE(dn->node_page,
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 16 lines
inode)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
fs/f2fs/extent_cache.c +7
-0+ - dn->ofs_in_node; + +for (i =1 ; i < max_blocks; i++) { +block_t blkaddr =data_blkaddr (inode, dn->node_page, + dn->ofs_in_node + i); + + if (!__is_valid_data_blkaddr(blkaddr) ||Quoted 8 lines
Quoted 8 lines
fs/f2fs/extent_cache.c static unsigned int · line 758
Quoted 8 lines
fs/f2fs/extent_cache.c +7
-0+ first_blkaddr + i != blkaddr) +return i; + } + +return i; +} + void f2fs_readonly_update_extent_cache(struct
dnode_of_dataQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
*dn,
Quoted 3 lines
Quoted 3 lines
fs/f2fs/extent_cache.c static unsigned int · line 732
Quoted 3 lines
fs/f2fs/extent_cache.c +0
-1pgoff_t index) { - unsigned int c_len =
f2fs_cluster_blocks_are_contiguous(dn);Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
fs/f2fs/extent_cache.c +2
-0+unsigned int c_len =0 ; +unsigned int llen =0 ;block_t blkaddr;Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
fs/f2fs/extent_cache.c +0
-4-if (!c_len) -return ; - blkaddr =f2fs_data_blkaddr (dn); -if (blkaddr ==COMPRESS_ADDR )Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/extent_cache.c static unsigned int · line 772
Quoted 8 lines
fs/f2fs/extent_cache.c +7
-1- blkaddr = data_blkaddr(dn->inode, dn->node_page, +if (f2fs_compressed_file (dn->inode)) { + c_len =f2fs_cluster_blocks_are_contiguous (dn); +if (!c_len) +return ; + llen =F2FS_I (dn->inode)->i_cluster_size; +if (blkaddr ==COMPRESS_ADDR ) + blkaddr = data_blkaddr(dn->inode,
dn->node_page,Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
fs/f2fs/extent_cache.c static unsigned int · line 778
Quoted 6 lines
fs/f2fs/extent_cache.c +3
-0dn->ofs_in_node + 1); + }else { + llen =f2fs_normal_blocks_are_contiguous (dn); + }f2fs_update_extent_tree_range_compressed(dn->inode,
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
fs/f2fs/extent_cache.c static unsigned int · line 781
Quoted 7 lines
fs/f2fs/extent_cache.c +1
-3- index, blkaddr, -F2FS_I (dn->inode)->i_cluster_size, - c_len); + index, blkaddr, llen, c_len); }#endif
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 66 lines · zhangqilong
Quoted 66 lines · zhangqilong
Quoted 58 lines
Quoted 49 lines · zhangqilong
Quoted 5 lines
Quoted 5 lines · zhangqilong
Quoted 4 lines
Quoted 4 lines · Zhang Qilong
Quoted 3 lines
No-compressed file may suffer read performance issue due to it can't use extent cache or the largest extent in inode can't covered other parts of continuous blocks in readonly format f2fs
image.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Now it won't build extent cacge tree for no-compressed file in readonly format f2fs image.
For readonly format f2fs image, maybe the no-compressed file
don't
Quoted 14 lines
Quoted 14 lines
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines
have the largest extent, or it have more than one part which have
Why it can not have largest extent in
f2fs_inode?The following several situations may occur:
1) Wrote w/o the extent when the filesystem is read-write fs.2) Largest extent have been drop after being re-wrote, or
it havebeen split to smaller parts.
Quoted 3 lines
3) The largest extent only covered one part of continuous
blocks,Quoted 7 lines
Quoted 7 lines
like:
Quoted 1 line
|------parts 1(continuous blocks)-----|----notcontinuous---|---------------------parts 2 (continuous continuous---|blocks)-----------|---------|
Quoted 2 lines
The largest extent is part 2, but other parts (like
part1, ) can't bemapped in readonly format f2fs image which should have been
mapped.
Quoted 9 lines
Quoted 3 lines
largest extent of non-compressed file should be updated during sload in a ro f2fs image?
Hi,
I am sorry, I don't fully understand what you mean. I want to show that the extent of file in readonly format f2fs image could not existed or
can't covered other parts that contain continuous blocks.
Well, I mean the extent should be updated due to below flow? during the file was loaded into a formated f2fs image w/ ro feature.
Quoted 8 lines
-
f2fs_sload
-build_directory
-f2fs_build_fileif (!c.compress.enabled || (c.feature &
cpu_to_le32(F2FS_FEATURE_RO)))update_largest_extent(sbi, de->ino);Quoted 5 lines
Hi,
I get it. I think we could consider this flow.
But it will change the metadata of the file, is it was a little inappropriate? Maybe users does not want to do that during being loaded and willrefuse this change.
Quoted 8 lines
Quoted 4 lines
I don't get it.
IIUC, we can only load files into ro f2fs image w/ sload, and sload has updated largest extent for file, or am I missing something?
Ah, maybe I misunderstood your idea just now. We could updated largest extent for file when loading into ro f2fs image w/ sload, but it will not solve situations 3) issue for the no-compressed file that be mentioned previously.
Why case 3) can happen? The data blocks should be allocated contiguously while sload loads file into image?
Thanks,
Quoted 133 lines
Thanks,
Quoted 130 lines
Thanks,
Quoted 27 lines
Thanks,
Quoted 24 lines
Thanks,
Quoted 2 lines
Whether it exists or not, we will not change or update largest extent
during sload in a ro f2fs image.
Quoted 19 lines
Thanks,
Quoted 16 lines
Thanks,
Quoted 13 lines
Thanks,
Quoted 9 lines
Thanks,
Quoted 6 lines
internally continuous blocks. So we add extent cache tree for the no-compressed file in readonly format f2fs image.
The cache policy is almost same with compressed file. The difference is that, the no-compressed file part will set min-number of continuous blocks
F2FS_MIN_EXTENT_LENinorder
Quoted 10 lines
Quoted 10 lines
to
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
reduce cache
fragmentation.
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Signed-off-by Zhang Qilong <[email protected]>--- fs/f2fs/extent_cache.c | 52++++++++++++++++++++++++++++++++++--------
Quoted 2 lines
1 file changed, 42 insertions(+), 10 deletions(-)Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
fs/f2fs/extent_cache.c static void
Quoted 6 lines
fs/f2fs/extent_cache.c +0
-0index
387d53a61270..7e39381edca0100644fs/f2fs/extent_cache.c +0
-0@@ -695,9 +695,12 @@ static voidf2fs_update_extent_tree_range_compressed(struct inode
*inode,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
fs/f2fs/extent_cache.c static void · line 698
Quoted 4 lines
fs/f2fs/extent_cache.c +0
-1set_extent_info (&ei, fofs, blkaddr, llen); ei.c_len = c_len; - if (!__try_merge_extent_node(sbi, et, &ei, prev_en,
next_en))Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
fs/f2fs/extent_cache.c static void · line 698
Quoted 1 line
fs/f2fs/extent_cache.c +1
-0+ if (!__try_merge_extent_node(sbi, et, &ei, prev_en,
next_en)) {Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 10 lines
Quoted 10 lines
fs/f2fs/extent_cache.c static unsigned int
Quoted 9 lines
fs/f2fs/extent_cache.c +3
-0+if (!c_len && llen <F2FS_MIN_EXTENT_LEN ) + goto unlock_out;__insert_extent_tree (sbi, et, &ei, insert_p, insert_parent, leftmost); + } unlock_out:write_unlock (&et->lock); }@@ -726,24 +729,53 @@ static unsigned int
f2fs_cluster_blocks_are_contiguous(struct dnode_of_data *dn)Quoted 7 lines
Quoted 7 lines
fs/f2fs/extent_cache.c static unsigned int · line 735
Quoted 7 lines
fs/f2fs/extent_cache.c +4
-0return compressed ? i -1 : i; } +/* +* check whether normal file blocks are contiguous, and add +extent cache +* entry only if remained blocks are logically and physically contiguous.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/extent_cache.c static unsigned int · line 743
Quoted 8 lines
fs/f2fs/extent_cache.c +8
-0+*/ +static unsigned int f2fs_normal_blocks_are_contiguous (struct +dnode_of_data *dn) { +int i =0 ; +struct inode *inode = dn->inode; +block_t first_blkaddr =data_blkaddr (inode, dn->node_page, + dn->ofs_in_node); + unsigned int max_blocks =ADDRS_PER_PAGE(dn->node_page,
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 16 lines
inode)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
fs/f2fs/extent_cache.c +7
-0+ - dn->ofs_in_node; + +for (i =1 ; i < max_blocks; i++) { +block_t blkaddr =data_blkaddr (inode, dn->node_page, + dn->ofs_in_node + i); + + if (!__is_valid_data_blkaddr(blkaddr) ||Quoted 8 lines
Quoted 8 lines
fs/f2fs/extent_cache.c static unsigned int · line 758
Quoted 8 lines
fs/f2fs/extent_cache.c +7
-0+ first_blkaddr + i != blkaddr) +return i; + } + +return i; +} + void f2fs_readonly_update_extent_cache(struct
dnode_of_dataQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
*dn,
Quoted 3 lines
Quoted 3 lines
fs/f2fs/extent_cache.c static unsigned int · line 732
Quoted 3 lines
fs/f2fs/extent_cache.c +0
-1pgoff_t index) { - unsigned int c_len =
f2fs_cluster_blocks_are_contiguous(dn);Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
fs/f2fs/extent_cache.c +2
-0+unsigned int c_len =0 ; +unsigned int llen =0 ;block_t blkaddr;Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
fs/f2fs/extent_cache.c +0
-4-if (!c_len) -return ; - blkaddr =f2fs_data_blkaddr (dn); -if (blkaddr ==COMPRESS_ADDR )Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/extent_cache.c static unsigned int · line 772
Quoted 8 lines
fs/f2fs/extent_cache.c +7
-1- blkaddr = data_blkaddr(dn->inode, dn->node_page, +if (f2fs_compressed_file (dn->inode)) { + c_len =f2fs_cluster_blocks_are_contiguous (dn); +if (!c_len) +return ; + llen =F2FS_I (dn->inode)->i_cluster_size; +if (blkaddr ==COMPRESS_ADDR ) + blkaddr = data_blkaddr(dn->inode,
dn->node_page,Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
fs/f2fs/extent_cache.c static unsigned int · line 778
Quoted 6 lines
fs/f2fs/extent_cache.c +3
-0dn->ofs_in_node + 1); + }else { + llen =f2fs_normal_blocks_are_contiguous (dn); + }f2fs_update_extent_tree_range_compressed(dn->inode,
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
fs/f2fs/extent_cache.c static unsigned int · line 781
Quoted 7 lines
fs/f2fs/extent_cache.c +1
-3- index, blkaddr, -F2FS_I (dn->inode)->i_cluster_size, - c_len); + index, blkaddr, llen, c_len); }#endif
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel