w->last_pos.inode, k.k->p.snapshot, i->inode.bi_snapshot,
                         (bch2_bkey_val_to_text(&buf, c, k),
                          buf.buf))) {
-               struct bch_inode_unpacked new = i->inode;
-               struct bkey_i whiteout;
-
-               new.bi_snapshot = k.k->p.snapshot;
-
                if (!i->whiteout) {
+                       struct bch_inode_unpacked new = i->inode;
+                       new.bi_snapshot = k.k->p.snapshot;
                        ret = __bch2_fsck_write_inode(trans, &new);
                } else {
+                       struct bkey_i whiteout;
                        bkey_init(&whiteout.k);
                        whiteout.k.type = KEY_TYPE_whiteout;
-                       whiteout.k.p = SPOS(0, i->inode.bi_inum, i->inode.bi_snapshot);
+                       whiteout.k.p = SPOS(0, i->inode.bi_inum, k.k->p.snapshot);
                        ret = bch2_btree_insert_nonextent(trans, BTREE_ID_inodes,
                                                          &whiteout,
                                                          BTREE_UPDATE_internal_snapshot_node);