linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>,
	Goldwyn Rodrigues <rgoldwyn@suse.de>,
	linux-btrfs@vger.kernel.org, Jeff Mahoney <jeffm@suse.com>,
	David Sterba <dsterba@suse.com>
Subject: Re: [RFC] Converging userspace and kernel code
Date: Mon, 9 Jan 2017 09:31:39 -0600	[thread overview]
Message-ID: <4d1d233a-1002-169e-ec9b-14df3b1af86c@redhat.com> (raw)
In-Reply-To: <65341974-d15f-408c-abad-98c2a5bb8743@cn.fujitsu.com>

On 1/8/17 8:11 PM, Qu Wenruo wrote:
> 
> 
> At 01/08/2017 09:16 PM, Goldwyn Rodrigues wrote:
>>
>> 1. Motivation
>> While fixing user space tools for btrfs-progs, I found a couple of bugs
>> which are already solved in kernel space but were not ported to user
>> space. User space is a little ignored when it comes to fixing bugs in
>> the core functionality. XFS developers have already performed this and
>> the userspace and kernel code walks in lockstep for libxfs.
> 
> Personally speaking, I'm not a fan of re-using kernel code in btrfs-progs.

But it already does re-use kernel code, it's just that the re-use is
extremely stale, with unfixed bugs in both directions as a result
(at least last time I looked.)

> In fact, in btrfs-progs, we don't need a lot of kernel facilities,
> like page/VFS/lock(btrfs-progs works in single thread under most
> case).
> 
> And that should make btrfs-progs easier to maintain.

But as Goldwyn already pointed out, many bugs have gone un-fixed
in userspace, in code which was forked long ago from kernelspace.

For things like locking it's trivial to define that away.

xfsprogs does i.e. -

/* miscellaneous kernel routines not in user space */
#define down_read(a)            ((void) 0)
#define up_read(a)              ((void) 0)
#define spin_lock_init(a)       ((void) 0)
#define spin_lock(a)            ((void) 0)
#define spin_unlock(a)          ((void) 0)
#define likely(x)               (x)
#define unlikely(x)             (x)
#define rcu_read_lock()         ((void) 0)
#define rcu_read_unlock()       ((void) 0)
#define WARN_ON_ONCE(expr)      ((void) 0)


> Furthermore, there are cases while kernel is doing things wrong while
> btrfs-progs does it right.

All the more reason to sync it up, fixes should always be in both
places, right?

I had looked at this a few years ago, and started trying to sync things
up, but got daunted and busy and never completed anything.  :(  I sent
a few fixups back in April 2013 to get things /slightly/ closer.

The libxfs sync in xfs has borne fruit; I'm of the opinion that similar
work would help btrfs too, though it can be a long road.

(e2fsprogs has gone the other way, and has a completely separate
re-implementation in userspace; it works, I guess, but I have to say
that I really like the code commonality in xfs.)

Thanks,
-Eric


  parent reply	other threads:[~2017-01-09 15:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-08 13:16 [RFC] Converging userspace and kernel code Goldwyn Rodrigues
2017-01-09  2:11 ` Qu Wenruo
2017-01-09  9:31   ` Christoph Hellwig
2017-01-09 12:06   ` Goldwyn Rodrigues
2017-01-10  0:35     ` Qu Wenruo
2017-01-10  0:56       ` Omar Sandoval
2017-01-09 15:31   ` Eric Sandeen [this message]
2017-01-09 21:34     ` Omar Sandoval
2017-01-09 21:38       ` Jeff Mahoney
2017-01-10  1:46         ` Darrick J. Wong
2017-01-10  2:24           ` Qu Wenruo
2017-01-10  3:28 ` Anand Jain
2017-01-10 12:14   ` Goldwyn Rodrigues
2017-01-10 15:20     ` Anand Jain
2017-01-10 16:04       ` Goldwyn Rodrigues
2017-01-11  2:23         ` Anand Jain
2017-01-11  2:32           ` Qu Wenruo
2017-01-11  2:55           ` Goldwyn Rodrigues
2017-01-11 10:58             ` Anand Jain

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=4d1d233a-1002-169e-ec9b-14df3b1af86c@redhat.com \
    --to=sandeen@redhat.com \
    --cc=dsterba@suse.com \
    --cc=jeffm@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo@cn.fujitsu.com \
    --cc=rgoldwyn@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).