* [PATCH v2] f2fs: introduce f2fs_bmap_compress()
@ 2020-03-28 8:39 ` Chao Yu
0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2020-03-28 8:39 UTC (permalink / raw)
To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu
to support bmap() on compressed inode: if queried block locates in
non-compressed cluster, return its physical block address.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
v2:
- give blkaddr on non-compressed cluster suggested by Jaegeuk.
fs/f2fs/data.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 24643680489b..89b73ee74120 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3585,6 +3585,37 @@ static int f2fs_set_data_page_dirty(struct page *page)
return 0;
}
+
+static sector_t f2fs_bmap_compress(struct inode *inode, sector_t block)
+{
+#ifdef CONFIG_F2FS_FS_COMPRESSION
+ struct dnode_of_data dn;
+ sector_t start_idx, blknr = 0;
+ int ret;
+
+ start_idx = rounddown(block, F2FS_I(inode)->i_cluster_size);
+
+ set_new_dnode(&dn, inode, NULL, NULL, 0);
+ ret = f2fs_get_dnode_of_data(&dn, start_idx, LOOKUP_NODE);
+ if (ret)
+ return 0;
+
+ if (dn.data_blkaddr != COMPRESS_ADDR) {
+ dn.ofs_in_node += block - start_idx;
+ blknr = f2fs_data_blkaddr(&dn);
+ if (!__is_valid_data_blkaddr(blknr))
+ blknr = 0;
+ }
+
+ f2fs_put_dnode(&dn);
+
+ return blknr;
+#else
+ return -EOPNOTSUPP;
+#endif
+}
+
+
static sector_t f2fs_bmap(struct address_space *mapping, sector_t block)
{
struct inode *inode = mapping->host;
@@ -3596,6 +3627,9 @@ static sector_t f2fs_bmap(struct address_space *mapping, sector_t block)
if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
filemap_write_and_wait(mapping);
+ if (f2fs_compressed_file(inode))
+ return f2fs_bmap_compress(inode, block);
+
return generic_block_bmap(mapping, block, get_data_block_bmap);
}
--
2.18.0.rc1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [f2fs-dev] [PATCH v2] f2fs: introduce f2fs_bmap_compress()
@ 2020-03-28 8:39 ` Chao Yu
0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2020-03-28 8:39 UTC (permalink / raw)
To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel
to support bmap() on compressed inode: if queried block locates in
non-compressed cluster, return its physical block address.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
v2:
- give blkaddr on non-compressed cluster suggested by Jaegeuk.
fs/f2fs/data.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 24643680489b..89b73ee74120 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3585,6 +3585,37 @@ static int f2fs_set_data_page_dirty(struct page *page)
return 0;
}
+
+static sector_t f2fs_bmap_compress(struct inode *inode, sector_t block)
+{
+#ifdef CONFIG_F2FS_FS_COMPRESSION
+ struct dnode_of_data dn;
+ sector_t start_idx, blknr = 0;
+ int ret;
+
+ start_idx = rounddown(block, F2FS_I(inode)->i_cluster_size);
+
+ set_new_dnode(&dn, inode, NULL, NULL, 0);
+ ret = f2fs_get_dnode_of_data(&dn, start_idx, LOOKUP_NODE);
+ if (ret)
+ return 0;
+
+ if (dn.data_blkaddr != COMPRESS_ADDR) {
+ dn.ofs_in_node += block - start_idx;
+ blknr = f2fs_data_blkaddr(&dn);
+ if (!__is_valid_data_blkaddr(blknr))
+ blknr = 0;
+ }
+
+ f2fs_put_dnode(&dn);
+
+ return blknr;
+#else
+ return -EOPNOTSUPP;
+#endif
+}
+
+
static sector_t f2fs_bmap(struct address_space *mapping, sector_t block)
{
struct inode *inode = mapping->host;
@@ -3596,6 +3627,9 @@ static sector_t f2fs_bmap(struct address_space *mapping, sector_t block)
if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
filemap_write_and_wait(mapping);
+ if (f2fs_compressed_file(inode))
+ return f2fs_bmap_compress(inode, block);
+
return generic_block_bmap(mapping, block, get_data_block_bmap);
}
--
2.18.0.rc1
_______________________________________________
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] 4+ messages in thread
* Re: [PATCH v2] f2fs: introduce f2fs_bmap_compress()
2020-03-28 8:39 ` [f2fs-dev] " Chao Yu
(?)
@ 2020-03-28 16:16 ` kbuild test robot
-1 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2020-03-28 16:16 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2044 bytes --]
Hi Chao,
I love your patch! Yet something to improve:
[auto build test ERROR on f2fs/dev-test]
[also build test ERROR on next-20200327]
[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/Chao-Yu/f2fs-introduce-f2fs_bmap_compress/20200328-165713
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: i386-randconfig-b001-20200327 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
ld: fs/f2fs/data.o: in function `f2fs_bmap_compress':
>> fs/f2fs/data.c:3596: undefined reference to `__umoddi3'
vim +3596 fs/f2fs/data.c
3587
3588
3589 static sector_t f2fs_bmap_compress(struct inode *inode, sector_t block)
3590 {
3591 #ifdef CONFIG_F2FS_FS_COMPRESSION
3592 struct dnode_of_data dn;
3593 sector_t start_idx, blknr = 0;
3594 int ret;
3595
> 3596 start_idx = rounddown(block, F2FS_I(inode)->i_cluster_size);
3597
3598 set_new_dnode(&dn, inode, NULL, NULL, 0);
3599 ret = f2fs_get_dnode_of_data(&dn, start_idx, LOOKUP_NODE);
3600 if (ret)
3601 return 0;
3602
3603 if (dn.data_blkaddr != COMPRESS_ADDR) {
3604 dn.ofs_in_node += block - start_idx;
3605 blknr = f2fs_data_blkaddr(&dn);
3606 if (!__is_valid_data_blkaddr(blknr))
3607 blknr = 0;
3608 }
3609
3610 f2fs_put_dnode(&dn);
3611
3612 return blknr;
3613 #else
3614 return -EOPNOTSUPP;
3615 #endif
3616 }
3617
---
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: 33281 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] f2fs: introduce f2fs_bmap_compress()
2020-03-28 8:39 ` [f2fs-dev] " Chao Yu
(?)
(?)
@ 2020-03-28 17:41 ` kbuild test robot
-1 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2020-03-28 17:41 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1317 bytes --]
Hi Chao,
I love your patch! Yet something to improve:
[auto build test ERROR on f2fs/dev-test]
[also build test ERROR on next-20200327]
[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/Chao-Yu/f2fs-introduce-f2fs_bmap_compress/20200328-165713
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.2.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=9.2.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 >>):
mips-linux-ld: fs/f2fs/data.o: in function `f2fs_bmap':
>> data.c:(.text.f2fs_bmap+0x130): undefined reference to `__umoddi3'
---
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: 64256 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-28 17:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-28 8:39 [PATCH v2] f2fs: introduce f2fs_bmap_compress() Chao Yu
2020-03-28 8:39 ` [f2fs-dev] " Chao Yu
2020-03-28 16:16 ` kbuild test robot
2020-03-28 17:41 ` 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.