Lines Matching refs:mdi

376 bool is_valid_comrade(struct hmdfs_dentry_info_merge *mdi, umode_t mode)
378 if (mdi->type == DT_UNKNOWN) {
379 mdi->type = S_ISDIR(mode) ? DT_DIR : DT_REG;
383 if (mdi->type == DT_DIR && S_ISDIR(mode)) {
387 if (mdi->type == DT_REG && list_empty(&mdi->comrade_list) &&
399 struct hmdfs_dentry_info_merge *mdi;
403 mdi = container_of(ml_work->wait_queue, struct hmdfs_dentry_info_merge,
411 mutex_lock(&mdi->work_lock);
415 mutex_lock(&mdi->work_lock);
416 mutex_lock(&mdi->comrade_list_lock);
417 if (!is_valid_comrade(mdi, hmdfs_cm(comrade))) {
421 link_comrade(&mdi->comrade_list, comrade);
423 mutex_unlock(&mdi->comrade_list_lock);
426 if (--mdi->work_count == 0 || found)
428 mutex_unlock(&mdi->work_lock);
435 int merge_lookup_async(struct hmdfs_dentry_info_merge *mdi,
455 ml_work->wait_queue = &mdi->wait_queue;
459 ++mdi->work_count;
486 struct hmdfs_dentry_info_merge *mdi = hmdfs_dm(dentry);
491 rname = hmdfs_get_real_dname(dentry, &devid, &mdi->type);
508 mutex_lock(&mdi->work_lock);
510 if (mdi->type != DT_REG || devid == 0) {
513 err = merge_lookup_async(mdi, sbi, 0, cpath, flags);
519 if (mdi->type == DT_REG && peer->device_id != devid)
523 err = merge_lookup_async(mdi, sbi, peer->device_id, cpath,
529 mutex_unlock(&mdi->work_lock);
531 wait_event(mdi->wait_queue, is_merge_lookup_end(mdi));
534 if (!is_comrade_list_empty(mdi))
678 struct hmdfs_dentry_info_merge *mdi = NULL;
680 mdi = kmem_cache_zalloc(hmdfs_dentry_merge_cachep, GFP_NOFS);
681 if (!mdi)
684 mdi->ctime = jiffies;
685 mdi->type = DT_UNKNOWN;
686 mdi->work_count = 0;
687 mutex_init(&mdi->work_lock);
688 init_waitqueue_head(&mdi->wait_queue);
689 INIT_LIST_HEAD(&mdi->comrade_list);
690 mutex_init(&mdi->comrade_list_lock);
693 dentry->d_fsdata = mdi;