linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: linux-xfs@vger.kernel.org
Subject: [PATCHSET 00/10] xfs: constify btree operations
Date: Thu, 12 Aug 2021 16:31:23 -0700	[thread overview]
Message-ID: <162881108307.1695493.3416792932772498160.stgit@magnolia> (raw)

Hi all,

After finishing the bug fixes in the previous series, the thought
occurred to me that I really ought to check the main index query
functions around XFS and make sure that they weren't changing their
arguments either.  Since btrees are one of the major data structure
types in XFS, I decided to concentrate there.

Starting with the query_range and query_all functions, I started
constifying the btree record and key parameters to make sure that the
query functions don't modify the search parameters and that the callback
functions don't modify the record pointer that is passed from the range
query function.  That spiralled from there into a full blown audit of
all the btree predicates and extraction functions; many of them could be
constified too.

AFAICT there's almost no change in the generated code, which is what
you'd expect since there was only one query range caller in the entire
codebase that actually messed with caller memory.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=constify-btree-5.15
---
 fs/xfs/libxfs/xfs_alloc.c          |    6 +-
 fs/xfs/libxfs/xfs_alloc.h          |   10 ++--
 fs/xfs/libxfs/xfs_alloc_btree.c    |   94 ++++++++++++++++++------------------
 fs/xfs/libxfs/xfs_bmap_btree.c     |   48 +++++++++---------
 fs/xfs/libxfs/xfs_bmap_btree.h     |    7 ++-
 fs/xfs/libxfs/xfs_btree.c          |   84 ++++++++++++++++----------------
 fs/xfs/libxfs/xfs_btree.h          |   56 +++++++++++----------
 fs/xfs/libxfs/xfs_btree_staging.c  |   14 +++--
 fs/xfs/libxfs/xfs_ialloc.c         |    4 +-
 fs/xfs/libxfs/xfs_ialloc.h         |    3 +
 fs/xfs/libxfs/xfs_ialloc_btree.c   |   70 +++++++++++++--------------
 fs/xfs/libxfs/xfs_refcount.c       |    4 +-
 fs/xfs/libxfs/xfs_refcount.h       |    2 -
 fs/xfs/libxfs/xfs_refcount_btree.c |   48 +++++++++---------
 fs/xfs/libxfs/xfs_rmap.c           |   28 +++++------
 fs/xfs/libxfs/xfs_rmap.h           |   11 ++--
 fs/xfs/libxfs/xfs_rmap_btree.c     |   64 ++++++++++++-------------
 fs/xfs/scrub/agheader.c            |    2 -
 fs/xfs/scrub/agheader_repair.c     |    4 +-
 fs/xfs/scrub/alloc.c               |    2 -
 fs/xfs/scrub/bmap.c                |   29 ++++++-----
 fs/xfs/scrub/btree.h               |    4 +-
 fs/xfs/scrub/common.c              |    2 -
 fs/xfs/scrub/ialloc.c              |    2 -
 fs/xfs/scrub/refcount.c            |    4 +-
 fs/xfs/scrub/repair.c              |    2 -
 fs/xfs/scrub/rmap.c                |    2 -
 fs/xfs/scrub/rtbitmap.c            |    2 -
 fs/xfs/xfs_fsmap.c                 |   14 +++--
 fs/xfs/xfs_rtalloc.h               |    6 +-
 fs/xfs/xfs_trace.h                 |    4 +-
 31 files changed, 321 insertions(+), 311 deletions(-)


             reply	other threads:[~2021-08-12 23:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 23:31 Darrick J. Wong [this message]
2021-08-12 23:31 ` [PATCH 01/10] xfs: make the key parameters to all btree key comparison functions const Darrick J. Wong
2021-08-15  8:58   ` Christoph Hellwig
2021-08-12 23:31 ` [PATCH 02/10] xfs: make the key parameters to all btree query range " Darrick J. Wong
2021-08-15  9:00   ` Christoph Hellwig
2021-08-12 23:31 ` [PATCH 03/10] xfs: make the record pointer passed to query_range " Darrick J. Wong
2021-08-15  9:06   ` Christoph Hellwig
2021-08-12 23:31 ` [PATCH 04/10] xfs: mark the record passed into btree init_key functions as const Darrick J. Wong
2021-08-15  9:10   ` Christoph Hellwig
2021-08-12 23:31 ` [PATCH 05/10] xfs: make the keys and records passed to btree inorder functions const Darrick J. Wong
2021-08-15  9:13   ` Christoph Hellwig
2021-08-12 23:31 ` [PATCH 06/10] xfs: mark the record passed into xchk_btree functions as const Darrick J. Wong
2021-08-15  9:17   ` Christoph Hellwig
2021-08-12 23:32 ` [PATCH 07/10] xfs: make the pointer passed to btree set_root functions const Darrick J. Wong
2021-08-15  9:19   ` Christoph Hellwig
2021-08-12 23:32 ` [PATCH 08/10] xfs: make the start pointer passed to btree alloc_block " Darrick J. Wong
2021-08-15 15:30   ` Christoph Hellwig
2021-08-12 23:32 ` [PATCH 09/10] xfs: make the start pointer passed to btree update_lastrec " Darrick J. Wong
2021-08-15 15:31   ` Christoph Hellwig
2021-08-12 23:32 ` [PATCH 10/10] xfs: constify btree function parameters that are not modified Darrick J. Wong
2021-08-15 15:33   ` Christoph Hellwig

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=162881108307.1695493.3416792932772498160.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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).