Lines Matching refs:sdp

39 	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);  in gfs2_attr_show()  local
41 return a->show ? a->show(sdp, buf) : 0; in gfs2_attr_show()
47 struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); in gfs2_attr_store() local
49 return a->store ? a->store(sdp, buf, len) : len; in gfs2_attr_store()
60 static ssize_t id_show(struct gfs2_sbd *sdp, char *buf) in id_show() argument
63 MAJOR(sdp->sd_vfs->s_dev), MINOR(sdp->sd_vfs->s_dev)); in id_show()
66 static ssize_t status_show(struct gfs2_sbd *sdp, char *buf) in status_show() argument
68 unsigned long f = sdp->sd_flags; in status_show()
103 (sdp->sd_jdesc ? sdp->sd_jdesc->jd_jid : 0), in status_show()
104 (sdp->sd_args.ar_spectator ? 1 : 0), in status_show()
110 (sb_rdonly(sdp->sd_vfs) ? 1 : 0), in status_show()
117 sdp->sd_log_error, in status_show()
118 rwsem_is_locked(&sdp->sd_log_flush_lock), in status_show()
119 sdp->sd_log_num_revoke, in status_show()
120 atomic_read(&sdp->sd_log_in_flight), in status_show()
121 atomic_read(&sdp->sd_log_blks_needed), in status_show()
122 atomic_read(&sdp->sd_log_blks_free), in status_show()
123 sdp->sd_log_flush_head, in status_show()
124 sdp->sd_log_flush_tail, in status_show()
125 sdp->sd_log_blks_reserved, in status_show()
126 atomic_read(&sdp->sd_log_revokes_available), in status_show()
127 atomic_read(&sdp->sd_log_pinned), in status_show()
128 atomic_read(&sdp->sd_log_thresh1), in status_show()
129 atomic_read(&sdp->sd_log_thresh2)); in status_show()
133 static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf) in fsname_show() argument
135 return sysfs_emit(buf, "%s\n", sdp->sd_fsname); in fsname_show()
138 static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf) in uuid_show() argument
140 struct super_block *s = sdp->sd_vfs; in uuid_show()
148 static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf) in freeze_show() argument
150 struct super_block *sb = sdp->sd_vfs; in freeze_show()
156 static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in freeze_store() argument
169 error = thaw_super(sdp->sd_vfs, FREEZE_HOLDER_USERSPACE, NULL); in freeze_store()
172 error = freeze_super(sdp->sd_vfs, FREEZE_HOLDER_USERSPACE, NULL); in freeze_store()
179 fs_warn(sdp, "freeze %d error %d\n", n, error); in freeze_store()
186 static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf) in withdraw_show() argument
188 unsigned int b = gfs2_withdrawn(sdp); in withdraw_show()
192 static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in withdraw_store() argument
206 gfs2_lm(sdp, "withdrawing from cluster at user's request\n"); in withdraw_store()
207 gfs2_withdraw(sdp); in withdraw_store()
212 static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf, in statfs_sync_store() argument
227 gfs2_statfs_sync(sdp->sd_vfs, 0); in statfs_sync_store()
231 static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf, in quota_sync_store() argument
246 gfs2_quota_sync(sdp->sd_vfs, 0); in quota_sync_store()
250 static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, in quota_refresh_user_store() argument
268 error = gfs2_quota_refresh(sdp, qid); in quota_refresh_user_store()
272 static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, in quota_refresh_group_store() argument
290 error = gfs2_quota_refresh(sdp, qid); in quota_refresh_group_store()
294 static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in demote_rq_store() argument
329 if (!test_and_set_bit(SDF_DEMOTE, &sdp->sd_flags)) in demote_rq_store()
330 fs_info(sdp, "demote interface used\n"); in demote_rq_store()
331 rv = gfs2_glock_get(sdp, glnum, glops, NO_CREATE, &gl); in demote_rq_store()
373 struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); in gfs2_sbd_release() local
375 complete(&sdp->sd_kobj_unregister); in gfs2_sbd_release()
389 static ssize_t proto_name_show(struct gfs2_sbd *sdp, char *buf) in proto_name_show() argument
391 const struct lm_lockops *ops = sdp->sd_lockstruct.ls_ops; in proto_name_show()
395 static ssize_t block_show(struct gfs2_sbd *sdp, char *buf) in block_show() argument
397 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in block_show()
407 static ssize_t block_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in block_store() argument
409 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in block_store()
421 gfs2_glock_thaw(sdp); in block_store()
428 static ssize_t withdraw_helper_status_store(struct gfs2_sbd *sdp, in withdraw_helper_status_store() argument
440 sdp->sd_withdraw_helper_status = val; in withdraw_helper_status_store()
441 complete(&sdp->sd_withdraw_helper); in withdraw_helper_status_store()
445 static ssize_t lkfirst_show(struct gfs2_sbd *sdp, char *buf) in lkfirst_show() argument
447 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in lkfirst_show()
451 static ssize_t lkfirst_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in lkfirst_store() argument
459 rv = wait_for_completion_killable(&sdp->sd_locking_init); in lkfirst_store()
462 spin_lock(&sdp->sd_jindex_spin); in lkfirst_store()
464 if (test_bit(SDF_NOJOURNALID, &sdp->sd_flags) == 0) in lkfirst_store()
467 if (sdp->sd_args.ar_spectator) in lkfirst_store()
469 if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL) in lkfirst_store()
471 sdp->sd_lockstruct.ls_first = first; in lkfirst_store()
474 spin_unlock(&sdp->sd_jindex_spin); in lkfirst_store()
478 static ssize_t first_done_show(struct gfs2_sbd *sdp, char *buf) in first_done_show() argument
480 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in first_done_show()
484 int gfs2_recover_set(struct gfs2_sbd *sdp, unsigned jid) in gfs2_recover_set() argument
490 wait_for_completion(&sdp->sd_journal_ready); in gfs2_recover_set()
492 spin_lock(&sdp->sd_jindex_spin); in gfs2_recover_set()
501 if (!sdp->sd_jdesc) in gfs2_recover_set()
503 if (sdp->sd_jdesc->jd_jid == jid && !sdp->sd_args.ar_spectator) in gfs2_recover_set()
506 list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) { in gfs2_recover_set()
507 if (jd->jd_jid != jid && !sdp->sd_args.ar_spectator) in gfs2_recover_set()
513 spin_unlock(&sdp->sd_jindex_spin); in gfs2_recover_set()
517 static ssize_t recover_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in recover_store() argument
526 if (test_bit(SDF_NORECOVERY, &sdp->sd_flags)) { in recover_store()
531 rv = gfs2_recover_set(sdp, jid); in recover_store()
536 static ssize_t recover_done_show(struct gfs2_sbd *sdp, char *buf) in recover_done_show() argument
538 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in recover_done_show()
542 static ssize_t recover_status_show(struct gfs2_sbd *sdp, char *buf) in recover_status_show() argument
544 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in recover_status_show()
548 static ssize_t jid_show(struct gfs2_sbd *sdp, char *buf) in jid_show() argument
550 return sysfs_emit(buf, "%d\n", sdp->sd_lockstruct.ls_jid); in jid_show()
553 static ssize_t jid_store(struct gfs2_sbd *sdp, const char *buf, size_t len) in jid_store() argument
561 rv = wait_for_completion_killable(&sdp->sd_locking_init); in jid_store()
564 spin_lock(&sdp->sd_jindex_spin); in jid_store()
566 if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL) in jid_store()
569 if (test_bit(SDF_NOJOURNALID, &sdp->sd_flags) == 0) in jid_store()
572 if (sdp->sd_args.ar_spectator && jid > 0) in jid_store()
574 sdp->sd_lockstruct.ls_jid = jid; in jid_store()
575 clear_bit(SDF_NOJOURNALID, &sdp->sd_flags); in jid_store()
577 wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); in jid_store()
579 spin_unlock(&sdp->sd_jindex_spin); in jid_store()
613 static ssize_t quota_scale_show(struct gfs2_sbd *sdp, char *buf) in quota_scale_show() argument
616 sdp->sd_tune.gt_quota_scale_num, in quota_scale_show()
617 sdp->sd_tune.gt_quota_scale_den); in quota_scale_show()
620 static ssize_t quota_scale_store(struct gfs2_sbd *sdp, const char *buf, in quota_scale_store() argument
623 struct gfs2_tune *gt = &sdp->sd_tune; in quota_scale_store()
639 static ssize_t tune_set(struct gfs2_sbd *sdp, unsigned int *field, in tune_set() argument
642 struct gfs2_tune *gt = &sdp->sd_tune; in tune_set()
666 static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
668 return sysfs_emit(buf, "%u\n", sdp->sd_tune.gt_##name); \
673 static ssize_t name##_store(struct gfs2_sbd *sdp, const char *buf, size_t len)\
675 return tune_set(sdp, &sdp->sd_tune.gt_##name, check_zero, buf, len); \
712 int gfs2_sys_fs_add(struct gfs2_sbd *sdp) in gfs2_sys_fs_add() argument
714 struct super_block *sb = sdp->sd_vfs; in gfs2_sys_fs_add()
721 sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); in gfs2_sys_fs_add()
723 init_completion(&sdp->sd_kobj_unregister); in gfs2_sys_fs_add()
724 sdp->sd_kobj.kset = gfs2_kset; in gfs2_sys_fs_add()
725 error = kobject_init_and_add(&sdp->sd_kobj, &gfs2_ktype, NULL, in gfs2_sys_fs_add()
726 "%s", sdp->sd_table_name); in gfs2_sys_fs_add()
730 error = sysfs_create_group(&sdp->sd_kobj, &tune_group); in gfs2_sys_fs_add()
734 error = sysfs_create_group(&sdp->sd_kobj, &lock_module_group); in gfs2_sys_fs_add()
738 error = sysfs_create_link(&sdp->sd_kobj, in gfs2_sys_fs_add()
744 kobject_uevent_env(&sdp->sd_kobj, KOBJ_ADD, envp); in gfs2_sys_fs_add()
748 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group); in gfs2_sys_fs_add()
750 sysfs_remove_group(&sdp->sd_kobj, &tune_group); in gfs2_sys_fs_add()
752 fs_err(sdp, "error %d adding sysfs files\n", error); in gfs2_sys_fs_add()
753 kobject_put(&sdp->sd_kobj); in gfs2_sys_fs_add()
754 wait_for_completion(&sdp->sd_kobj_unregister); in gfs2_sys_fs_add()
758 void gfs2_sys_fs_del(struct gfs2_sbd *sdp) in gfs2_sys_fs_del() argument
760 sysfs_remove_link(&sdp->sd_kobj, "device"); in gfs2_sys_fs_del()
761 sysfs_remove_group(&sdp->sd_kobj, &tune_group); in gfs2_sys_fs_del()
762 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group); in gfs2_sys_fs_del()
763 kobject_put(&sdp->sd_kobj); in gfs2_sys_fs_del()
764 wait_for_completion(&sdp->sd_kobj_unregister); in gfs2_sys_fs_del()
769 const struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); in gfs2_uevent() local
770 const struct super_block *s = sdp->sd_vfs; in gfs2_uevent()
772 add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name); in gfs2_uevent()
773 add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name); in gfs2_uevent()
774 if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags)) in gfs2_uevent()
775 add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid); in gfs2_uevent()