| 519 | } |
| 520 | |
| 521 | static void fsync_loose_object_transaction(struct odb_transaction *base, |
| 522 | int fd, const char *filename) |
| 523 | { |
| 524 | struct odb_transaction_files *transaction = |
| 525 | container_of_or_null(base, struct odb_transaction_files, base); |
| 526 | |
| 527 | /* |
| 528 | * If we have an active ODB transaction, we issue a call that |
| 529 | * cleans the filesystem page cache but avoids a hardware flush |
| 530 | * command. Later on we will issue a single hardware flush |
| 531 | * before renaming the objects to their final names as part of |
| 532 | * flush_batch_fsync. |
| 533 | */ |
| 534 | if (!transaction || !transaction->objdir || |
| 535 | git_fsync(fd, FSYNC_WRITEOUT_ONLY) < 0) { |
| 536 | if (errno == ENOSYS) |
| 537 | warning(_("core.fsyncMethod = batch is unsupported on this platform")); |
| 538 | fsync_or_die(fd, filename); |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | /* |
| 543 | * Cleanup after batch-mode fsync_object_files. |
no test coverage detected