From: "J. Bruce Fields" <bfields@fieldses.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Luo Longjun <luolongjun@huawei.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
sangyan@huawei.com, luchunhua@huawei.com
Subject: Re: [PATCH] fs/locks: print full locks information
Date: Sun, 21 Feb 2021 15:10:24 -0500 [thread overview]
Message-ID: <20210221201024.GB15975@fieldses.org> (raw)
In-Reply-To: <b76672d52ffe498259181688eaf54ec75be449e8.camel@kernel.org>
On Sun, Feb 21, 2021 at 01:43:03PM -0500, Jeff Layton wrote:
> On Sun, 2021-02-21 at 16:52 +0000, Al Viro wrote:
> > On Sat, Feb 20, 2021 at 01:32:50AM -0500, Luo Longjun wrote:
> > > + list_for_each_entry(bfl, &fl->fl_blocked_requests, fl_blocked_member)
> > > + __locks_show(f, bfl, level + 1);
> >
> > Er... What's the maximal depth, again? Kernel stack is very much finite...
>
> Ooof, good point. I don't think there is a maximal depth on the tree
> itself. If you do want to do something like this, then you'd need to
> impose a hard limit on the recursion somehow.
I think all you need to do is something like: follow the first entry of
fl_blocked_requests, printing as you go, until you get down to lock with
empty fl_blocked_requests (a leaf of the tree). When you get to a leaf,
print, then follow fl_blocker back up and look for your parent's next
sibling on its fl_blocked_requests list. If there are no more siblings,
continue up to your grandparent, etc.
It's the traverse-a-maze-by-always-turning-left algorithm applied to a
tree. I think we do it elsewhere in the VFS.
You also need an integer that keeps track of your current indent depth.
But you don't need a stack.
?
--b.
next prev parent reply other threads:[~2021-02-21 20:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-20 6:32 Luo Longjun
2021-02-21 16:34 ` Jeff Layton
2021-02-21 16:52 ` Al Viro
2021-02-21 18:43 ` Jeff Layton
2021-02-21 20:10 ` J. Bruce Fields [this message]
2021-02-26 3:58 ` [PATCH v3] " Luo Longjun
2021-03-09 13:37 ` Jeff Layton
2021-03-11 3:45 ` Luo Longjun
2021-03-11 13:52 ` Jeff Layton
2021-02-24 8:35 ` [PATCH v2 02/24] " Luo Longjun
2021-02-24 14:44 ` J. Bruce Fields
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=20210221201024.GB15975@fieldses.org \
--to=bfields@fieldses.org \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luchunhua@huawei.com \
--cc=luolongjun@huawei.com \
--cc=sangyan@huawei.com \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®