cregit-Linux how code gets into the kernel

Release 4.10 fs/nilfs2/sysfs.c

Directory: fs/nilfs2
/*
 * sysfs.c - sysfs support implementation.
 *
 * Copyright (C) 2005-2014 Nippon Telegraph and Telephone Corporation.
 * Copyright (C) 2014 HGST, Inc., a Western Digital Company.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * Written by Vyacheslav Dubeyko <Vyacheslav.Dubeyko@hgst.com>
 */

#include <linux/kobject.h>

#include "nilfs.h"
#include "mdt.h"
#include "sufile.h"
#include "cpfile.h"
#include "sysfs.h"

/* /sys/fs/<nilfs>/ */

static struct kset *nilfs_kset;


#define NILFS_SHOW_TIME(time_t_val, buf) ({ \
                struct tm res; \
                int count = 0; \
                time_to_tm(time_t_val, 0, &res); \
                res.tm_year += 1900; \
                res.tm_mon += 1; \
                count = scnprintf(buf, PAGE_SIZE, \
                                    "%ld-%.2d-%.2d %.2d:%.2d:%.2d\n", \
                                    res.tm_year, res.tm_mon, res.tm_mday, \
                                    res.tm_hour, res.tm_min, res.tm_sec);\
                count; \
})


#define NILFS_DEV_INT_GROUP_OPS(name, parent_name) \
static ssize_t nilfs_##name##_attr_show(struct kobject *kobj, \
                                        struct attribute *attr, char *buf) \
{ \
        struct the_nilfs *nilfs = container_of(kobj->parent, \
                                                struct the_nilfs, \
                                                ns_##parent_name##_kobj); \
        struct nilfs_##name##_attr *a = container_of(attr, \
                                                struct nilfs_##name##_attr, \
                                                attr); \
        return a->show ? a->show(a, nilfs, buf) : 0; \
} \
static ssize_t nilfs_##name##_attr_store(struct kobject *kobj, \
                                         struct attribute *attr, \
                                         const char *buf, size_t len) \
{ \
        struct the_nilfs *nilfs = container_of(kobj->parent, \
                                                struct the_nilfs, \
                                                ns_##parent_name##_kobj); \
        struct nilfs_##name##_attr *a = container_of(attr, \
                                                struct nilfs_##name##_attr, \
                                                attr); \
        return a->store ? a->store(a, nilfs, buf, len) : 0; \
} \
static const struct sysfs_ops nilfs_##name##_attr_ops = { \
        .show   = nilfs_##name##_attr_show, \
        .store  = nilfs_##name##_attr_store, \
}


