linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Unify the return value of alloc/clone_extent_buffer()
@ 2019-02-22 10:16 Qu Wenruo
  2019-02-22 10:16 ` [PATCH 1/5] btrfs: extent_io: Add comment about the return value of alloc_extent_buffer() Qu Wenruo
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Qu Wenruo @ 2019-02-22 10:16 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dan.carpenter

This patchset can be fetched from github:
https://github.com/adam900710/linux/tree/cleanup_alloc_extent_buffer
Which is based on v5.0-rc7

There are 5 extent buffer alloc functions in btrfs:
__alloc_extent_buffer();
alloc_extent_buffer();
__alloc_dummy_extent_buffer();
alloc_dummy_extent_buffer();
alloc_test_extent_buffer();

However their return value is not unified for failure mode:
__alloc_extent_buffer()		Never fail
alloc_extent_buffer()		PTR_ERR()
__alloc_dummy_extent_buffer()	NULL
alloc_dummy_extent_buffer()	NULL
alloc_test_extent_buffer()	NULL

This causes some wrapper function to have 2 failure modes, like
btrfs_find_create_tree_block() can return NULL or PTR_ERR(-ENOMEM) for
its failure.

This inconsistent behavior is making static checker and reader crazy.

This patchset will unify the failure more of above 5 functions to
PTR_ERR().

Qu Wenruo (5):
  btrfs: extent_io: Add comment about the return value of
    alloc_extent_buffer()
  btrfs: extent_io: Unify the return value of __alloc_extent_buffer()
    with alloc_extent_buffer()
  btrfs: extent_io: Unify the return value of
    alloc_dummy_extent_buffer() with alloc_extent_buffer()
  btrfs: extent_io: Unify the return value of alloc_test_extent_buffer()
    with alloc_extent_buffer()
  btrfs: extent_io: Unify the return value of
    btrfs_clone_extent_buffer() with alloc_extent_buffer()

 fs/btrfs/backref.c                     |  8 ++--
 fs/btrfs/ctree.c                       | 16 ++++----
 fs/btrfs/extent_io.c                   | 56 +++++++++++++++++---------
 fs/btrfs/qgroup.c                      |  5 ++-
 fs/btrfs/tests/extent-buffer-tests.c   |  6 ++-
 fs/btrfs/tests/extent-io-tests.c       |  4 +-
 fs/btrfs/tests/free-space-tree-tests.c |  3 +-
 fs/btrfs/tests/inode-tests.c           |  6 ++-
 fs/btrfs/tests/qgroup-tests.c          |  3 +-
 9 files changed, 68 insertions(+), 39 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-02-27 14:10 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-22 10:16 [PATCH 0/5] Unify the return value of alloc/clone_extent_buffer() Qu Wenruo
2019-02-22 10:16 ` [PATCH 1/5] btrfs: extent_io: Add comment about the return value of alloc_extent_buffer() Qu Wenruo
2019-02-27 13:36   ` David Sterba
2019-02-27 13:41     ` Qu Wenruo
2019-02-27 13:44       ` David Sterba
2019-02-22 10:16 ` [PATCH 2/5] btrfs: extent_io: Unify the return value of __alloc_extent_buffer() with alloc_extent_buffer() Qu Wenruo
2019-02-22 10:16 ` [PATCH 3/5] btrfs: extent_io: Unify the return value of alloc_dummy_extent_buffer() " Qu Wenruo
2019-02-22 10:16 ` [PATCH 4/5] btrfs: extent_io: Unify the return value of alloc_test_extent_buffer() " Qu Wenruo
2019-02-22 10:16 ` [PATCH 5/5] btrfs: extent_io: Unify the return value of btrfs_clone_extent_buffer() " Qu Wenruo
2019-02-22 12:47   ` Nikolay Borisov
2019-02-22 12:53     ` Qu Wenruo
2019-02-22 13:02   ` [PATCH v1.1 " Qu Wenruo
2019-02-22 12:54 ` [PATCH 0/5] Unify the return value of alloc/clone_extent_buffer() Nikolay Borisov
2019-02-22 13:02   ` Qu Wenruo
2019-02-22 13:29     ` Nikolay Borisov
2019-02-22 13:31       ` Qu Wenruo
2019-02-27 14:11         ` David Sterba
2019-02-22 13:32       ` Qu Wenruo

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