Lines Matching refs:sdp

42 	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);  in gfs2_attr_show()  local
44 return a->show ? a->show(sdp, buf) : 0; in gfs2_attr_show()
50 struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); in gfs2_attr_store() local
52 return a->store ? a->store(sdp, buf, len) : len; in gfs2_attr_store()
63 static ssize_t id_show(struct gfs2_sbd *sdp, char *buf) in id_show() argument
66 MAJOR(sdp->sd_vfs->s_dev), MINOR(sdp->sd_vfs->s_dev)); in id_show()
69 static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf) in fsname_show() argument
71 return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname); in fsname_show()
74 static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf) in uuid_show() argument
76 struct super_block *s = sdp->sd_vfs; in uuid_show()
84 static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf) in freeze_show() argument
86 struct super_block *sb = sdp->sd_vfs; in freeze_show()
92 static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in freeze_store() argument
105 error = thaw_super(sdp->sd_vfs); in freeze_store()
108 error = freeze_super(sdp->sd_vfs); in freeze_store()
115 fs_warn(sdp, "freeze %d error %d\n", n, error); in freeze_store()
122 static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf) in withdraw_show() argument
124 unsigned int b = test_bit(SDF_SHUTDOWN, &sdp->sd_flags); in withdraw_show()
128 static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in withdraw_store() argument
142 gfs2_lm_withdraw(sdp, "withdrawing from cluster at user's request\n"); in withdraw_store()
147 static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf, in statfs_sync_store() argument
162 gfs2_statfs_sync(sdp->sd_vfs, 0); in statfs_sync_store()
166 static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf, in quota_sync_store() argument
181 gfs2_quota_sync(sdp->sd_vfs, 0); in quota_sync_store()
185 static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, in quota_refresh_user_store() argument
203 error = gfs2_quota_refresh(sdp, qid); in quota_refresh_user_store()
207 static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, in quota_refresh_group_store() argument
225 error = gfs2_quota_refresh(sdp, qid); in quota_refresh_group_store()
229 static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in demote_rq_store() argument
264 if (!test_and_set_bit(SDF_DEMOTE, &sdp->sd_flags)) in demote_rq_store()
265 fs_info(sdp, "demote interface used\n"); in demote_rq_store()
266 rv = gfs2_glock_get(sdp, glnum, glops, 0, &gl); in demote_rq_store()
305 struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); in gfs2_sbd_release() local
307 kfree(sdp); in gfs2_sbd_release()
321 static ssize_t proto_name_show(struct gfs2_sbd *sdp, char *buf) in proto_name_show() argument
323 const struct lm_lockops *ops = sdp->sd_lockstruct.ls_ops; in proto_name_show()
327 static ssize_t block_show(struct gfs2_sbd *sdp, char *buf) in block_show() argument
329 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in block_show()
339 static ssize_t block_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in block_store() argument
341 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in block_store()
353 gfs2_glock_thaw(sdp); in block_store()
360 static ssize_t wdack_show(struct gfs2_sbd *sdp, char *buf) in wdack_show() argument
362 int val = completion_done(&sdp->sd_wdack) ? 1 : 0; in wdack_show()
367 static ssize_t wdack_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in wdack_store() argument
376 !strcmp(sdp->sd_lockstruct.ls_ops->lm_proto_name, "lock_dlm")) in wdack_store()
377 complete(&sdp->sd_wdack); in wdack_store()
383 static ssize_t lkfirst_show(struct gfs2_sbd *sdp, char *buf) in lkfirst_show() argument
385 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in lkfirst_show()
389 static ssize_t lkfirst_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in lkfirst_store() argument
397 rv = wait_for_completion_killable(&sdp->sd_locking_init); in lkfirst_store()
400 spin_lock(&sdp->sd_jindex_spin); in lkfirst_store()
402 if (test_bit(SDF_NOJOURNALID, &sdp->sd_flags) == 0) in lkfirst_store()
405 if (sdp->sd_args.ar_spectator) in lkfirst_store()
407 if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL) in lkfirst_store()
409 sdp->sd_lockstruct.ls_first = first; in lkfirst_store()
412 spin_unlock(&sdp->sd_jindex_spin); in lkfirst_store()
416 static ssize_t first_done_show(struct gfs2_sbd *sdp, char *buf) in first_done_show() argument
418 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in first_done_show()
422 int gfs2_recover_set(struct gfs2_sbd *sdp, unsigned jid) in gfs2_recover_set() argument
428 wait_for_completion(&sdp->sd_journal_ready); in gfs2_recover_set()
430 spin_lock(&sdp->sd_jindex_spin); in gfs2_recover_set()
439 if (sdp->sd_jdesc->jd_jid == jid && !sdp->sd_args.ar_spectator) in gfs2_recover_set()
442 list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) { in gfs2_recover_set()
443 if (jd->jd_jid != jid && !sdp->sd_args.ar_spectator) in gfs2_recover_set()
449 spin_unlock(&sdp->sd_jindex_spin); in gfs2_recover_set()
453 static ssize_t recover_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in recover_store() argument
462 if (test_bit(SDF_NORECOVERY, &sdp->sd_flags)) { in recover_store()
467 rv = gfs2_recover_set(sdp, jid); in recover_store()
472 static ssize_t recover_done_show(struct gfs2_sbd *sdp, char *buf) in recover_done_show() argument
474 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in recover_done_show()
478 static ssize_t recover_status_show(struct gfs2_sbd *sdp, char *buf) in recover_status_show() argument
480 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in recover_status_show()
484 static ssize_t jid_show(struct gfs2_sbd *sdp, char *buf) in jid_show() argument
486 return sprintf(buf, "%d\n", sdp->sd_lockstruct.ls_jid); in jid_show()
489 static ssize_t jid_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in jid_store() argument
497 rv = wait_for_completion_killable(&sdp->sd_locking_init); in jid_store()
500 spin_lock(&sdp->sd_jindex_spin); in jid_store()
502 if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL) in jid_store()
505 if (test_bit(SDF_NOJOURNALID, &sdp->sd_flags) == 0) in jid_store()
508 if (sdp->sd_args.ar_spectator && jid > 0) in jid_store()
510 sdp->sd_lockstruct.ls_jid = jid; in jid_store()
511 clear_bit(SDF_NOJOURNALID, &sdp->sd_flags); in jid_store()
513 wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); in jid_store()
515 spin_unlock(&sdp->sd_jindex_spin); in jid_store()
549 static ssize_t quota_scale_show(struct gfs2_sbd *sdp, char *buf) in quota_scale_show() argument
552 sdp->sd_tune.gt_quota_scale_num, in quota_scale_show()
553 sdp->sd_tune.gt_quota_scale_den); in quota_scale_show()
556 static ssize_t quota_scale_store(struct gfs2_sbd *sdp, const char *buf, in quota_scale_store() argument
559 struct gfs2_tune *gt = &sdp->sd_tune; in quota_scale_store()
575 static ssize_t tune_set(struct gfs2_sbd *sdp, unsigned int *field, in tune_set() argument
578 struct gfs2_tune *gt = &sdp->sd_tune; in tune_set()
602 static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
604 return snprintf(buf, PAGE_SIZE, "%u\n", sdp->sd_tune.gt_##name); \
609 static ssize_t name##_store(struct gfs2_sbd *sdp, const char *buf, size_t len)\
611 return tune_set(sdp, &sdp->sd_tune.gt_##name, check_zero, buf, len); \
646 int gfs2_sys_fs_add(struct gfs2_sbd *sdp) in gfs2_sys_fs_add() argument
648 struct super_block *sb = sdp->sd_vfs; in gfs2_sys_fs_add()
656 sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); in gfs2_sys_fs_add()
658 sdp->sd_kobj.kset = gfs2_kset; in gfs2_sys_fs_add()
659 error = kobject_init_and_add(&sdp->sd_kobj, &gfs2_ktype, NULL, in gfs2_sys_fs_add()
660 "%s", sdp->sd_table_name); in gfs2_sys_fs_add()
666 error = sysfs_create_group(&sdp->sd_kobj, &tune_group); in gfs2_sys_fs_add()
670 error = sysfs_create_group(&sdp->sd_kobj, &lock_module_group); in gfs2_sys_fs_add()
674 error = sysfs_create_link(&sdp->sd_kobj, in gfs2_sys_fs_add()
680 kobject_uevent_env(&sdp->sd_kobj, KOBJ_ADD, envp); in gfs2_sys_fs_add()
684 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group); in gfs2_sys_fs_add()
686 sysfs_remove_group(&sdp->sd_kobj, &tune_group); in gfs2_sys_fs_add()
688 free_percpu(sdp->sd_lkstats); in gfs2_sys_fs_add()
689 fs_err(sdp, "error %d adding sysfs files\n", error); in gfs2_sys_fs_add()
691 kobject_put(&sdp->sd_kobj); in gfs2_sys_fs_add()
693 kfree(sdp); in gfs2_sys_fs_add()
698 void gfs2_sys_fs_del(struct gfs2_sbd *sdp) in gfs2_sys_fs_del() argument
700 sysfs_remove_link(&sdp->sd_kobj, "device"); in gfs2_sys_fs_del()
701 sysfs_remove_group(&sdp->sd_kobj, &tune_group); in gfs2_sys_fs_del()
702 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group); in gfs2_sys_fs_del()
703 kobject_put(&sdp->sd_kobj); in gfs2_sys_fs_del()
709 struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); in gfs2_uevent() local
710 struct super_block *s = sdp->sd_vfs; in gfs2_uevent()
712 add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name); in gfs2_uevent()
713 add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name); in gfs2_uevent()
714 if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags)) in gfs2_uevent()
715 add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid); in gfs2_uevent()