Finalize a file on disk, and close it. */
| 576 | |
| 577 | /* Finalize a file on disk, and close it. */ |
| 578 | static void close_loose_object(struct odb_source_loose *loose, |
| 579 | int fd, const char *filename) |
| 580 | { |
| 581 | if (loose->base.will_destroy) |
| 582 | goto out; |
| 583 | |
| 584 | if (batch_fsync_enabled(FSYNC_COMPONENT_LOOSE_OBJECT)) |
| 585 | fsync_loose_object_transaction(loose->base.odb->transaction, fd, filename); |
| 586 | else if (fsync_object_files > 0) |
| 587 | fsync_or_die(fd, filename); |
| 588 | else |
| 589 | fsync_component_or_die(FSYNC_COMPONENT_LOOSE_OBJECT, fd, |
| 590 | filename); |
| 591 | |
| 592 | out: |
| 593 | if (close(fd) != 0) |
| 594 | die_errno(_("error when closing loose object file")); |
| 595 | } |
| 596 | |
| 597 | /* Size of directory component, including the ending '/' */ |
| 598 | static inline int directory_size(const char *filename) |
no test coverage detected