static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
                                struct ulist *parents, int level,
-                               struct btrfs_key *key, u64 wanted_disk_byte,
+                               struct btrfs_key *key, u64 time_seq,
+                               u64 wanted_disk_byte,
                                const u64 *extent_item_pos)
 {
        int ret;
         */
        while (1) {
                eie = NULL;
-               ret = btrfs_next_leaf(root, path);
+               ret = btrfs_next_old_leaf(root, path, time_seq);
                if (ret < 0)
                        return ret;
                if (ret)
        if (level == 0)
                btrfs_item_key_to_cpu(eb, &key, path->slots[0]);
 
-       ret = add_all_parents(root, path, parents, level, &key,
+       ret = add_all_parents(root, path, parents, level, &key, time_seq,
                                ref->wanted_disk_byte, extent_item_pos);
 out:
        btrfs_free_path(path);
 
  * returns < 0 on io errors.
  */
 int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
+{
+       return btrfs_next_old_leaf(root, path, 0);
+}
+
+int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
+                       u64 time_seq)
 {
        int slot;
        int level;
        path->keep_locks = 1;
        path->leave_spinning = 1;
 
-       ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
+       if (time_seq)
+               ret = btrfs_search_old_slot(root, &key, path, time_seq);
+       else
+               ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
        path->keep_locks = 0;
 
        if (ret < 0)
 
 }
 
 int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path);
+int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
+                       u64 time_seq);
 static inline int btrfs_next_item(struct btrfs_root *root, struct btrfs_path *p)
 {
        ++p->slots[0];