Message ID | 20200422065009.69392-1-wqu@suse.com |
---|---|
Headers | show |
Series | fs: btrfs: Re-implement btrfs support using the more widely used extent buffer base code | expand |
On Wed, 22 Apr 2020 14:49:43 +0800 Qu Wenruo <wqu at suse.com> wrote: Hi Qu, > The current btrfs code in U-boot is using a creative way to read on-disk > data. > It's pretty simple, involving the least amount of code, but pretty > different from btrfs-progs nor kernel, making it pretty hard to sync > code between different projects. do you think maybe btrfs-progs / kernel would be interested if I tried to convert their code to this "simpler to use" implementation of conversion functions? > Thus only the following 5 patches need extra review attention: > - Patch 0017 > - Patch 0018 > - Patch 0022 > - Patch 0023 > - Patch 0024 Anyway, this patch series does not apply cleanly on u-boot/master. I tried with the first 3 patches and then gave up :( Sorry about this but I will review and test if you send a series that applies cleanly. Marek
I am testing compilation from the github repository. Another problem is that in the cleanup patch you have removed btrfs_list_subvols functoin, which is used by cmd/btrfs.c to list subvolumes. So Turris Mox and Turris Omnia with their default defconfig do not compile now. Marek
On 2020/4/22 ??3:46, Marek Behun wrote: > On Wed, 22 Apr 2020 14:49:43 +0800 > Qu Wenruo <wqu at suse.com> wrote: > > Hi Qu, > >> The current btrfs code in U-boot is using a creative way to read on-disk >> data. >> It's pretty simple, involving the least amount of code, but pretty >> different from btrfs-progs nor kernel, making it pretty hard to sync >> code between different projects. > > do you think maybe btrfs-progs / kernel would be interested if I > tried to convert their code to this "simpler to use" implementation of > conversion functions? I don't think so, the problem is kernel and btrfs-progs all need to modify extent buffer, which make the read time conversion become a burden in write path. > >> Thus only the following 5 patches need extra review attention: >> - Patch 0017 >> - Patch 0018 >> - Patch 0022 >> - Patch 0023 >> - Patch 0024 > > Anyway, this patch series does not apply cleanly on u-boot/master. I > tried with the first 3 patches and then gave up :( > Sorry about this but I will review and test if you send a series that > applies cleanly. That's strange, the branch is originally based on an older master, as you can find in the github. I guess there are some more btrfs related code change since then, I'll rebase them to latest master, and update the github repo then. Thanks, Qu > > Marek > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200422/64879fc6/attachment.sig>
On 2020/4/22 ??3:52, Qu Wenruo wrote: > > > On 2020/4/22 ??3:46, Marek Behun wrote: >> On Wed, 22 Apr 2020 14:49:43 +0800 >> Qu Wenruo <wqu at suse.com> wrote: >> >> Hi Qu, >> >>> The current btrfs code in U-boot is using a creative way to read on-disk >>> data. >>> It's pretty simple, involving the least amount of code, but pretty >>> different from btrfs-progs nor kernel, making it pretty hard to sync >>> code between different projects. >> >> do you think maybe btrfs-progs / kernel would be interested if I >> tried to convert their code to this "simpler to use" implementation of >> conversion functions? > > I don't think so, the problem is kernel and btrfs-progs all need to > modify extent buffer, which make the read time conversion become a > burden in write path. > >> >>> Thus only the following 5 patches need extra review attention: >>> - Patch 0017 >>> - Patch 0018 >>> - Patch 0022 >>> - Patch 0023 >>> - Patch 0024 >> >> Anyway, this patch series does not apply cleanly on u-boot/master. I >> tried with the first 3 patches and then gave up :( >> Sorry about this but I will review and test if you send a series that >> applies cleanly. > > That's strange, the branch is originally based on an older master, as > you can find in the github. > > I guess there are some more btrfs related code change since then, I'll > rebase them to latest master, and update the github repo then. Git repo updated. You can fetch that branch. Only two small conflicts during rebase, and since it compiles I haven't re-done the full test, but it looks pretty OK. Thanks, Qu > > Thanks, > Qu > >> >> Marek >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200422/382d0616/attachment.sig>
Also there are some warnings when compiling for Mox and Omnia: fs/btrfs/inode.c: In function ?btrfs_lookup_path?: fs/btrfs/inode.c:141:16: warning: ?parent_root? may be used uninitialized in this function [-Wmaybe-uninitialized] 141 | key.objectid = parent_root; | ~~~~~~~~~~~~~^~~~~~~~~~~~~ fs/btrfs/inode.c:127:7: note: ?parent_root? was declared here 127 | u64 parent_root; | ^~~~~~~~~~~ CC cmd/nvedit.o In file included from fs/btrfs/ctree.h:19, from fs/btrfs/disk-io.h:7, from fs/btrfs/disk-io.c:8: fs/btrfs/disk-io.c: In function ?btrfs_scan_fs_devices?: fs/btrfs/disk-io.c:881:9: warning: format ?%llu? expects argument of type ?long long unsigned int?, but argument 3 has type ?lbaint_t? {aka ?long unsigned int?} [-Wformat=] 881 | error("superblock end %u is larger than device size %llu", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 882 | BTRFS_SUPER_INFO_SIZE + BTRFS_SUPER_INFO_OFFSET, 883 | part->size << desc->log2blksz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | lbaint_t {aka long unsigned int} fs/btrfs/compat.h:13:29: note: in definition of macro ?error? 13 | #define error(...) { printf(__VA_ARGS__); printf("\n"); } | ^~~~~~~~~~~ fs/btrfs/disk-io.c:881:58: note: format string is defined here 881 | error("superblock end %u is larger than device size %llu", | ~~~^ | | | long long unsigned int | %lu In file included from fs/btrfs/ctree.h:19, from fs/btrfs/volumes.c:5: fs/btrfs/volumes.c: In function ?btrfs_check_chunk_valid?: fs/btrfs/volumes.c:404:9: warning: format ?%lu? expects argument of type ?long unsigned int?, but argument 4 has type ?u32? {aka ?unsigned int?} [-Wformat=] 404 | error("invalid chunk item size, have %u expect [%zu, %lu)", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/btrfs/compat.h:13:29: note: in definition of macro ?error? 13 | #define error(...) { printf(__VA_ARGS__); printf("\n"); } | ^~~~~~~~~~~ fs/btrfs/volumes.c:404:58: note: format string is defined here 404 | error("invalid chunk item size, have %u expect [%zu, %lu)", | ~~^ | | | long unsigned int | %u
On 2020/4/22 ??3:59, Marek Behun wrote: > Also there are some warnings when compiling for Mox and Omnia: > > > > > fs/btrfs/inode.c: In function ?btrfs_lookup_path?: > fs/btrfs/inode.c:141:16: warning: ?parent_root? may be used uninitialized in this function [-Wmaybe-uninitialized] > 141 | key.objectid = parent_root; > | ~~~~~~~~~~~~~^~~~~~~~~~~~~ > fs/btrfs/inode.c:127:7: note: ?parent_root? was declared here > 127 | u64 parent_root; > | ^~~~~~~~~~~ > CC cmd/nvedit.o > In file included from fs/btrfs/ctree.h:19, > from fs/btrfs/disk-io.h:7, > from fs/btrfs/disk-io.c:8: > fs/btrfs/disk-io.c: In function ?btrfs_scan_fs_devices?: > fs/btrfs/disk-io.c:881:9: warning: format ?%llu? expects argument of type ?long long unsigned int?, but argument 3 has type ?lbaint_t? {aka ?long unsigned int?} [-Wformat=] > 881 | error("superblock end %u is larger than device size %llu", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 882 | BTRFS_SUPER_INFO_SIZE + BTRFS_SUPER_INFO_OFFSET, > 883 | part->size << desc->log2blksz); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > | | > | lbaint_t {aka long unsigned int} > fs/btrfs/compat.h:13:29: note: in definition of macro ?error? > 13 | #define error(...) { printf(__VA_ARGS__); printf("\n"); } > | ^~~~~~~~~~~ > fs/btrfs/disk-io.c:881:58: note: format string is defined here > 881 | error("superblock end %u is larger than device size %llu", > | ~~~^ > | | > | long long unsigned int > | %lu > > > > > > > In file included from fs/btrfs/ctree.h:19, > from fs/btrfs/volumes.c:5: > fs/btrfs/volumes.c: In function ?btrfs_check_chunk_valid?: > fs/btrfs/volumes.c:404:9: warning: format ?%lu? expects argument of type ?long unsigned int?, but argument 4 has type ?u32? {aka ?unsigned int?} [-Wformat=] > 404 | error("invalid chunk item size, have %u expect [%zu, %lu)", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > fs/btrfs/compat.h:13:29: note: in definition of macro ?error? > 13 | #define error(...) { printf(__VA_ARGS__); printf("\n"); } > | ^~~~~~~~~~~ > fs/btrfs/volumes.c:404:58: note: format string is defined here > 404 | error("invalid chunk item size, have %u expect [%zu, %lu)", > | ~~^ > | | > | long unsigned int > | %u > I also hit those with GCC 9.2, but in GCC 9.3 they just disappear, so I'm not sure whether they are bugs from GCC or something else... Thanks, Qu -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200422/5cce0114/attachment.sig>
Just for informational purposes for others: I tested compiling with and without this patches to see how much it increases binary size. Omnia (armv7a) Mox (aarch64) with old btrfs 52900 (51.7 KB) 55456 (54.2 KB) with new btrfs 76176 (74.4 KB) 75480 (73.7 KB) diff 23276 (22.7 KB) 20024 (19.5 KB) increase driver 44% 36% increase u-boot 3.46% 2.81% (I don't actually care much, this is not too much, this is something that can maybe be reduced by using some optimizations which u-boot does not support yet and also there should be enough storage for u-boot on Mox and Omnia. But maybe someone else will care enough.)
On Wed, 22 Apr 2020 15:52:25 +0800 Qu Wenruo <quwenruo.btrfs at gmx.com> wrote: > > do you think maybe btrfs-progs / kernel would be interested if I > > tried to convert their code to this "simpler to use" implementation of > > conversion functions? > > I don't think so, the problem is kernel and btrfs-progs all need to > modify extent buffer, which make the read time conversion become a > burden in write path. :(