In class IDiskRemote, all metadata file system operations use os file system api directly.
There is little extendiability if we want store the metadata of HDFS or S3 into distributed file system.
So I suggest change this way by using DiskPtr and will propose a pull request.

In addition, metadata of HDFS or S3 only store local FS which is not sharable.

{
public:
    explicit DiskLocalDirectoryIterator(const String & disk_path_, const String & dir_path_)
        : dir_path(dir_path_), entry(fs::path(disk_path_) / dir_path_)
    {
    }
    void next() override { ++entry; }
    bool isValid() const override { return entry != fs::directory_iterator(); }
    String path() const override
    {
        if (entry->is_directory())
            return dir_path / entry->path().filename() / "";
        else
            return dir_path / entry->path().filename();
    }
    String name() const override { return entry->path().filename(); }
private:
    fs::path dir_path;
    fs::directory_iterator entry;
};
ReservationPtr DiskLocal::reserve(UInt64 bytes)