* [f2fs-dev] [PATCH] f2fs: Make f2fs_readpages readable again
@ 2020-02-01 15:08 ` Matthew Wilcox
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Wilcox @ 2020-02-01 15:08 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, linux-fsdevel
Cc: Matthew Wilcox (Oracle)
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Remove the horrendous ifdeffery by slipping an IS_ENABLED into
f2fs_compressed_file().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/f2fs/data.c | 6 ------
fs/f2fs/f2fs.h | 3 ++-
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 8bd9afa81c54..41156a8f60a7 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2203,7 +2203,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
goto next_page;
}
-#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_compressed_file(inode)) {
/* there are remained comressed pages, submit them */
if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
@@ -2230,14 +2229,11 @@ int f2fs_mpage_readpages(struct address_space *mapping,
goto next_page;
}
read_single_page:
-#endif
ret = f2fs_read_single_page(inode, page, max_nr_pages, &map,
&bio, &last_block_in_bio, is_readahead);
if (ret) {
-#ifdef CONFIG_F2FS_FS_COMPRESSION
set_error_page:
-#endif
SetPageError(page);
zero_user_segment(page, 0, PAGE_SIZE);
unlock_page(page);
@@ -2246,7 +2242,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
if (pages)
put_page(page);
-#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_compressed_file(inode)) {
/* last page */
if (nr_pages == 1 && !f2fs_cluster_is_empty(&cc)) {
@@ -2257,7 +2252,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
f2fs_destroy_compress_ctx(&cc);
}
}
-#endif
}
BUG_ON(pages && !list_empty(pages));
if (bio)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 5355be6b6755..398d5a1f2867 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2706,7 +2706,8 @@ static inline int f2fs_has_inline_xattr(struct inode *inode)
static inline int f2fs_compressed_file(struct inode *inode)
{
- return S_ISREG(inode->i_mode) &&
+ return IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) &&
+ S_ISREG(inode->i_mode) &&
is_inode_flag_set(inode, FI_COMPRESSED_FILE);
}
--
2.24.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] f2fs: Make f2fs_readpages readable again
@ 2020-02-01 15:08 ` Matthew Wilcox
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Wilcox @ 2020-02-01 15:08 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, linux-fsdevel
Cc: Matthew Wilcox (Oracle)
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Remove the horrendous ifdeffery by slipping an IS_ENABLED into
f2fs_compressed_file().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/f2fs/data.c | 6 ------
fs/f2fs/f2fs.h | 3 ++-
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 8bd9afa81c54..41156a8f60a7 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2203,7 +2203,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
goto next_page;
}
-#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_compressed_file(inode)) {
/* there are remained comressed pages, submit them */
if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
@@ -2230,14 +2229,11 @@ int f2fs_mpage_readpages(struct address_space *mapping,
goto next_page;
}
read_single_page:
-#endif
ret = f2fs_read_single_page(inode, page, max_nr_pages, &map,
&bio, &last_block_in_bio, is_readahead);
if (ret) {
-#ifdef CONFIG_F2FS_FS_COMPRESSION
set_error_page:
-#endif
SetPageError(page);
zero_user_segment(page, 0, PAGE_SIZE);
unlock_page(page);
@@ -2246,7 +2242,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
if (pages)
put_page(page);
-#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_compressed_file(inode)) {
/* last page */
if (nr_pages == 1 && !f2fs_cluster_is_empty(&cc)) {
@@ -2257,7 +2252,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
f2fs_destroy_compress_ctx(&cc);
}
}
-#endif
}
BUG_ON(pages && !list_empty(pages));
if (bio)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 5355be6b6755..398d5a1f2867 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2706,7 +2706,8 @@ static inline int f2fs_has_inline_xattr(struct inode *inode)
static inline int f2fs_compressed_file(struct inode *inode)
{
- return S_ISREG(inode->i_mode) &&
+ return IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) &&
+ S_ISREG(inode->i_mode) &&
is_inode_flag_set(inode, FI_COMPRESSED_FILE);
}
--
2.24.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [f2fs-dev] [PATCH v2] f2fs: Make f2fs_readpages readable again
2020-02-01 15:08 ` Matthew Wilcox
@ 2020-02-03 3:39 ` Matthew Wilcox
-1 siblings, 0 replies; 12+ messages in thread
From: Matthew Wilcox @ 2020-02-03 3:39 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, linux-fsdevel
Remove the horrendous ifdeffery by slipping an IS_ENABLED into
f2fs_compressed_file().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
v2: Fix compilation by adding more dummy functions
fs/f2fs/data.c | 6 ------
fs/f2fs/f2fs.h | 10 +++++++++-
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 8bd9afa81c54..41156a8f60a7 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2203,7 +2203,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
goto next_page;
}
-#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_compressed_file(inode)) {
/* there are remained comressed pages, submit them */
if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
@@ -2230,14 +2229,11 @@ int f2fs_mpage_readpages(struct address_space *mapping,
goto next_page;
}
read_single_page:
-#endif
ret = f2fs_read_single_page(inode, page, max_nr_pages, &map,
&bio, &last_block_in_bio, is_readahead);
if (ret) {
-#ifdef CONFIG_F2FS_FS_COMPRESSION
set_error_page:
-#endif
SetPageError(page);
zero_user_segment(page, 0, PAGE_SIZE);
unlock_page(page);
@@ -2246,7 +2242,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
if (pages)
put_page(page);
-#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_compressed_file(inode)) {
/* last page */
if (nr_pages == 1 && !f2fs_cluster_is_empty(&cc)) {
@@ -2257,7 +2252,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
f2fs_destroy_compress_ctx(&cc);
}
}
-#endif
}
BUG_ON(pages && !list_empty(pages));
if (bio)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 5355be6b6755..e90d2b3f1d2d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2706,7 +2706,8 @@ static inline int f2fs_has_inline_xattr(struct inode *inode)
static inline int f2fs_compressed_file(struct inode *inode)
{
- return S_ISREG(inode->i_mode) &&
+ return IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) &&
+ S_ISREG(inode->i_mode) &&
is_inode_flag_set(inode, FI_COMPRESSED_FILE);
}
@@ -3797,6 +3798,13 @@ static inline struct page *f2fs_compress_control_page(struct page *page)
WARN_ON_ONCE(1);
return ERR_PTR(-EINVAL);
}
+#define f2fs_cluster_can_merge_page(cc, index) false
+#define f2fs_read_multi_pages(cc, bio, nr_pages, last, is_ra) 0
+#define f2fs_init_compress_ctx(cc) 0
+#define f2fs_destroy_compress_ctx(cc) (void)0
+#define f2fs_cluster_is_empty(cc) true
+#define f2fs_compress_ctx_add_page(cc, page) (void)0
+#define f2fs_is_compressed_cluster(cc, index) false
#endif
static inline void set_compress_context(struct inode *inode)
--
2.24.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2] f2fs: Make f2fs_readpages readable again
@ 2020-02-03 3:39 ` Matthew Wilcox
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Wilcox @ 2020-02-03 3:39 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, linux-fsdevel
Remove the horrendous ifdeffery by slipping an IS_ENABLED into
f2fs_compressed_file().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
v2: Fix compilation by adding more dummy functions
fs/f2fs/data.c | 6 ------
fs/f2fs/f2fs.h | 10 +++++++++-
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 8bd9afa81c54..41156a8f60a7 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2203,7 +2203,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
goto next_page;
}
-#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_compressed_file(inode)) {
/* there are remained comressed pages, submit them */
if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
@@ -2230,14 +2229,11 @@ int f2fs_mpage_readpages(struct address_space *mapping,
goto next_page;
}
read_single_page:
-#endif
ret = f2fs_read_single_page(inode, page, max_nr_pages, &map,
&bio, &last_block_in_bio, is_readahead);
if (ret) {
-#ifdef CONFIG_F2FS_FS_COMPRESSION
set_error_page:
-#endif
SetPageError(page);
zero_user_segment(page, 0, PAGE_SIZE);
unlock_page(page);
@@ -2246,7 +2242,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
if (pages)
put_page(page);
-#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_compressed_file(inode)) {
/* last page */
if (nr_pages == 1 && !f2fs_cluster_is_empty(&cc)) {
@@ -2257,7 +2252,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
f2fs_destroy_compress_ctx(&cc);
}
}
-#endif
}
BUG_ON(pages && !list_empty(pages));
if (bio)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 5355be6b6755..e90d2b3f1d2d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2706,7 +2706,8 @@ static inline int f2fs_has_inline_xattr(struct inode *inode)
static inline int f2fs_compressed_file(struct inode *inode)
{
- return S_ISREG(inode->i_mode) &&
+ return IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) &&
+ S_ISREG(inode->i_mode) &&
is_inode_flag_set(inode, FI_COMPRESSED_FILE);
}
@@ -3797,6 +3798,13 @@ static inline struct page *f2fs_compress_control_page(struct page *page)
WARN_ON_ONCE(1);
return ERR_PTR(-EINVAL);
}
+#define f2fs_cluster_can_merge_page(cc, index) false
+#define f2fs_read_multi_pages(cc, bio, nr_pages, last, is_ra) 0
+#define f2fs_init_compress_ctx(cc) 0
+#define f2fs_destroy_compress_ctx(cc) (void)0
+#define f2fs_cluster_is_empty(cc) true
+#define f2fs_compress_ctx_add_page(cc, page) (void)0
+#define f2fs_is_compressed_cluster(cc, index) false
#endif
static inline void set_compress_context(struct inode *inode)
--
2.24.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] f2fs: Make f2fs_readpages readable again
2020-02-01 15:08 ` Matthew Wilcox
(?)
(?)
@ 2020-02-04 5:19 ` kbuild test robot
-1 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2020-02-04 5:19 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 12016 bytes --]
Hi Matthew,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on f2fs/dev-test]
[cannot apply to v5.5]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Matthew-Wilcox/f2fs-Make-f2fs_readpages-readable-again/20200203-113612
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: mips-randconfig-a001-20200203 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 5.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=5.5.0 make.cross ARCH=mips
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
fs//f2fs/data.c: In function 'f2fs_mpage_readpages':
fs//f2fs/data.c:2208:9: error: implicit declaration of function 'f2fs_cluster_can_merge_page' [-Werror=implicit-function-declaration]
if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
^
fs//f2fs/data.c:2208:38: error: 'cc' undeclared (first use in this function)
if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
^
fs//f2fs/data.c:2208:38: note: each undeclared identifier is reported only once for each function it appears in
>> fs//f2fs/data.c:2209:11: error: implicit declaration of function 'f2fs_read_multi_pages' [-Werror=implicit-function-declaration]
ret = f2fs_read_multi_pages(&cc, &bio,
^
>> fs//f2fs/data.c:2213:5: error: implicit declaration of function 'f2fs_destroy_compress_ctx' [-Werror=implicit-function-declaration]
f2fs_destroy_compress_ctx(&cc);
^
>> fs//f2fs/data.c:2217:10: error: implicit declaration of function 'f2fs_is_compressed_cluster' [-Werror=implicit-function-declaration]
ret = f2fs_is_compressed_cluster(inode, page->index);
^
>> fs//f2fs/data.c:2223:10: error: implicit declaration of function 'f2fs_init_compress_ctx' [-Werror=implicit-function-declaration]
ret = f2fs_init_compress_ctx(&cc);
^
>> fs//f2fs/data.c:2227:4: error: implicit declaration of function 'f2fs_compress_ctx_add_page' [-Werror=implicit-function-declaration]
f2fs_compress_ctx_add_page(&cc, page);
^
fs//f2fs/data.c:2247:26: error: implicit declaration of function 'f2fs_cluster_is_empty' [-Werror=implicit-function-declaration]
if (nr_pages == 1 && !f2fs_cluster_is_empty(&cc)) {
^
cc1: some warnings being treated as errors
vim +/f2fs_destroy_compress_ctx +2213 fs//f2fs/data.c
4c8ff7095bef64 Chao Yu 2019-11-01 2152
2df0ab045784a1 Chao Yu 2019-03-25 2153 /*
2df0ab045784a1 Chao Yu 2019-03-25 2154 * This function was originally taken from fs/mpage.c, and customized for f2fs.
2df0ab045784a1 Chao Yu 2019-03-25 2155 * Major change was from block_size == page_size in f2fs by default.
2df0ab045784a1 Chao Yu 2019-03-25 2156 *
2df0ab045784a1 Chao Yu 2019-03-25 2157 * Note that the aops->readpages() function is ONLY used for read-ahead. If
2df0ab045784a1 Chao Yu 2019-03-25 2158 * this function ever deviates from doing just read-ahead, it should either
2df0ab045784a1 Chao Yu 2019-03-25 2159 * use ->readpage() or do the necessary surgery to decouple ->readpages()
2df0ab045784a1 Chao Yu 2019-03-25 2160 * from read-ahead.
2df0ab045784a1 Chao Yu 2019-03-25 2161 */
4c8ff7095bef64 Chao Yu 2019-11-01 2162 int f2fs_mpage_readpages(struct address_space *mapping,
2df0ab045784a1 Chao Yu 2019-03-25 2163 struct list_head *pages, struct page *page,
2df0ab045784a1 Chao Yu 2019-03-25 2164 unsigned nr_pages, bool is_readahead)
2df0ab045784a1 Chao Yu 2019-03-25 2165 {
2df0ab045784a1 Chao Yu 2019-03-25 2166 struct bio *bio = NULL;
2df0ab045784a1 Chao Yu 2019-03-25 2167 sector_t last_block_in_bio = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2168 struct inode *inode = mapping->host;
2df0ab045784a1 Chao Yu 2019-03-25 2169 struct f2fs_map_blocks map;
4c8ff7095bef64 Chao Yu 2019-11-01 2170 #ifdef CONFIG_F2FS_FS_COMPRESSION
4c8ff7095bef64 Chao Yu 2019-11-01 2171 struct compress_ctx cc = {
4c8ff7095bef64 Chao Yu 2019-11-01 2172 .inode = inode,
4c8ff7095bef64 Chao Yu 2019-11-01 2173 .log_cluster_size = F2FS_I(inode)->i_log_cluster_size,
4c8ff7095bef64 Chao Yu 2019-11-01 2174 .cluster_size = F2FS_I(inode)->i_cluster_size,
4c8ff7095bef64 Chao Yu 2019-11-01 2175 .cluster_idx = NULL_CLUSTER,
4c8ff7095bef64 Chao Yu 2019-11-01 2176 .rpages = NULL,
4c8ff7095bef64 Chao Yu 2019-11-01 2177 .cpages = NULL,
4c8ff7095bef64 Chao Yu 2019-11-01 2178 .nr_rpages = 0,
4c8ff7095bef64 Chao Yu 2019-11-01 2179 .nr_cpages = 0,
4c8ff7095bef64 Chao Yu 2019-11-01 2180 };
4c8ff7095bef64 Chao Yu 2019-11-01 2181 #endif
4c8ff7095bef64 Chao Yu 2019-11-01 2182 unsigned max_nr_pages = nr_pages;
2df0ab045784a1 Chao Yu 2019-03-25 2183 int ret = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2184
2df0ab045784a1 Chao Yu 2019-03-25 2185 map.m_pblk = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2186 map.m_lblk = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2187 map.m_len = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2188 map.m_flags = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2189 map.m_next_pgofs = NULL;
2df0ab045784a1 Chao Yu 2019-03-25 2190 map.m_next_extent = NULL;
2df0ab045784a1 Chao Yu 2019-03-25 2191 map.m_seg_type = NO_CHECK_TYPE;
2df0ab045784a1 Chao Yu 2019-03-25 2192 map.m_may_create = false;
2df0ab045784a1 Chao Yu 2019-03-25 2193
2df0ab045784a1 Chao Yu 2019-03-25 2194 for (; nr_pages; nr_pages--) {
2df0ab045784a1 Chao Yu 2019-03-25 2195 if (pages) {
2df0ab045784a1 Chao Yu 2019-03-25 2196 page = list_last_entry(pages, struct page, lru);
2df0ab045784a1 Chao Yu 2019-03-25 2197
2df0ab045784a1 Chao Yu 2019-03-25 2198 prefetchw(&page->flags);
2df0ab045784a1 Chao Yu 2019-03-25 2199 list_del(&page->lru);
2df0ab045784a1 Chao Yu 2019-03-25 2200 if (add_to_page_cache_lru(page, mapping,
4969c06a0d83c9 Jaegeuk Kim 2019-07-01 2201 page_index(page),
2df0ab045784a1 Chao Yu 2019-03-25 2202 readahead_gfp_mask(mapping)))
2df0ab045784a1 Chao Yu 2019-03-25 2203 goto next_page;
2df0ab045784a1 Chao Yu 2019-03-25 2204 }
2df0ab045784a1 Chao Yu 2019-03-25 2205
4c8ff7095bef64 Chao Yu 2019-11-01 2206 if (f2fs_compressed_file(inode)) {
4c8ff7095bef64 Chao Yu 2019-11-01 2207 /* there are remained comressed pages, submit them */
4c8ff7095bef64 Chao Yu 2019-11-01 2208 if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
4c8ff7095bef64 Chao Yu 2019-11-01 @2209 ret = f2fs_read_multi_pages(&cc, &bio,
4c8ff7095bef64 Chao Yu 2019-11-01 2210 max_nr_pages,
4c8ff7095bef64 Chao Yu 2019-11-01 2211 &last_block_in_bio,
4c8ff7095bef64 Chao Yu 2019-11-01 2212 is_readahead);
4c8ff7095bef64 Chao Yu 2019-11-01 @2213 f2fs_destroy_compress_ctx(&cc);
4c8ff7095bef64 Chao Yu 2019-11-01 2214 if (ret)
4c8ff7095bef64 Chao Yu 2019-11-01 2215 goto set_error_page;
4c8ff7095bef64 Chao Yu 2019-11-01 2216 }
4c8ff7095bef64 Chao Yu 2019-11-01 @2217 ret = f2fs_is_compressed_cluster(inode, page->index);
4c8ff7095bef64 Chao Yu 2019-11-01 2218 if (ret < 0)
4c8ff7095bef64 Chao Yu 2019-11-01 2219 goto set_error_page;
4c8ff7095bef64 Chao Yu 2019-11-01 2220 else if (!ret)
4c8ff7095bef64 Chao Yu 2019-11-01 2221 goto read_single_page;
4c8ff7095bef64 Chao Yu 2019-11-01 2222
4c8ff7095bef64 Chao Yu 2019-11-01 @2223 ret = f2fs_init_compress_ctx(&cc);
4c8ff7095bef64 Chao Yu 2019-11-01 2224 if (ret)
4c8ff7095bef64 Chao Yu 2019-11-01 2225 goto set_error_page;
4c8ff7095bef64 Chao Yu 2019-11-01 2226
4c8ff7095bef64 Chao Yu 2019-11-01 @2227 f2fs_compress_ctx_add_page(&cc, page);
4c8ff7095bef64 Chao Yu 2019-11-01 2228
4c8ff7095bef64 Chao Yu 2019-11-01 2229 goto next_page;
4c8ff7095bef64 Chao Yu 2019-11-01 2230 }
4c8ff7095bef64 Chao Yu 2019-11-01 2231 read_single_page:
4c8ff7095bef64 Chao Yu 2019-11-01 2232
4c8ff7095bef64 Chao Yu 2019-11-01 2233 ret = f2fs_read_single_page(inode, page, max_nr_pages, &map,
4c8ff7095bef64 Chao Yu 2019-11-01 2234 &bio, &last_block_in_bio, is_readahead);
2df0ab045784a1 Chao Yu 2019-03-25 2235 if (ret) {
4c8ff7095bef64 Chao Yu 2019-11-01 2236 set_error_page:
2df0ab045784a1 Chao Yu 2019-03-25 2237 SetPageError(page);
2df0ab045784a1 Chao Yu 2019-03-25 2238 zero_user_segment(page, 0, PAGE_SIZE);
2df0ab045784a1 Chao Yu 2019-03-25 2239 unlock_page(page);
2df0ab045784a1 Chao Yu 2019-03-25 2240 }
f1e8866016b53b Jaegeuk Kim 2015-04-09 2241 next_page:
f1e8866016b53b Jaegeuk Kim 2015-04-09 2242 if (pages)
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 2243 put_page(page);
4c8ff7095bef64 Chao Yu 2019-11-01 2244
4c8ff7095bef64 Chao Yu 2019-11-01 2245 if (f2fs_compressed_file(inode)) {
4c8ff7095bef64 Chao Yu 2019-11-01 2246 /* last page */
4c8ff7095bef64 Chao Yu 2019-11-01 2247 if (nr_pages == 1 && !f2fs_cluster_is_empty(&cc)) {
4c8ff7095bef64 Chao Yu 2019-11-01 2248 ret = f2fs_read_multi_pages(&cc, &bio,
4c8ff7095bef64 Chao Yu 2019-11-01 2249 max_nr_pages,
4c8ff7095bef64 Chao Yu 2019-11-01 2250 &last_block_in_bio,
4c8ff7095bef64 Chao Yu 2019-11-01 2251 is_readahead);
4c8ff7095bef64 Chao Yu 2019-11-01 2252 f2fs_destroy_compress_ctx(&cc);
4c8ff7095bef64 Chao Yu 2019-11-01 2253 }
4c8ff7095bef64 Chao Yu 2019-11-01 2254 }
f1e8866016b53b Jaegeuk Kim 2015-04-09 2255 }
f1e8866016b53b Jaegeuk Kim 2015-04-09 2256 BUG_ON(pages && !list_empty(pages));
f1e8866016b53b Jaegeuk Kim 2015-04-09 2257 if (bio)
4fc29c1aa37535 Linus Torvalds 2016-07-27 2258 __submit_bio(F2FS_I_SB(inode), bio, DATA);
2df0ab045784a1 Chao Yu 2019-03-25 2259 return pages ? 0 : ret;
f1e8866016b53b Jaegeuk Kim 2015-04-09 2260 }
f1e8866016b53b Jaegeuk Kim 2015-04-09 2261
:::::: The code@line 2213 was first introduced by commit
:::::: 4c8ff7095bef64fc47e996a938f7d57f9e077da3 f2fs: support data compression
:::::: TO: Chao Yu <yuchao0@huawei.com>
:::::: CC: Jaegeuk Kim <jaegeuk@kernel.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31363 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [f2fs-dev] [PATCH v2] f2fs: Make f2fs_readpages readable again
2020-02-03 3:39 ` Matthew Wilcox
@ 2020-02-05 1:58 ` Chao Yu
-1 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2020-02-05 1:58 UTC (permalink / raw)
To: Matthew Wilcox, Jaegeuk Kim, Chao Yu, linux-f2fs-devel,
linux-fsdevel
On 2020/2/3 11:39, Matthew Wilcox wrote:
>
> Remove the horrendous ifdeffery by slipping an IS_ENABLED into
> f2fs_compressed_file().
I'd like to suggest to use
if (IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) && f2fs_compressed_file(inode))
here to clean up f2fs_readpages' codes.
Otherwise, f2fs module w/o compression support will not recognize compressed
file in most other cases if we add IS_ENABLED() condition into
f2fs_compressed_file().
Thanks,
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> v2: Fix compilation by adding more dummy functions
>
> fs/f2fs/data.c | 6 ------
> fs/f2fs/f2fs.h | 10 +++++++++-
> 2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 8bd9afa81c54..41156a8f60a7 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -2203,7 +2203,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
> goto next_page;
> }
>
> -#ifdef CONFIG_F2FS_FS_COMPRESSION
> if (f2fs_compressed_file(inode)) {
> /* there are remained comressed pages, submit them */
> if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
> @@ -2230,14 +2229,11 @@ int f2fs_mpage_readpages(struct address_space *mapping,
> goto next_page;
> }
> read_single_page:
> -#endif
>
> ret = f2fs_read_single_page(inode, page, max_nr_pages, &map,
> &bio, &last_block_in_bio, is_readahead);
> if (ret) {
> -#ifdef CONFIG_F2FS_FS_COMPRESSION
> set_error_page:
> -#endif
> SetPageError(page);
> zero_user_segment(page, 0, PAGE_SIZE);
> unlock_page(page);
> @@ -2246,7 +2242,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
> if (pages)
> put_page(page);
>
> -#ifdef CONFIG_F2FS_FS_COMPRESSION
> if (f2fs_compressed_file(inode)) {
> /* last page */
> if (nr_pages == 1 && !f2fs_cluster_is_empty(&cc)) {
> @@ -2257,7 +2252,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
> f2fs_destroy_compress_ctx(&cc);
> }
> }
> -#endif
> }
> BUG_ON(pages && !list_empty(pages));
> if (bio)
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 5355be6b6755..e90d2b3f1d2d 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -2706,7 +2706,8 @@ static inline int f2fs_has_inline_xattr(struct inode *inode)
>
> static inline int f2fs_compressed_file(struct inode *inode)
> {
> - return S_ISREG(inode->i_mode) &&
> + return IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) &&
> + S_ISREG(inode->i_mode) &&
> is_inode_flag_set(inode, FI_COMPRESSED_FILE);
> }
>
> @@ -3797,6 +3798,13 @@ static inline struct page *f2fs_compress_control_page(struct page *page)
> WARN_ON_ONCE(1);
> return ERR_PTR(-EINVAL);
> }
> +#define f2fs_cluster_can_merge_page(cc, index) false
> +#define f2fs_read_multi_pages(cc, bio, nr_pages, last, is_ra) 0
> +#define f2fs_init_compress_ctx(cc) 0
> +#define f2fs_destroy_compress_ctx(cc) (void)0
> +#define f2fs_cluster_is_empty(cc) true
> +#define f2fs_compress_ctx_add_page(cc, page) (void)0
> +#define f2fs_is_compressed_cluster(cc, index) false
> #endif
>
> static inline void set_compress_context(struct inode *inode)
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] f2fs: Make f2fs_readpages readable again
@ 2020-02-05 1:58 ` Chao Yu
0 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2020-02-05 1:58 UTC (permalink / raw)
To: Matthew Wilcox, Jaegeuk Kim, Chao Yu, linux-f2fs-devel,
linux-fsdevel
On 2020/2/3 11:39, Matthew Wilcox wrote:
>
> Remove the horrendous ifdeffery by slipping an IS_ENABLED into
> f2fs_compressed_file().
I'd like to suggest to use
if (IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) && f2fs_compressed_file(inode))
here to clean up f2fs_readpages' codes.
Otherwise, f2fs module w/o compression support will not recognize compressed
file in most other cases if we add IS_ENABLED() condition into
f2fs_compressed_file().
Thanks,
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> v2: Fix compilation by adding more dummy functions
>
> fs/f2fs/data.c | 6 ------
> fs/f2fs/f2fs.h | 10 +++++++++-
> 2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 8bd9afa81c54..41156a8f60a7 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -2203,7 +2203,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
> goto next_page;
> }
>
> -#ifdef CONFIG_F2FS_FS_COMPRESSION
> if (f2fs_compressed_file(inode)) {
> /* there are remained comressed pages, submit them */
> if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
> @@ -2230,14 +2229,11 @@ int f2fs_mpage_readpages(struct address_space *mapping,
> goto next_page;
> }
> read_single_page:
> -#endif
>
> ret = f2fs_read_single_page(inode, page, max_nr_pages, &map,
> &bio, &last_block_in_bio, is_readahead);
> if (ret) {
> -#ifdef CONFIG_F2FS_FS_COMPRESSION
> set_error_page:
> -#endif
> SetPageError(page);
> zero_user_segment(page, 0, PAGE_SIZE);
> unlock_page(page);
> @@ -2246,7 +2242,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
> if (pages)
> put_page(page);
>
> -#ifdef CONFIG_F2FS_FS_COMPRESSION
> if (f2fs_compressed_file(inode)) {
> /* last page */
> if (nr_pages == 1 && !f2fs_cluster_is_empty(&cc)) {
> @@ -2257,7 +2252,6 @@ int f2fs_mpage_readpages(struct address_space *mapping,
> f2fs_destroy_compress_ctx(&cc);
> }
> }
> -#endif
> }
> BUG_ON(pages && !list_empty(pages));
> if (bio)
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 5355be6b6755..e90d2b3f1d2d 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -2706,7 +2706,8 @@ static inline int f2fs_has_inline_xattr(struct inode *inode)
>
> static inline int f2fs_compressed_file(struct inode *inode)
> {
> - return S_ISREG(inode->i_mode) &&
> + return IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) &&
> + S_ISREG(inode->i_mode) &&
> is_inode_flag_set(inode, FI_COMPRESSED_FILE);
> }
>
> @@ -3797,6 +3798,13 @@ static inline struct page *f2fs_compress_control_page(struct page *page)
> WARN_ON_ONCE(1);
> return ERR_PTR(-EINVAL);
> }
> +#define f2fs_cluster_can_merge_page(cc, index) false
> +#define f2fs_read_multi_pages(cc, bio, nr_pages, last, is_ra) 0
> +#define f2fs_init_compress_ctx(cc) 0
> +#define f2fs_destroy_compress_ctx(cc) (void)0
> +#define f2fs_cluster_is_empty(cc) true
> +#define f2fs_compress_ctx_add_page(cc, page) (void)0
> +#define f2fs_is_compressed_cluster(cc, index) false
> #endif
>
> static inline void set_compress_context(struct inode *inode)
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [f2fs-dev] [PATCH v2] f2fs: Make f2fs_readpages readable again
2020-02-05 1:58 ` Chao Yu
@ 2020-02-05 3:08 ` Matthew Wilcox
-1 siblings, 0 replies; 12+ messages in thread
From: Matthew Wilcox @ 2020-02-05 3:08 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-fsdevel, Jaegeuk Kim, linux-f2fs-devel
On Wed, Feb 05, 2020 at 09:58:29AM +0800, Chao Yu wrote:
> On 2020/2/3 11:39, Matthew Wilcox wrote:
> >
> > Remove the horrendous ifdeffery by slipping an IS_ENABLED into
> > f2fs_compressed_file().
>
> I'd like to suggest to use
>
> if (IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) && f2fs_compressed_file(inode))
>
> here to clean up f2fs_readpages' codes.
>
> Otherwise, f2fs module w/o compression support will not recognize compressed
> file in most other cases if we add IS_ENABLED() condition into
> f2fs_compressed_file().
If we need to recognise them in order to deny access to them, then I
suppose we need two predicates. Perhaps:
f2fs_unsupported_attributes(inode)
and
f2fs_compressed_file(inode)
where f2fs_unsupported_attributes can NACK any set flag (including those
which don't exist yet), eg encrypted. That seems like a larger change
than I should be making, since I'm not really familiar with f2fs code.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] f2fs: Make f2fs_readpages readable again
@ 2020-02-05 3:08 ` Matthew Wilcox
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Wilcox @ 2020-02-05 3:08 UTC (permalink / raw)
To: Chao Yu; +Cc: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, linux-fsdevel
On Wed, Feb 05, 2020 at 09:58:29AM +0800, Chao Yu wrote:
> On 2020/2/3 11:39, Matthew Wilcox wrote:
> >
> > Remove the horrendous ifdeffery by slipping an IS_ENABLED into
> > f2fs_compressed_file().
>
> I'd like to suggest to use
>
> if (IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) && f2fs_compressed_file(inode))
>
> here to clean up f2fs_readpages' codes.
>
> Otherwise, f2fs module w/o compression support will not recognize compressed
> file in most other cases if we add IS_ENABLED() condition into
> f2fs_compressed_file().
If we need to recognise them in order to deny access to them, then I
suppose we need two predicates. Perhaps:
f2fs_unsupported_attributes(inode)
and
f2fs_compressed_file(inode)
where f2fs_unsupported_attributes can NACK any set flag (including those
which don't exist yet), eg encrypted. That seems like a larger change
than I should be making, since I'm not really familiar with f2fs code.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [f2fs-dev] [PATCH v2] f2fs: Make f2fs_readpages readable again
2020-02-05 3:08 ` Matthew Wilcox
@ 2020-02-06 6:29 ` Chao Yu
-1 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2020-02-06 6:29 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: linux-fsdevel, Jaegeuk Kim, linux-f2fs-devel
On 2020/2/5 11:08, Matthew Wilcox wrote:
> On Wed, Feb 05, 2020 at 09:58:29AM +0800, Chao Yu wrote:
>> On 2020/2/3 11:39, Matthew Wilcox wrote:
>>>
>>> Remove the horrendous ifdeffery by slipping an IS_ENABLED into
>>> f2fs_compressed_file().
>>
>> I'd like to suggest to use
>>
>> if (IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) && f2fs_compressed_file(inode))
>>
>> here to clean up f2fs_readpages' codes.
>>
>> Otherwise, f2fs module w/o compression support will not recognize compressed
>> file in most other cases if we add IS_ENABLED() condition into
>> f2fs_compressed_file().
>
> If we need to recognise them in order to deny access to them, then I
> suppose we need two predicates. Perhaps:
Yup, for compression feature, now we use f2fs_is_compress_backend_ready() to
check whether current kernel can support to handle compressed file.
For the purpose of cleanup, I guess below change should be enough...
>> if (IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) && f2fs_compressed_file(inode))
Thanks,
>
> f2fs_unsupported_attributes(inode)
> and
> f2fs_compressed_file(inode)
>
> where f2fs_unsupported_attributes can NACK any set flag (including those
> which don't exist yet), eg encrypted. That seems like a larger change
> than I should be making, since I'm not really familiar with f2fs code.
> .
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] f2fs: Make f2fs_readpages readable again
@ 2020-02-06 6:29 ` Chao Yu
0 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2020-02-06 6:29 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, linux-fsdevel
On 2020/2/5 11:08, Matthew Wilcox wrote:
> On Wed, Feb 05, 2020 at 09:58:29AM +0800, Chao Yu wrote:
>> On 2020/2/3 11:39, Matthew Wilcox wrote:
>>>
>>> Remove the horrendous ifdeffery by slipping an IS_ENABLED into
>>> f2fs_compressed_file().
>>
>> I'd like to suggest to use
>>
>> if (IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) && f2fs_compressed_file(inode))
>>
>> here to clean up f2fs_readpages' codes.
>>
>> Otherwise, f2fs module w/o compression support will not recognize compressed
>> file in most other cases if we add IS_ENABLED() condition into
>> f2fs_compressed_file().
>
> If we need to recognise them in order to deny access to them, then I
> suppose we need two predicates. Perhaps:
Yup, for compression feature, now we use f2fs_is_compress_backend_ready() to
check whether current kernel can support to handle compressed file.
For the purpose of cleanup, I guess below change should be enough...
>> if (IS_ENABLED(CONFIG_F2FS_FS_COMPRESSION) && f2fs_compressed_file(inode))
Thanks,
>
> f2fs_unsupported_attributes(inode)
> and
> f2fs_compressed_file(inode)
>
> where f2fs_unsupported_attributes can NACK any set flag (including those
> which don't exist yet), eg encrypted. That seems like a larger change
> than I should be making, since I'm not really familiar with f2fs code.
> .
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] f2fs: Make f2fs_readpages readable again
2020-02-01 15:08 ` Matthew Wilcox
` (2 preceding siblings ...)
(?)
@ 2020-02-12 3:13 ` kbuild test robot
-1 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2020-02-12 3:13 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 12481 bytes --]
Hi Matthew,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on f2fs/dev-test]
[also build test ERROR on v5.6-rc1 next-20200211]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Matthew-Wilcox/f2fs-Make-f2fs_readpages-readable-again/20200203-113612
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: x86_64-rhel-7.6 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-4) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
fs/f2fs/data.c: In function 'f2fs_mpage_readpages':
>> fs/f2fs/data.c:2208:9: error: implicit declaration of function 'f2fs_cluster_can_merge_page'; did you mean 'f2fs_register_inmem_page'? [-Werror=implicit-function-declaration]
if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~
f2fs_register_inmem_page
>> fs/f2fs/data.c:2208:38: error: 'cc' undeclared (first use in this function)
if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
^~
fs/f2fs/data.c:2208:38: note: each undeclared identifier is reported only once for each function it appears in
>> fs/f2fs/data.c:2209:11: error: implicit declaration of function 'f2fs_read_multi_pages'; did you mean 'f2fs_ra_meta_pages'? [-Werror=implicit-function-declaration]
ret = f2fs_read_multi_pages(&cc, &bio,
^~~~~~~~~~~~~~~~~~~~~
f2fs_ra_meta_pages
>> fs/f2fs/data.c:2213:5: error: implicit declaration of function 'f2fs_destroy_compress_ctx'; did you mean 'f2fs_decompress_bio'? [-Werror=implicit-function-declaration]
f2fs_destroy_compress_ctx(&cc);
^~~~~~~~~~~~~~~~~~~~~~~~~
f2fs_decompress_bio
>> fs/f2fs/data.c:2217:10: error: implicit declaration of function 'f2fs_is_compressed_cluster'; did you mean 'f2fs_is_compressed_page'? [-Werror=implicit-function-declaration]
ret = f2fs_is_compressed_cluster(inode, page->index);
^~~~~~~~~~~~~~~~~~~~~~~~~~
f2fs_is_compressed_page
>> fs/f2fs/data.c:2223:10: error: implicit declaration of function 'f2fs_init_compress_ctx'; did you mean 'f2fs_decompress_bio'? [-Werror=implicit-function-declaration]
ret = f2fs_init_compress_ctx(&cc);
^~~~~~~~~~~~~~~~~~~~~~
f2fs_decompress_bio
>> fs/f2fs/data.c:2227:4: error: implicit declaration of function 'f2fs_compress_ctx_add_page'; did you mean 'f2fs_compress_control_page'? [-Werror=implicit-function-declaration]
f2fs_compress_ctx_add_page(&cc, page);
^~~~~~~~~~~~~~~~~~~~~~~~~~
f2fs_compress_control_page
>> fs/f2fs/data.c:2247:26: error: implicit declaration of function 'f2fs_cluster_is_empty'; did you mean 'f2fs_register_inmem_page'? [-Werror=implicit-function-declaration]
if (nr_pages == 1 && !f2fs_cluster_is_empty(&cc)) {
^~~~~~~~~~~~~~~~~~~~~
f2fs_register_inmem_page
cc1: some warnings being treated as errors
vim +2208 fs/f2fs/data.c
4c8ff7095bef64 Chao Yu 2019-11-01 2152
2df0ab045784a1 Chao Yu 2019-03-25 2153 /*
2df0ab045784a1 Chao Yu 2019-03-25 2154 * This function was originally taken from fs/mpage.c, and customized for f2fs.
2df0ab045784a1 Chao Yu 2019-03-25 2155 * Major change was from block_size == page_size in f2fs by default.
2df0ab045784a1 Chao Yu 2019-03-25 2156 *
2df0ab045784a1 Chao Yu 2019-03-25 2157 * Note that the aops->readpages() function is ONLY used for read-ahead. If
2df0ab045784a1 Chao Yu 2019-03-25 2158 * this function ever deviates from doing just read-ahead, it should either
2df0ab045784a1 Chao Yu 2019-03-25 2159 * use ->readpage() or do the necessary surgery to decouple ->readpages()
2df0ab045784a1 Chao Yu 2019-03-25 2160 * from read-ahead.
2df0ab045784a1 Chao Yu 2019-03-25 2161 */
4c8ff7095bef64 Chao Yu 2019-11-01 2162 int f2fs_mpage_readpages(struct address_space *mapping,
2df0ab045784a1 Chao Yu 2019-03-25 2163 struct list_head *pages, struct page *page,
2df0ab045784a1 Chao Yu 2019-03-25 2164 unsigned nr_pages, bool is_readahead)
2df0ab045784a1 Chao Yu 2019-03-25 2165 {
2df0ab045784a1 Chao Yu 2019-03-25 2166 struct bio *bio = NULL;
2df0ab045784a1 Chao Yu 2019-03-25 2167 sector_t last_block_in_bio = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2168 struct inode *inode = mapping->host;
2df0ab045784a1 Chao Yu 2019-03-25 2169 struct f2fs_map_blocks map;
4c8ff7095bef64 Chao Yu 2019-11-01 2170 #ifdef CONFIG_F2FS_FS_COMPRESSION
4c8ff7095bef64 Chao Yu 2019-11-01 2171 struct compress_ctx cc = {
4c8ff7095bef64 Chao Yu 2019-11-01 2172 .inode = inode,
4c8ff7095bef64 Chao Yu 2019-11-01 2173 .log_cluster_size = F2FS_I(inode)->i_log_cluster_size,
4c8ff7095bef64 Chao Yu 2019-11-01 2174 .cluster_size = F2FS_I(inode)->i_cluster_size,
4c8ff7095bef64 Chao Yu 2019-11-01 2175 .cluster_idx = NULL_CLUSTER,
4c8ff7095bef64 Chao Yu 2019-11-01 2176 .rpages = NULL,
4c8ff7095bef64 Chao Yu 2019-11-01 2177 .cpages = NULL,
4c8ff7095bef64 Chao Yu 2019-11-01 2178 .nr_rpages = 0,
4c8ff7095bef64 Chao Yu 2019-11-01 2179 .nr_cpages = 0,
4c8ff7095bef64 Chao Yu 2019-11-01 2180 };
4c8ff7095bef64 Chao Yu 2019-11-01 2181 #endif
4c8ff7095bef64 Chao Yu 2019-11-01 2182 unsigned max_nr_pages = nr_pages;
2df0ab045784a1 Chao Yu 2019-03-25 2183 int ret = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2184
2df0ab045784a1 Chao Yu 2019-03-25 2185 map.m_pblk = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2186 map.m_lblk = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2187 map.m_len = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2188 map.m_flags = 0;
2df0ab045784a1 Chao Yu 2019-03-25 2189 map.m_next_pgofs = NULL;
2df0ab045784a1 Chao Yu 2019-03-25 2190 map.m_next_extent = NULL;
2df0ab045784a1 Chao Yu 2019-03-25 2191 map.m_seg_type = NO_CHECK_TYPE;
2df0ab045784a1 Chao Yu 2019-03-25 2192 map.m_may_create = false;
2df0ab045784a1 Chao Yu 2019-03-25 2193
2df0ab045784a1 Chao Yu 2019-03-25 2194 for (; nr_pages; nr_pages--) {
2df0ab045784a1 Chao Yu 2019-03-25 2195 if (pages) {
2df0ab045784a1 Chao Yu 2019-03-25 2196 page = list_last_entry(pages, struct page, lru);
2df0ab045784a1 Chao Yu 2019-03-25 2197
2df0ab045784a1 Chao Yu 2019-03-25 2198 prefetchw(&page->flags);
2df0ab045784a1 Chao Yu 2019-03-25 2199 list_del(&page->lru);
2df0ab045784a1 Chao Yu 2019-03-25 2200 if (add_to_page_cache_lru(page, mapping,
4969c06a0d83c9 Jaegeuk Kim 2019-07-01 2201 page_index(page),
2df0ab045784a1 Chao Yu 2019-03-25 2202 readahead_gfp_mask(mapping)))
2df0ab045784a1 Chao Yu 2019-03-25 2203 goto next_page;
2df0ab045784a1 Chao Yu 2019-03-25 2204 }
2df0ab045784a1 Chao Yu 2019-03-25 2205
4c8ff7095bef64 Chao Yu 2019-11-01 2206 if (f2fs_compressed_file(inode)) {
4c8ff7095bef64 Chao Yu 2019-11-01 2207 /* there are remained comressed pages, submit them */
4c8ff7095bef64 Chao Yu 2019-11-01 @2208 if (!f2fs_cluster_can_merge_page(&cc, page->index)) {
4c8ff7095bef64 Chao Yu 2019-11-01 @2209 ret = f2fs_read_multi_pages(&cc, &bio,
4c8ff7095bef64 Chao Yu 2019-11-01 2210 max_nr_pages,
4c8ff7095bef64 Chao Yu 2019-11-01 2211 &last_block_in_bio,
4c8ff7095bef64 Chao Yu 2019-11-01 2212 is_readahead);
4c8ff7095bef64 Chao Yu 2019-11-01 @2213 f2fs_destroy_compress_ctx(&cc);
4c8ff7095bef64 Chao Yu 2019-11-01 2214 if (ret)
4c8ff7095bef64 Chao Yu 2019-11-01 2215 goto set_error_page;
4c8ff7095bef64 Chao Yu 2019-11-01 2216 }
4c8ff7095bef64 Chao Yu 2019-11-01 @2217 ret = f2fs_is_compressed_cluster(inode, page->index);
4c8ff7095bef64 Chao Yu 2019-11-01 2218 if (ret < 0)
4c8ff7095bef64 Chao Yu 2019-11-01 2219 goto set_error_page;
4c8ff7095bef64 Chao Yu 2019-11-01 2220 else if (!ret)
4c8ff7095bef64 Chao Yu 2019-11-01 2221 goto read_single_page;
4c8ff7095bef64 Chao Yu 2019-11-01 2222
4c8ff7095bef64 Chao Yu 2019-11-01 @2223 ret = f2fs_init_compress_ctx(&cc);
4c8ff7095bef64 Chao Yu 2019-11-01 2224 if (ret)
4c8ff7095bef64 Chao Yu 2019-11-01 2225 goto set_error_page;
4c8ff7095bef64 Chao Yu 2019-11-01 2226
4c8ff7095bef64 Chao Yu 2019-11-01 @2227 f2fs_compress_ctx_add_page(&cc, page);
4c8ff7095bef64 Chao Yu 2019-11-01 2228
4c8ff7095bef64 Chao Yu 2019-11-01 2229 goto next_page;
4c8ff7095bef64 Chao Yu 2019-11-01 2230 }
4c8ff7095bef64 Chao Yu 2019-11-01 2231 read_single_page:
4c8ff7095bef64 Chao Yu 2019-11-01 2232
4c8ff7095bef64 Chao Yu 2019-11-01 2233 ret = f2fs_read_single_page(inode, page, max_nr_pages, &map,
4c8ff7095bef64 Chao Yu 2019-11-01 2234 &bio, &last_block_in_bio, is_readahead);
2df0ab045784a1 Chao Yu 2019-03-25 2235 if (ret) {
4c8ff7095bef64 Chao Yu 2019-11-01 2236 set_error_page:
2df0ab045784a1 Chao Yu 2019-03-25 2237 SetPageError(page);
2df0ab045784a1 Chao Yu 2019-03-25 2238 zero_user_segment(page, 0, PAGE_SIZE);
2df0ab045784a1 Chao Yu 2019-03-25 2239 unlock_page(page);
2df0ab045784a1 Chao Yu 2019-03-25 2240 }
f1e8866016b53b Jaegeuk Kim 2015-04-09 2241 next_page:
f1e8866016b53b Jaegeuk Kim 2015-04-09 2242 if (pages)
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 2243 put_page(page);
4c8ff7095bef64 Chao Yu 2019-11-01 2244
4c8ff7095bef64 Chao Yu 2019-11-01 2245 if (f2fs_compressed_file(inode)) {
4c8ff7095bef64 Chao Yu 2019-11-01 2246 /* last page */
4c8ff7095bef64 Chao Yu 2019-11-01 @2247 if (nr_pages == 1 && !f2fs_cluster_is_empty(&cc)) {
4c8ff7095bef64 Chao Yu 2019-11-01 2248 ret = f2fs_read_multi_pages(&cc, &bio,
4c8ff7095bef64 Chao Yu 2019-11-01 2249 max_nr_pages,
4c8ff7095bef64 Chao Yu 2019-11-01 2250 &last_block_in_bio,
4c8ff7095bef64 Chao Yu 2019-11-01 2251 is_readahead);
4c8ff7095bef64 Chao Yu 2019-11-01 2252 f2fs_destroy_compress_ctx(&cc);
4c8ff7095bef64 Chao Yu 2019-11-01 2253 }
4c8ff7095bef64 Chao Yu 2019-11-01 2254 }
f1e8866016b53b Jaegeuk Kim 2015-04-09 2255 }
f1e8866016b53b Jaegeuk Kim 2015-04-09 2256 BUG_ON(pages && !list_empty(pages));
f1e8866016b53b Jaegeuk Kim 2015-04-09 2257 if (bio)
4fc29c1aa37535 Linus Torvalds 2016-07-27 2258 __submit_bio(F2FS_I_SB(inode), bio, DATA);
2df0ab045784a1 Chao Yu 2019-03-25 2259 return pages ? 0 : ret;
f1e8866016b53b Jaegeuk Kim 2015-04-09 2260 }
f1e8866016b53b Jaegeuk Kim 2015-04-09 2261
:::::: The code@line 2208 was first introduced by commit
:::::: 4c8ff7095bef64fc47e996a938f7d57f9e077da3 f2fs: support data compression
:::::: TO: Chao Yu <yuchao0@huawei.com>
:::::: CC: Jaegeuk Kim <jaegeuk@kernel.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 48724 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-02-12 3:13 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-01 15:08 [f2fs-dev] [PATCH] f2fs: Make f2fs_readpages readable again Matthew Wilcox
2020-02-01 15:08 ` Matthew Wilcox
2020-02-03 3:39 ` [f2fs-dev] [PATCH v2] " Matthew Wilcox
2020-02-03 3:39 ` Matthew Wilcox
2020-02-05 1:58 ` [f2fs-dev] " Chao Yu
2020-02-05 1:58 ` Chao Yu
2020-02-05 3:08 ` [f2fs-dev] " Matthew Wilcox
2020-02-05 3:08 ` Matthew Wilcox
2020-02-06 6:29 ` [f2fs-dev] " Chao Yu
2020-02-06 6:29 ` Chao Yu
2020-02-04 5:19 ` [PATCH] " kbuild test robot
2020-02-12 3:13 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.