Hi folks,

I've been reading through the delayed references code, and have stumbled
across a couple of numeric values about which I have no idea whatsoever.

I was hoping someone could enlighten me on what they are for, and why
they are used in spite of any other particular value.

For instance, in delayed-ref.c one can read

int btrfs_find_ref_cluster(struct btrfs_trans_handle *trans,
                           struct list_head *cluster, u64 start)
{
[...]
again:
        while (node && count < 32) {
                ref = rb_entry(node, struct btrfs_delayed_ref_node, rb_node);
[...]
}

and in transaction.c one can read
static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
                          struct btrfs_root *root, int throttle, int lock)
{
[...]

        while (count < 4) {
                unsigned long cur = trans->delayed_ref_updates;
                trans->delayed_ref_updates = 0;
                if (cur &&
                    trans->transaction->delayed_refs.num_heads_ready > 64) {
                        trans->delayed_ref_updates = 0;
[...]
}

I've been wondering about what the 32 and the 64 mean. These values seem
far too round to be random, and I'm sure there is a purpose behind them, but if
it is obvious I'm certainly missing the point.

The 'count < 4' also throws me off, but I'm assuming it is someway to guarantee
everything gets flushed.

Any help would be appreciated.


Cheers,
Joao

---
João Eduardo Luís
gpg key: 477C26E5 from pool.keyserver.eu 





Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to