mirror of https://github.com/schoebel/mars
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;
|
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
|
static
|
||||||
void _mars_order(struct mars_cookie *cookie, struct mars_dent *dent)
|
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);
|
list_add(&dent->dent_hash_link, start);
|
||||||
|
|
||||||
found:
|
found:
|
||||||
if (dent->d_parent)
|
_reconnect_dent(cookie, dent);
|
||||||
dent->d_parent->d_child_count--;
|
|
||||||
dent->d_parent = cookie->parent;
|
|
||||||
if (dent->d_parent)
|
|
||||||
dent->d_parent->d_child_count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
|
@ -1655,11 +1664,7 @@ void _mars_order_all(struct mars_cookie *cookie)
|
||||||
list_add(&dent->dent_link, &later_anchor);
|
list_add(&dent->dent_link, &later_anchor);
|
||||||
else
|
else
|
||||||
list_add_tail(&dent->dent_link, &later_anchor);
|
list_add_tail(&dent->dent_link, &later_anchor);
|
||||||
if (dent->d_parent)
|
_reconnect_dent(cookie, dent);
|
||||||
dent->d_parent->d_child_count--;
|
|
||||||
dent->d_parent = cookie->parent;
|
|
||||||
if (dent->d_parent)
|
|
||||||
dent->d_parent->d_child_count++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!cookie->some_ordered) {
|
if (!cookie->some_ordered) {
|
||||||
|
|
Loading…
Reference in New Issue