All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Behun <marek.behun@nic.cz>
To: u-boot@lists.denx.de
Subject: Btrfs and endian convert
Date: Thu, 9 Apr 2020 15:24:43 +0200	[thread overview]
Message-ID: <20200409152443.57f2bc2c@nic.cz> (raw)
In-Reply-To: <8b50295b-eaa7-98c9-33c2-128a0fe9819d@gmx.com>

On Thu, 9 Apr 2020 14:53:47 +0800
Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:

> 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?  
> 

It supports big endian as well.

> My bad, you do the convert the convert at different timing.

I never tested it on big endian, but conv-funcs.h should do it...

> 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.

Yes, unfortunately.

> > 
> > 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.

If you think it will grow more fruit in the long way, go for it. What
is your main objective here? To support more features, like filesystem
on multiple devices, write support? Or just to be able to sync code so
that bugs are caught early?

Marek

  reply	other threads:[~2020-04-09 13:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09  6:27 Btrfs and endian convert Qu Wenruo
2020-04-09  6:53 ` Qu Wenruo
2020-04-09 13:24   ` Marek Behun [this message]
2020-04-09 13:31     ` Qu Wenruo
2020-04-09 13:58       ` Marek Behun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200409152443.57f2bc2c@nic.cz \
    --to=marek.behun@nic.cz \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.