#define NILFS_DEV_INT_GROUP_TYPE(name, parent_name) \
static void nilfs_##name##_attr_release(struct kobject *kobj) \
{ \
        struct nilfs_sysfs_##parent_name##_subgroups *subgroups; \
        struct the_nilfs *nilfs = container_of(kobj->parent, \
                                                struct the_nilfs, \
                                                ns_##parent_name##_kobj); \
        subgroups = nilfs->ns_##parent_name##_subgroups; \
        complete(&subgroups->sg_##name##_kobj_unregister); \
} \
static struct kobj_type nilfs_##name##_ktype = { \
        .default_attrs  = nilfs_##name##_attrs, \
        .sysfs_ops      = &nilfs_##name##_attr_ops, \
        .release        = nilfs_##name##_attr_release, \
}


#define NILFS_DEV_INT_GROUP_FNS(name, parent_name) \
static int nilfs_sysfs_create_##name##_group(struct the_nilfs *nilfs) \
{ \
        struct kobject *parent; \
        struct kobject *kobj; \
        struct completion *kobj_unregister; \
        struct nilfs_sysfs_##parent_name##_subgroups *subgroups; \
        int err; \
        subgroups = nilfs->ns_##parent_name##_subgroups; \
        kobj = &subgroups->sg_##name##_kobj; \
        kobj_unregister = &subgroups->sg_##name##_kobj_unregister; \
        parent = &nilfs->ns_##parent_name##_kobj; \
        kobj->kset = nilfs_kset; \
        init_completion(kobj_unregister); \
        err = kobject_init_and_add(kobj, &nilfs_##name##_ktype, parent, \
                                    #name); \
        if (err) \
                return err; \
        return 0; \
} \
static void nilfs_sysfs_delete_##name##_group(struct the_nilfs *nilfs) \
{ \
        kobject_del(&nilfs->ns_##parent_name##_subgroups->sg_##name##_kobj); \
}

/************************************************************************
 *                        NILFS snapshot attrs                          *
 ************************************************************************/


static ssize_t nilfs_snapshot_inodes_count_show(struct nilfs_snapshot_attr *attr, struct nilfs_root *root, char *buf) { return snprintf(buf, PAGE_SIZE, "%llu\n", (unsigned long long)atomic64_read(&root->inodes_count)); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko43100.00%1100.00%
Total43100.00%1100.00%


static ssize_t nilfs_snapshot_blocks_count_show(struct nilfs_snapshot_attr *attr, struct nilfs_root *root, char *buf) { return snprintf(buf, PAGE_SIZE, "%llu\n", (unsigned long long)atomic64_read(&root->blocks_count)); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko43100.00%1100.00%
Total43100.00%1100.00%

static const char snapshot_readme_str[] = "The group contains details about mounted snapshot.\n\n" "(1) inodes_count\n\tshow number of inodes for snapshot.\n\n" "(2) blocks_count\n\tshow number of blocks for snapshot.\n\n";
static ssize_t nilfs_snapshot_README_show(struct nilfs_snapshot_attr *attr, struct nilfs_root *root, char *buf) { return snprintf(buf, PAGE_SIZE, snapshot_readme_str); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko30100.00%1100.00%
Total30100.00%1100.00%

NILFS_SNAPSHOT_RO_ATTR(inodes_count); NILFS_SNAPSHOT_RO_ATTR(blocks_count); NILFS_SNAPSHOT_RO_ATTR(README); static struct attribute *nilfs_snapshot_attrs[] = { NILFS_SNAPSHOT_ATTR_LIST(inodes_count), NILFS_SNAPSHOT_ATTR_LIST(blocks_count), NILFS_SNAPSHOT_ATTR_LIST(README), NULL, };
static ssize_t nilfs_snapshot_attr_show(struct kobject *kobj, struct attribute *attr, char *buf) { struct nilfs_root *root = container_of(kobj, struct nilfs_root, snapshot_kobj); struct nilfs_snapshot_attr *a = container_of(attr, struct nilfs_snapshot_attr, attr); return a->show ? a->show(a, root, buf) : 0; }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko68100.00%1100.00%
Total68100.00%1100.00%


static ssize_t nilfs_snapshot_attr_store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t len) { struct nilfs_root *root = container_of(kobj, struct nilfs_root, snapshot_kobj); struct nilfs_snapshot_attr *a = container_of(attr, struct nilfs_snapshot_attr, attr); return a->store ? a->store(a, root, buf, len) : 0; }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko74100.00%1100.00%
Total74100.00%1100.00%


static void nilfs_snapshot_attr_release(struct kobject *kobj) { struct nilfs_root *root = container_of(kobj, struct nilfs_root, snapshot_kobj); complete(&root->snapshot_kobj_unregister); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko34100.00%1100.00%
Total34100.00%1100.00%

static const struct sysfs_ops nilfs_snapshot_attr_ops = { .show = nilfs_snapshot_attr_show, .store = nilfs_snapshot_attr_store, }; static struct kobj_type nilfs_snapshot_ktype = { .default_attrs = nilfs_snapshot_attrs, .sysfs_ops = &nilfs_snapshot_attr_ops, .release = nilfs_snapshot_attr_release, };
int nilfs_sysfs_create_snapshot_group(struct nilfs_root *root) { struct the_nilfs *nilfs; struct kobject *parent; int err; nilfs = root->nilfs; parent = &nilfs->ns_dev_subgroups->sg_mounted_snapshots_kobj; root->snapshot_kobj.kset = nilfs_kset; init_completion(&root->snapshot_kobj_unregister); if (root->cno == NILFS_CPTREE_CURRENT_CNO) { err = kobject_init_and_add(&root->snapshot_kobj, &nilfs_snapshot_ktype, &nilfs->ns_dev_kobj, "current_checkpoint"); } else { err = kobject_init_and_add(&root->snapshot_kobj, &nilfs_snapshot_ktype, parent, "%llu", root->cno); } if (err) return err; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko118100.00%1100.00%
Total118100.00%1100.00%


void nilfs_sysfs_delete_snapshot_group(struct nilfs_root *root) { kobject_del(&root->snapshot_kobj); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko18100.00%1100.00%
Total18100.00%1100.00%

/************************************************************************ * NILFS mounted snapshots attrs * ************************************************************************/ static const char mounted_snapshots_readme_str[] = "The mounted_snapshots group contains group for\n" "every mounted snapshot.\n";
static ssize_t nilfs_mounted_snapshots_README_show(struct nilfs_mounted_snapshots_attr *attr, struct the_nilfs *nilfs, char *buf) { return snprintf(buf, PAGE_SIZE, mounted_snapshots_readme_str); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko30100.00%1100.00%
Total30100.00%1100.00%

NILFS_MOUNTED_SNAPSHOTS_RO_ATTR(README); static struct attribute *nilfs_mounted_snapshots_attrs[] = { NILFS_MOUNTED_SNAPSHOTS_ATTR_LIST(README), NULL, }; NILFS_DEV_INT_GROUP_OPS(mounted_snapshots, dev); NILFS_DEV_INT_GROUP_TYPE(mounted_snapshots, dev); NILFS_DEV_INT_GROUP_FNS(mounted_snapshots, dev); /************************************************************************ * NILFS checkpoints attrs * ************************************************************************/
static ssize_t nilfs_checkpoints_checkpoints_number_show(struct nilfs_checkpoints_attr *attr, struct the_nilfs *nilfs, char *buf) { __u64 ncheckpoints; struct nilfs_cpstat cpstat; int err; down_read(&nilfs->ns_segctor_sem); err = nilfs_cpfile_get_stat(nilfs->ns_cpfile, &cpstat); up_read(&nilfs->ns_segctor_sem); if (err < 0) { nilfs_msg(nilfs->ns_sb, KERN_ERR, "unable to get checkpoint stat: err=%d", err); return err; } ncheckpoints = cpstat.cs_ncps; return snprintf(buf, PAGE_SIZE, "%llu\n", ncheckpoints); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko9393.00%150.00%
ryusuke konishiryusuke konishi77.00%150.00%
Total100100.00%2100.00%


static ssize_t nilfs_checkpoints_snapshots_number_show(struct nilfs_checkpoints_attr *attr, struct the_nilfs *nilfs, char *buf) { __u64 nsnapshots; struct nilfs_cpstat cpstat; int err; down_read(&nilfs->ns_segctor_sem); err = nilfs_cpfile_get_stat(nilfs->ns_cpfile, &cpstat); up_read(&nilfs->ns_segctor_sem); if (err < 0) { nilfs_msg(nilfs->ns_sb, KERN_ERR, "unable to get checkpoint stat: err=%d", err); return err; } nsnapshots = cpstat.cs_nsss; return snprintf(buf, PAGE_SIZE, "%llu\n", nsnapshots); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko9393.00%150.00%
ryusuke konishiryusuke konishi77.00%150.00%
Total100100.00%2100.00%


static ssize_t nilfs_checkpoints_last_seg_checkpoint_show(struct nilfs_checkpoints_attr *attr, struct the_nilfs *nilfs, char *buf) { __u64 last_cno; spin_lock(&nilfs->ns_last_segment_lock); last_cno = nilfs->ns_last_cno; spin_unlock(&nilfs->ns_last_segment_lock); return snprintf(buf, PAGE_SIZE, "%llu\n", last_cno); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko57100.00%1100.00%
Total57100.00%1100.00%


static ssize_t nilfs_checkpoints_next_checkpoint_show(struct nilfs_checkpoints_attr *attr, struct the_nilfs *nilfs, char *buf) { __u64 cno; down_read(&nilfs->ns_segctor_sem); cno = nilfs->ns_cno; up_read(&nilfs->ns_segctor_sem); return snprintf(buf, PAGE_SIZE, "%llu\n", cno); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5596.49%150.00%
ryusuke konishiryusuke konishi23.51%150.00%
Total57100.00%2100.00%

static const char checkpoints_readme_str[] = "The checkpoints group contains attributes that describe\n" "details about volume's checkpoints.\n\n" "(1) checkpoints_number\n\tshow number of checkpoints on volume.\n\n" "(2) snapshots_number\n\tshow number of snapshots on volume.\n\n" "(3) last_seg_checkpoint\n" "\tshow checkpoint number of the latest segment.\n\n" "(4) next_checkpoint\n\tshow next checkpoint number.\n\n";
static ssize_t nilfs_checkpoints_README_show(struct nilfs_checkpoints_attr *attr, struct the_nilfs *nilfs, char *buf) { return snprintf(buf, PAGE_SIZE, checkpoints_readme_str); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko30100.00%1100.00%
Total30100.00%1100.00%

NILFS_CHECKPOINTS_RO_ATTR(checkpoints_number); NILFS_CHECKPOINTS_RO_ATTR(snapshots_number); NILFS_CHECKPOINTS_RO_ATTR(last_seg_checkpoint); NILFS_CHECKPOINTS_RO_ATTR(next_checkpoint); NILFS_CHECKPOINTS_RO_ATTR(README); static struct attribute *nilfs_checkpoints_attrs[] = { NILFS_CHECKPOINTS_ATTR_LIST(checkpoints_number), NILFS_CHECKPOINTS_ATTR_LIST(snapshots_number), NILFS_CHECKPOINTS_ATTR_LIST(last_seg_checkpoint), NILFS_CHECKPOINTS_ATTR_LIST(next_checkpoint), NILFS_CHECKPOINTS_ATTR_LIST(README), NULL, }; NILFS_DEV_INT_GROUP_OPS(checkpoints, dev); NILFS_DEV_INT_GROUP_TYPE(checkpoints, dev); NILFS_DEV_INT_GROUP_FNS(checkpoints, dev); /************************************************************************ * NILFS segments attrs * ************************************************************************/
static ssize_t nilfs_segments_segments_number_show(struct nilfs_segments_attr *attr, struct the_nilfs *nilfs, char *buf) { return snprintf(buf, PAGE_SIZE, "%lu\n", nilfs->ns_nsegments); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko34100.00%1100.00%
Total34100.00%1100.00%


static ssize_t nilfs_segments_blocks_per_segment_show(struct nilfs_segments_attr *attr, struct the_nilfs *nilfs, char *buf) { return snprintf(buf, PAGE_SIZE, "%lu\n", nilfs->ns_blocks_per_segment); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko34100.00%1100.00%
Total34100.00%1100.00%


static ssize_t nilfs_segments_clean_segments_show(struct nilfs_segments_attr *attr, struct the_nilfs *nilfs, char *buf) { unsigned long ncleansegs; down_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem); ncleansegs = nilfs_sufile_get_ncleansegs(nilfs->ns_sufile); up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem); return snprintf(buf, PAGE_SIZE, "%lu\n", ncleansegs); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko71100.00%1100.00%
Total71100.00%1100.00%


static ssize_t nilfs_segments_dirty_segments_show(struct nilfs_segments_attr *attr, struct the_nilfs *nilfs, char *buf) { struct nilfs_sustat sustat; int err; down_read(&nilfs->ns_segctor_sem); err = nilfs_sufile_get_stat(nilfs->ns_sufile, &sustat); up_read(&nilfs->ns_segctor_sem); if (err < 0) { nilfs_msg(nilfs->ns_sb, KERN_ERR, "unable to get segment stat: err=%d", err); return err; } return snprintf(buf, PAGE_SIZE, "%llu\n", sustat.ss_ndirtysegs); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko8692.47%150.00%
ryusuke konishiryusuke konishi77.53%150.00%
Total93100.00%2100.00%

static const char segments_readme_str[] = "The segments group contains attributes that describe\n" "details about volume's segments.\n\n" "(1) segments_number\n\tshow number of segments on volume.\n\n" "(2) blocks_per_segment\n\tshow number of blocks in segment.\n\n" "(3) clean_segments\n\tshow count of clean segments.\n\n" "(4) dirty_segments\n\tshow count of dirty segments.\n\n";
static ssize_t nilfs_segments_README_show(struct nilfs_segments_attr *attr, struct the_nilfs *nilfs, char *buf) { return snprintf(buf, PAGE_SIZE, segments_readme_str); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko30100.00%1100.00%
Total30100.00%1100.00%

NILFS_SEGMENTS_RO_ATTR(segments_number); NILFS_SEGMENTS_RO_ATTR(blocks_per_segment); NILFS_SEGMENTS_RO_ATTR(clean_segments); NILFS_SEGMENTS_RO_ATTR(dirty_segments); NILFS_SEGMENTS_RO_ATTR(README); static struct attribute *nilfs_segments_attrs[] = { NILFS_SEGMENTS_ATTR_LIST(segments_number), NILFS_SEGMENTS_ATTR_LIST(blocks_per_segment), NILFS_SEGMENTS_ATTR_LIST(clean_segments), NILFS_SEGMENTS_ATTR_LIST(dirty_segments), NILFS_SEGMENTS_ATTR_LIST(README), NULL, }; NILFS_DEV_INT_GROUP_OPS(segments, dev); NILFS_DEV_INT_GROUP_TYPE(segments, dev); NILFS_DEV_INT_GROUP_FNS(segments, dev); /************************************************************************ * NILFS segctor attrs * ************************************************************************/
static ssize_t nilfs_segctor_last_pseg_block_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { sector_t last_pseg; spin_lock(&nilfs->ns_last_segment_lock); last_pseg = nilfs->ns_last_pseg; spin_unlock(&nilfs->ns_last_segment_lock); return snprintf(buf, PAGE_SIZE, "%llu\n", (unsigned long long)last_pseg); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko62100.00%1100.00%
Total62100.00%1100.00%


static ssize_t nilfs_segctor_last_seg_sequence_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { u64 last_seq; spin_lock(&nilfs->ns_last_segment_lock); last_seq = nilfs->ns_last_seq; spin_unlock(&nilfs->ns_last_segment_lock); return snprintf(buf, PAGE_SIZE, "%llu\n", last_seq); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko57100.00%1100.00%
Total57100.00%1100.00%


static ssize_t nilfs_segctor_last_seg_checkpoint_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { __u64 last_cno; spin_lock(&nilfs->ns_last_segment_lock); last_cno = nilfs->ns_last_cno; spin_unlock(&nilfs->ns_last_segment_lock); return snprintf(buf, PAGE_SIZE, "%llu\n", last_cno); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko57100.00%1100.00%
Total57100.00%1100.00%


static ssize_t nilfs_segctor_current_seg_sequence_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { u64 seg_seq; down_read(&nilfs->ns_segctor_sem); seg_seq = nilfs->ns_seg_seq; up_read(&nilfs->ns_segctor_sem); return snprintf(buf, PAGE_SIZE, "%llu\n", seg_seq); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5596.49%150.00%
ryusuke konishiryusuke konishi23.51%150.00%
Total57100.00%2100.00%


static ssize_t nilfs_segctor_current_last_full_seg_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { __u64 segnum; down_read(&nilfs->ns_segctor_sem); segnum = nilfs->ns_segnum; up_read(&nilfs->ns_segctor_sem); return snprintf(buf, PAGE_SIZE, "%llu\n", segnum); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5596.49%150.00%
ryusuke konishiryusuke konishi23.51%150.00%
Total57100.00%2100.00%


static ssize_t nilfs_segctor_next_full_seg_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { __u64 nextnum; down_read(&nilfs->ns_segctor_sem); nextnum = nilfs->ns_nextnum; up_read(&nilfs->ns_segctor_sem); return snprintf(buf, PAGE_SIZE, "%llu\n", nextnum); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5596.49%150.00%
ryusuke konishiryusuke konishi23.51%150.00%
Total57100.00%2100.00%


static ssize_t nilfs_segctor_next_pseg_offset_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { unsigned long pseg_offset; down_read(&nilfs->ns_segctor_sem); pseg_offset = nilfs->ns_pseg_offset; up_read(&nilfs->ns_segctor_sem); return snprintf(buf, PAGE_SIZE, "%lu\n", pseg_offset); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5696.55%150.00%
ryusuke konishiryusuke konishi23.45%150.00%
Total58100.00%2100.00%


static ssize_t nilfs_segctor_next_checkpoint_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { __u64 cno; down_read(&nilfs->ns_segctor_sem); cno = nilfs->ns_cno; up_read(&nilfs->ns_segctor_sem); return snprintf(buf, PAGE_SIZE, "%llu\n", cno); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5596.49%150.00%
ryusuke konishiryusuke konishi23.51%150.00%
Total57100.00%2100.00%


static ssize_t nilfs_segctor_last_seg_write_time_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { time_t ctime; down_read(&nilfs->ns_segctor_sem); ctime = nilfs->ns_ctime; up_read(&nilfs->ns_segctor_sem); return NILFS_SHOW_TIME(ctime, buf); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5196.23%150.00%
ryusuke konishiryusuke konishi23.77%150.00%
Total53100.00%2100.00%


static ssize_t nilfs_segctor_last_seg_write_time_secs_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { time_t ctime; down_read(&nilfs->ns_segctor_sem); ctime = nilfs->ns_ctime; up_read(&nilfs->ns_segctor_sem); return snprintf(buf, PAGE_SIZE, "%llu\n", (unsigned long long)ctime); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko6096.77%150.00%
ryusuke konishiryusuke konishi23.23%150.00%
Total62100.00%2100.00%


static ssize_t nilfs_segctor_last_nongc_write_time_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { time_t nongc_ctime; down_read(&nilfs->ns_segctor_sem); nongc_ctime = nilfs->ns_nongc_ctime; up_read(&nilfs->ns_segctor_sem); return NILFS_SHOW_TIME(nongc_ctime, buf); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5196.23%150.00%
ryusuke konishiryusuke konishi23.77%150.00%
Total53100.00%2100.00%


static ssize_t nilfs_segctor_last_nongc_write_time_secs_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { time_t nongc_ctime; down_read(&nilfs->ns_segctor_sem); nongc_ctime = nilfs->ns_nongc_ctime; up_read(&nilfs->ns_segctor_sem); return snprintf(buf, PAGE_SIZE, "%llu\n", (unsigned long long)nongc_ctime); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko6096.77%150.00%
ryusuke konishiryusuke konishi23.23%150.00%
Total62100.00%2100.00%


static ssize_t nilfs_segctor_dirty_data_blocks_count_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { u32 ndirtyblks; down_read(&nilfs->ns_segctor_sem); ndirtyblks = atomic_read(&nilfs->ns_ndirtyblks); up_read(&nilfs->ns_segctor_sem); return snprintf(buf, PAGE_SIZE, "%u\n", ndirtyblks); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5996.72%150.00%
ryusuke konishiryusuke konishi23.28%150.00%
Total61100.00%2100.00%

static const char segctor_readme_str[] = "The segctor group contains attributes that describe\n" "segctor thread activity details.\n\n" "(1) last_pseg_block\n" "\tshow start block number of the latest segment.\n\n" "(2) last_seg_sequence\n" "\tshow sequence value of the latest segment.\n\n" "(3) last_seg_checkpoint\n" "\tshow checkpoint number of the latest segment.\n\n" "(4) current_seg_sequence\n\tshow segment sequence counter.\n\n" "(5) current_last_full_seg\n" "\tshow index number of the latest full segment.\n\n" "(6) next_full_seg\n" "\tshow index number of the full segment index to be used next.\n\n" "(7) next_pseg_offset\n" "\tshow offset of next partial segment in the current full segment.\n\n" "(8) next_checkpoint\n\tshow next checkpoint number.\n\n" "(9) last_seg_write_time\n" "\tshow write time of the last segment in human-readable format.\n\n" "(10) last_seg_write_time_secs\n" "\tshow write time of the last segment in seconds.\n\n" "(11) last_nongc_write_time\n" "\tshow write time of the last segment not for cleaner operation " "in human-readable format.\n\n" "(12) last_nongc_write_time_secs\n" "\tshow write time of the last segment not for cleaner operation " "in seconds.\n\n" "(13) dirty_data_blocks_count\n" "\tshow number of dirty data blocks.\n\n";
static ssize_t nilfs_segctor_README_show(struct nilfs_segctor_attr *attr, struct the_nilfs *nilfs, char *buf) { return snprintf(buf, PAGE_SIZE, segctor_readme_str); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko30100.00%1100.00%
Total30100.00%1100.00%

NILFS_SEGCTOR_RO_ATTR(last_pseg_block); NILFS_SEGCTOR_RO_ATTR(last_seg_sequence); NILFS_SEGCTOR_RO_ATTR(last_seg_checkpoint); NILFS_SEGCTOR_RO_ATTR(current_seg_sequence); NILFS_SEGCTOR_RO_ATTR(current_last_full_seg); NILFS_SEGCTOR_RO_ATTR(next_full_seg); NILFS_SEGCTOR_RO_ATTR(next_pseg_offset); NILFS_SEGCTOR_RO_ATTR(next_checkpoint); NILFS_SEGCTOR_RO_ATTR(last_seg_write_time); NILFS_SEGCTOR_RO_ATTR(last_seg_write_time_secs); NILFS_SEGCTOR_RO_ATTR(last_nongc_write_time); NILFS_SEGCTOR_RO_ATTR(last_nongc_write_time_secs); NILFS_SEGCTOR_RO_ATTR(dirty_data_blocks_count); NILFS_SEGCTOR_RO_ATTR(README); static struct attribute *nilfs_segctor_attrs[] = { NILFS_SEGCTOR_ATTR_LIST(last_pseg_block), NILFS_SEGCTOR_ATTR_LIST(last_seg_sequence), NILFS_SEGCTOR_ATTR_LIST(last_seg_checkpoint), NILFS_SEGCTOR_ATTR_LIST(current_seg_sequence), NILFS_SEGCTOR_ATTR_LIST(current_last_full_seg), NILFS_SEGCTOR_ATTR_LIST(next_full_seg), NILFS_SEGCTOR_ATTR_LIST(next_pseg_offset), NILFS_SEGCTOR_ATTR_LIST(next_checkpoint), NILFS_SEGCTOR_ATTR_LIST(last_seg_write_time), NILFS_SEGCTOR_ATTR_LIST(last_seg_write_time_secs), NILFS_SEGCTOR_ATTR_LIST(last_nongc_write_time), NILFS_SEGCTOR_ATTR_LIST(last_nongc_write_time_secs), NILFS_SEGCTOR_ATTR_LIST(dirty_data_blocks_count), NILFS_SEGCTOR_ATTR_LIST(README), NULL, }; NILFS_DEV_INT_GROUP_OPS(segctor, dev); NILFS_DEV_INT_GROUP_TYPE(segctor, dev); NILFS_DEV_INT_GROUP_FNS(segctor, dev); /************************************************************************ * NILFS superblock attrs * ************************************************************************/
static ssize_t nilfs_superblock_sb_write_time_show(struct nilfs_superblock_attr *attr, struct the_nilfs *nilfs, char *buf) { time_t sbwtime; down_read(&nilfs->ns_sem); sbwtime = nilfs->ns_sbwtime; up_read(&nilfs->ns_sem); return NILFS_SHOW_TIME(sbwtime, buf); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko53100.00%1100.00%
Total53100.00%1100.00%


static ssize_t nilfs_superblock_sb_write_time_secs_show(struct nilfs_superblock_attr *attr, struct the_nilfs *nilfs, char *buf) { time_t sbwtime; down_read(&nilfs->ns_sem); sbwtime = nilfs->ns_sbwtime; up_read(&nilfs->ns_sem); return snprintf(buf, PAGE_SIZE, "%llu\n", (unsigned long long)sbwtime); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko62100.00%1100.00%
Total62100.00%1100.00%


static ssize_t nilfs_superblock_sb_write_count_show(struct nilfs_superblock_attr *attr, struct the_nilfs *nilfs, char *buf) { unsigned int sbwcount; down_read(&nilfs->ns_sem); sbwcount = nilfs->ns_sbwcount; up_read(&nilfs->ns_sem); return snprintf(buf, PAGE_SIZE, "%u\n", sbwcount); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5798.28%150.00%
ryusuke konishiryusuke konishi11.72%150.00%
Total58100.00%2100.00%


static ssize_t nilfs_superblock_sb_update_frequency_show(struct nilfs_superblock_attr *attr, struct the_nilfs *nilfs, char *buf) { unsigned int sb_update_freq; down_read(&nilfs->ns_sem); sb_update_freq = nilfs->ns_sb_update_freq; up_read(&nilfs->ns_sem); return snprintf(buf, PAGE_SIZE, "%u\n", sb_update_freq); }

Contributors

PersonTokensPropCommitsCommitProp
vyacheslav dubeykovyacheslav dubeyko5798.28%150.00%
ryusuke konishiryusuke konishi11.72%150.00%
Total58100.00%2100.00%


static ssize_t nilfs_superblock_sb_update_frequency_store(struct nilfs_superblock_attr *attr, struct the_nilfs *nilfs, const char *buf, size_t count) { unsigned int val; int err; err = kstrtouint(skip_spaces(buf), 0, &