linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Allison Collins <allison.henderson@oracle.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v6 16/16] xfs: Add delay ready attr set routines
Date: Wed, 5 Feb 2020 16:07:37 -0700	[thread overview]
Message-ID: <738cb956-f44b-12cd-6f57-feca617d5c6a@oracle.com> (raw)
In-Reply-To: <23b9c16b-dcf7-de47-bfae-5e03adb81703@oracle.com>



On 1/22/20 3:30 AM, Allison Collins wrote:
> 
> 
> On 1/21/20 5:12 PM, Darrick J. Wong wrote:
>> On Sat, Jan 18, 2020 at 03:50:35PM -0700, Allison Collins wrote:

<snip>

>>> diff --git a/fs/xfs/libxfs/xfs_attr_remote.h 
>>> b/fs/xfs/libxfs/xfs_attr_remote.h
>>> index 7ab3770..ab03519 100644
>>> --- a/fs/xfs/libxfs/xfs_attr_remote.h
>>> +++ b/fs/xfs/libxfs/xfs_attr_remote.h
>>> @@ -13,4 +13,8 @@ int xfs_attr_rmtval_set(struct xfs_da_args *args);
>>>   int xfs_attr_rmtval_remove(struct xfs_da_args *args);
>>>   int xfs_attr_rmtval_invalidate(struct xfs_da_args *args);
>>>   int xfs_attr_rmtval_unmap(struct xfs_da_args *args);
>>> +int xfs_attr_rmt_find_hole(struct xfs_da_args *args);
>>> +int xfs_attr_rmtval_set_value(struct xfs_da_args *args);
>>> +int xfs_attr_rmtval_set_blk(struct xfs_da_args *args);
>>> +int xfs_attr_rmtval_set_init(struct xfs_da_args *args);
>>>   #endif /* __XFS_ATTR_REMOTE_H__ */
>>> diff --git a/fs/xfs/libxfs/xfs_da_btree.h b/fs/xfs/libxfs/xfs_da_btree.h
>>> index 7fc87da..9943062 100644
>>> --- a/fs/xfs/libxfs/xfs_da_btree.h
>>> +++ b/fs/xfs/libxfs/xfs_da_btree.h
>>> @@ -55,6 +55,14 @@ enum xfs_dacmp {
>>>   enum xfs_delattr_state {
>>>       XFS_DAS_RM_SHRINK    = 1, /* We are shrinking the tree */
>>>       XFS_DAS_RM_NODE_BLKS    = 2, /* We are removing node blocks */
>>> +    XFS_DAS_SF_TO_LEAF    = 3, /* Converted short form to leaf */
>>> +    XFS_DAS_FOUND_LBLK    = 4, /* We found leaf blk for attr */
>>> +    XFS_DAS_LEAF_TO_NODE    = 5, /* Converted leaf to node */
>>> +    XFS_DAS_FOUND_NBLK    = 6, /* We found node blk for attr */
>>> +    XFS_DAS_ALLOC_LEAF    = 7, /* We are allocating leaf blocks */
>>> +    XFS_DAS_FLIP_LFLAG    = 8, /* Flipped leaf INCOMPLETE attr flag */
>>> +    XFS_DAS_ALLOC_NODE    = 9, /* We are allocating node blocks */
>>> +    XFS_DAS_FLIP_NFLAG    = 10,/* Flipped node INCOMPLETE attr flag */
>>
>> We've definitely reached the point where a state diagram would be
>> helpful.  Can you go from any of the RM_ states to the ones that you've
>> just added?
> No.  And if they did, they would have to show up in the calling 
> functions state switches.  Because the calling function has to manage 
> jumping straight back to the subroutine when ever the state belongs to 
> the subroutine.  Kind of like how you see XFS_DAS_ALLOC_LEAF and 
> XFS_DAS_FLIP_LFLAG in the state switch for xfs_attr_set_iter, even 
> though those states only apply to xfs_attr_leaf_addname.
> 
>>
>> The new state machine code in last two patches would be a lot easier to
>> review if I could look down from above instead of up from the XFS_DAS
>> values and goto labels.  I /think/ it looks sane, but I'm only 20%
>> confident of that statement.
>>
> Sure, I'll see if I can put together a diagram to help folks out a bit.
> 
> Thanks for the reviews!
> Allison
> 
>> --D
>>

Ok, so I've put together some quick high level diagrams, and I wanted to 
run it by you to see what you thought.

These diagrams illustrate the state machine logic as it appears in the 
current set. The XFS_DAS_* states indicate places where the function 
would return -EAGAIN, and then immediately resume from after being 
recalled by the calling function.  States marked as a "subroutine state" 
indicate that they belong to a subroutine, and so the calling function 
needs to pass them back to that subroutine to allow it to finish where 
it left off.  But they otherwise do not have a role in the calling 
function other than just passing through.

Hope this helps!  Let me know if you have any questions or if there's 
anything that would help make things more clear.  Thanks!

Allison

/*
  * State machine diagram for attr remove operations
  *
  * xfs_attr_remove_iter()
  *         XFS_DAS_RM_SHRINK     ─┐
  *         (subroutine state)     │
  *                                │
  *         XFS_DAS_RMTVAL_REMOVE ─┤
  *         (subroutine state)     │
  *                                └─>xfs_attr_node_removename()
  *                                                 │
  *                                                 v
  *                                         need to remove
  *                                   ┌─n──  rmt blocks?
  *                                   │             │
  *                                   │             y
  *                                   │             │
  *                                   │             v
  *                                   │  ┌─>XFS_DAS_RMTVAL_REMOVE
  *                                   │  │          │
  *                                   │  │          v
  *                                   │  └──y── more blks
  *                                   │         to remove?
  *                                   │             │
  *                                   │             n
  *                                   │             │
  *                                   │             v
  *                                   │         need to
  *                                   └─────> shrink tree? ─n─┐
  *                                                 │         │
  *                                                 y         │
  *                                                 │         │
  *                                                 v         │
  *                                         XFS_DAS_RM_SHRINK │
  *                                                 │         │
  *                                                 v         │
  *                                                done <─────┘
  */

/*
  * State machine diagram for attr set operations
  *
  * xfs_attr_set_iter()
  *                 │
  *                 v
  *           need to upgrade
  *          from sf to leaf? ──n─┐
  *                 │             │
  *                 y             │
  *                 │             │
  *                 V             │
  *          XFS_DAS_ADD_LEAF     │
  *                 │             │
  *                 v             │
  *  ┌──────n── fork has   <──────┘
  *  │         only 1 blk?
  *  │              │
  *  │              y
  *  │              │
  *  │              v
  *  │     xfs_attr_leaf_try_add()
  *  │              │
  *  │              v
  *  │          had enough
  *  ├──────n──   space?
  *  │              │
  *  │              y
  *  │              │
  *  │              v
  *  │      XFS_DAS_FOUND_LBLK  ──┐
  *  │                            │
  *  │      XFS_DAS_FLIP_LFLAG  ──┤
  *  │      (subroutine state)    │
  *  │                            │
  *  │      XFS_DAS_ALLOC_LEAF  ──┤
  *  │      (subroutine state)    │
  *  │                            └─>xfs_attr_leaf_addname()
  *  │                                              │
  *  │                                              v
  *  │                                ┌─────n──  need to
  *  │                                │        alloc blks?
  *  │                                │             │
  *  │                                │             y
  *  │                                │             │
  *  │                                │             v
  *  │                                │  ┌─>XFS_DAS_ALLOC_LEAF
  *  │                                │  │          │
  *  │                                │  │          v
  *  │                                │  └──y── need to alloc
  *  │                                │         more blocks?
  *  │                                │             │
  *  │                                │             n
  *  │                                │             │
  *  │                                │             v
  *  │                                │          was this
  *  │                                └────────> a rename? ──n─┐
  *  │                                              │          │
  *  │                                              y          │
  *  │                                              │          │
  *  │                                              v          │
  *  │                                      XFS_DAS_FLIP_LFLAG │
  *  │                                              │          │
  *  │                                              v          │
  *  │                                             done <──────┘
  *  └────> XFS_DAS_LEAF_TO_NODE ─┐
  *                               │
  *         XFS_DAS_FOUND_NBLK  ──┤
  *         (subroutine state)    │
  *                               │
  *         XFS_DAS_ALLOC_NODE  ──┤
  *         (subroutine state)    │
  *                               │
  *         XFS_DAS_FLIP_NFLAG  ──┤
  *         (subroutine state)    │
  *                               │
  *                               └─>xfs_attr_node_addname()
  *                                                 │
  *                                                 v
  *                                         find space to store
  *                                        attr. Split if needed
  *                                                 │
  *                                                 v
  *                                         XFS_DAS_FOUND_NBLK
  *                                                 │
  *                                                 v
  *                                   ┌─────n──  need to
  *                                   │        alloc blks?
  *                                   │             │
  *                                   │             y
  *                                   │             │
  *                                   │             v
  *                                   │  ┌─>XFS_DAS_ALLOC_NODE
  *                                   │  │          │
  *                                   │  │          v
  *                                   │  └──y── need to alloc
  *                                   │         more blocks?
  *                                   │             │
  *                                   │             n
  *                                   │             │
  *                                   │             v
  *                                   │          was this
  *                                   └────────> a rename? ──n─┐
  *                                                 │          │
  *                                                 y          │
  *                                                 │          │
  *                                                 v          │
  *                                         XFS_DAS_FLIP_NFLAG │
  *                                                 │          │
  *                                                 v          │
  *                                                done <──────┘
  */

  reply	other threads:[~2020-02-05 23:07 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-18 22:50 [PATCH v6 00/16] xfs: Delay Ready Attributes Allison Collins
2020-01-18 22:50 ` [PATCH v6 01/16] xfs: Replace attribute parameters with struct xfs_name Allison Collins
2020-01-21 22:08   ` Darrick J. Wong
2020-01-18 22:50 ` [PATCH v6 02/16] xfs: Embed struct xfs_name in xfs_da_args Allison Collins
2020-01-21 22:15   ` Darrick J. Wong
2020-01-18 22:50 ` [PATCH v6 03/16] xfs: Add xfs_has_attr and subroutines Allison Collins
2020-01-21 22:48   ` Darrick J. Wong
2020-01-22  3:17     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 04/16] xfs: Factor out new helper functions xfs_attr_rmtval_set Allison Collins
2020-01-18 22:50 ` [PATCH v6 05/16] xfs: Factor out trans handling in xfs_attr3_leaf_flipflags Allison Collins
2020-01-18 22:50 ` [PATCH v6 06/16] xfs: Factor out xfs_attr_leaf_addname helper Allison Collins
2020-01-21 23:01   ` Darrick J. Wong
2020-01-22  4:15     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 07/16] xfs: Refactor xfs_attr_try_sf_addname Allison Collins
2020-01-21 23:07   ` Darrick J. Wong
2020-01-22  4:17     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 08/16] xfs: Factor out trans roll from xfs_attr3_leaf_setflag Allison Collins
2020-01-18 22:50 ` [PATCH v6 09/16] xfs: Factor out xfs_attr_rmtval_invalidate Allison Collins
2020-01-18 22:50 ` [PATCH v6 10/16] xfs: Factor out trans roll in xfs_attr3_leaf_clearflag Allison Collins
2020-01-18 22:50 ` [PATCH v6 11/16] xfs: Check for -ENOATTR or -EEXIST Allison Collins
2020-01-21 23:15   ` Darrick J. Wong
2020-01-22  4:29     ` Allison Collins
2020-01-25 16:41       ` Allison Collins
2020-01-26 22:28         ` Darrick J. Wong
2020-01-27  0:20           ` Allison Collins
2020-01-30 22:58             ` Darrick J. Wong
2020-01-18 22:50 ` [PATCH v6 12/16] xfs: Add helper function xfs_attr_init_unmapstate Allison Collins
2020-01-21 23:21   ` Darrick J. Wong
2020-01-22  5:05     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 13/16] xfs: Add helper function xfs_attr_rmtval_unmap Allison Collins
2020-01-21 23:24   ` Darrick J. Wong
2020-01-22  5:23     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 14/16] xfs: Simplify xfs_attr_set_args Allison Collins
2020-01-21 23:31   ` Darrick J. Wong
2020-01-22  7:39     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 15/16] xfs: Add delay ready attr remove routines Allison Collins
2020-01-22  0:02   ` Darrick J. Wong
2020-01-22  9:32     ` Allison Collins
2020-01-18 22:50 ` [PATCH v6 16/16] xfs: Add delay ready attr set routines Allison Collins
2020-01-22  0:12   ` Darrick J. Wong
2020-01-22 10:30     ` Allison Collins
2020-02-05 23:07       ` Allison Collins [this message]
2020-01-22 16:57     ` Allison Collins
2020-01-22 17:04       ` Allison Collins

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=738cb956-f44b-12cd-6f57-feca617d5c6a@oracle.com \
    --to=allison.henderson@oracle.com \
    --cc=darrick.wong@oracle.com \
    --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).