From: Qu Wenruo Date: Thu, 9 Apr 2020 14:53:47 +0800 Subject: Btrfs and endian convert In-Reply-To: <4fb08694-185b-a708-7f6b-b77f95f665ee@gmx.com> References: <4fb08694-185b-a708-7f6b-b77f95f665ee@gmx.com> Message-ID: <8b50295b-eaa7-98c9-33c2-128a0fe9819d@gmx.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2020/4/9 ??2:27, Qu Wenruo wrote: > Hi Marek, > > I respect your independent implementation of btrfs inside U-boot, but it > looks like the code is too creative, other than follow the regular btrfs > code. > > One of the biggest problem is, there is no convert of on-disk endian and > in-memory endian. > > The most obvious proof is the lack of btrfs_disk_key, on-disk > btrfs_disk_key is returned and used against native endian btrfs_key. > > Is U-boot only supposed to be run on little endian system? My bad, you do the convert the convert at different timing. For header and item/node ptr, it's converted as tree block read time, while for other structures, you do the convert when reading them. This is pretty different from what we do in kernel/progs. > > And, would you mind me to do the full cross port of btrfs-progs code to > U-boot? > I found a lot of practice pretty far away from the common code base of > btrfs-progs and kernel, like using on-disk key pointer a lot (which > should be avoid due to endian convert). > > Mind me to re-build the btrfs implementation from scratch? While this still stands, as latest btrfs_tree.h would include both btrfs_key and btrfs_disk_key, if we really want to sync the header, we still need to go the regular BTRFS_SETGET_* macros way. Thanks, Qu > > 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: