To simplify the code and make it more readable.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
fs/d_path.c | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/fs/d_path.c b/fs/d_path.c
index bb365511066b..0dab1ab1e78d 100644
--- a/fs/d_path.c
+++ b/fs/d_path.c
@@ -332,28 +332,23 @@ static char *__dentry_path(const struct dentry *d, struct prepend_buffer *p)
{
const struct dentry *dentry;
struct prepend_buffer b;
- int seq = 0;
rcu_read_lock();
-restart:
- dentry = d;
- b = *p;
- read_seqbegin_or_lock(&rename_lock, &seq);
- while (!IS_ROOT(dentry)) {
- const struct dentry *parent = dentry->d_parent;
+ __SEQLOCK_READ_SECTION(&rename_lock, lockless, seq, NULL) {
+ dentry = d;
+ b = *p;
+ while (!IS_ROOT(dentry)) {
+ const struct dentry *parent = dentry->d_parent;
- prefetch(parent);
- if (!prepend_name(&b, &dentry->d_name))
- break;
- dentry = parent;
- }
- if (!(seq & 1))
- rcu_read_unlock();
- if (need_seqretry(&rename_lock, seq)) {
- seq = 1;
- goto restart;
+ prefetch(parent);
+ if (!prepend_name(&b, &dentry->d_name))
+ break;
+ dentry = parent;
+ }
+ if (lockless)
+ rcu_read_unlock();
}
- done_seqretry(&rename_lock, seq);
+
if (b.len == p->len)
prepend_char(&b, '/');
return extract_string(&b);
--
2.25.1.362.g51ebf55