mirror of
https://github.com/schoebel/mars
synced 2025-01-14 02:50:48 +00:00
infra: factor out _reconnect_dent()
This commit is contained in:
parent
c500183177
commit
9828207c62
@ -1525,6 +1525,19 @@ int mars_filler(void *__buf, const char *name, int namlen, loff_t offset,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
void _reconnect_dent(struct mars_cookie *cookie, struct mars_dent *dent)
|
||||
{
|
||||
if (dent->d_parent == cookie->parent)
|
||||
return;
|
||||
|
||||
if (dent->d_parent)
|
||||
dent->d_parent->d_child_count--;
|
||||
dent->d_parent = cookie->parent;
|
||||
if (dent->d_parent)
|
||||
dent->d_parent->d_child_count++;
|
||||
}
|
||||
|
||||
static
|
||||
void _mars_order(struct mars_cookie *cookie, struct mars_dent *dent)
|
||||
{
|
||||
@ -1603,11 +1616,7 @@ void _mars_order(struct mars_cookie *cookie, struct mars_dent *dent)
|
||||
list_add(&dent->dent_hash_link, start);
|
||||
|
||||
found:
|
||||
if (dent->d_parent)
|
||||
dent->d_parent->d_child_count--;
|
||||
dent->d_parent = cookie->parent;
|
||||
if (dent->d_parent)
|
||||
dent->d_parent->d_child_count++;
|
||||
_reconnect_dent(cookie, dent);
|
||||
}
|
||||
|
||||
static inline
|
||||
@ -1655,11 +1664,7 @@ void _mars_order_all(struct mars_cookie *cookie)
|
||||
list_add(&dent->dent_link, &later_anchor);
|
||||
else
|
||||
list_add_tail(&dent->dent_link, &later_anchor);
|
||||
if (dent->d_parent)
|
||||
dent->d_parent->d_child_count--;
|
||||
dent->d_parent = cookie->parent;
|
||||
if (dent->d_parent)
|
||||
dent->d_parent->d_child_count++;
|
||||
_reconnect_dent(cookie, dent);
|
||||
continue;
|
||||
}
|
||||
if (!cookie->some_ordered) {
|
||||
|
Loading…
Reference in New Issue
Block a user