Skip to contentSkip to conversation

Redundant check in verify_parent_transid

DISCUSSION TARUISI Hiroaki 1 participant 1 message Jun 30, 2009 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hi,

In verify_parent_transid() of disk-io.c (btrfs-progs), I found redundant check.
---
static int verify_parent_transid(struct extent_io_tree *io_tree,
struct extent_buffer *eb, u64 parent_transid)

{
        int ret;

        if (!parent_transid || btrfs_header_generation(eb) == parent_transid)
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---
If second check is true in this sentense, then the function return. So the next if sentence is not estimated.
---

                return 0;

        if (extent_buffer_uptodate(eb) &&
            btrfs_header_generation(eb) == parent_transid) {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                ret = 0;
                goto out;
        }

---
However, here has same check which looks redundant. I guess here includes a bug, but I'm not sure. Could someone tell me why?
---

        printk("parent transid verify failed on %llu wanted %llu found %llu\n",
               (unsigned long long)eb->start,
               (unsigned long long)parent_transid,
               (unsigned long long)btrfs_header_generation(eb));
        ret = 1;

---(snip)---

Signature · 1 line
taruisi