int fs_default_copy(struct fs_file *src, struct fs_file *dest)
{
int tmp_errno;
- /* we're going to be counting this as read+write, so remove the
- copy_count we just added */
- dest->fs->stats.copy_count--;
+ /* we're going to be counting this as read+write, so don't update
+ copy_count */
+ dest->copy_counted = TRUE;
if (dest->copy_src != NULL) {
i_assert(src == NULL || src == dest->copy_src);
} T_END;
if (!(ret < 0 && errno == EAGAIN)) {
fs_file_timing_end(dest, FS_OP_COPY);
- dest->fs->stats.copy_count++;
+ if (dest->copy_counted)
+ dest->copy_counted = FALSE;
+ else
+ dest->fs->stats.copy_count++;
dest->metadata_changed = FALSE;
}
return ret;
} T_END;
if (!(ret < 0 && errno == EAGAIN)) {
fs_file_timing_end(dest, FS_OP_COPY);
- dest->fs->stats.copy_count++;
+ if (dest->copy_counted)
+ dest->copy_counted = FALSE;
+ else
+ dest->fs->stats.copy_count++;
dest->metadata_changed = FALSE;
}
return ret;