Esempio n. 1
0
bool rm_mounts_is_nonrotational_by_path(RmMountTable *self, const char *path) {
    if(self == NULL) {
        return -1;
    }

    RmStat stat_buf;
    if(rm_sys_stat(path, &stat_buf) == -1) {
        return -1;
    }
    return rm_mounts_is_nonrotational(self, stat_buf.st_dev);
}
Esempio n. 2
0
/* RmMDSDevice */
static RmMDSDevice *rm_mds_device_new(RmMDS *mds, const dev_t disk) {
    RmMDSDevice *self = g_slice_new0(RmMDSDevice);

    g_mutex_init(&self->lock);
    g_cond_init(&self->cond);

    self->mds = mds;
    self->ref_count = 0;
    self->threads = 0;
    self->disk = disk;

    if(mds->fake_disk) {
        self->is_rotational = (disk % 2 == 0);
    } else {
        self->is_rotational = !rm_mounts_is_nonrotational(mds->mount_table, disk);
    }

    rm_log_debug_line("Created new RmMDSDevice for %srotational disk #%" LLU,
                      self->is_rotational ? "" : "non-", (RmOff)disk);
    return self;
}