| 604 | } |
| 605 | |
| 606 | static int32_t DeviceWriteConcurrency(const string& path) { |
| 607 | if (FLAGS_data_cache_write_concurrency > 0) { |
| 608 | return FLAGS_data_cache_write_concurrency; |
| 609 | } |
| 610 | |
| 611 | int path_disk_id = DiskInfo::disk_id(path.c_str()); |
| 612 | if (path_disk_id < 0) { |
| 613 | LOG(WARNING) << "Device for path " << path << " could not be determined. " |
| 614 | << "Setting data_cache_write_concurrency=" |
| 615 | << THREADS_PER_ROTATIONAL_DISK << "."; |
| 616 | return THREADS_PER_ROTATIONAL_DISK; |
| 617 | } |
| 618 | |
| 619 | const std::string& device_name = DiskInfo::device_name(path_disk_id); |
| 620 | |
| 621 | int32_t write_concurrency = THREADS_PER_ROTATIONAL_DISK; |
| 622 | const char* disk_type = "rotational"; |
| 623 | if (!DiskInfo::is_rotational(path_disk_id)) { |
| 624 | write_concurrency = THREADS_PER_SOLID_STATE_DISK; |
| 625 | disk_type = "solid state"; |
| 626 | } |
| 627 | LOG(INFO) << "Default data_cache_write_concurrency=" << write_concurrency |
| 628 | << " for " << disk_type << " disk " << device_name; |
| 629 | return write_concurrency; |
| 630 | } |
| 631 | |
| 632 | DataCache::Partition::Partition( |
| 633 | int32_t index, const string& path, int64_t capacity, int max_opened_files, |