gfs2_aspace_put(aspace);
kmem_cache_free(gfs2_glock_cachep, gl);
-
- atomic_dec(&sdp->sd_glock_count);
}
/**
if (error)
goto fail_aspace;
- atomic_inc(&sdp->sd_glock_count);
-
write_lock(&bucket->hb_lock);
tmp = search_bucket(bucket, &name);
if (tmp) {
held2 = (new_state != LM_ST_UNLOCKED);
if (held1 != held2) {
- if (held2) {
- atomic_inc(&sdp->sd_glock_held_count);
+ if (held2)
gfs2_glock_hold(gl);
- } else {
- atomic_dec(&sdp->sd_glock_held_count);
+ else
gfs2_glock_put(gl);
- }
}
gl->gl_state = new_state;
gfs2_glock_hold(gl);
gl->gl_req_bh = xmote_bh;
- atomic_inc(&sdp->sd_lm_lock_calls);
-
lck_ret = gfs2_lm_lock(sdp, gl->gl_lock, gl->gl_state, state,
lck_flags);
gfs2_glock_hold(gl);
gl->gl_req_bh = drop_bh;
- atomic_inc(&sdp->sd_lm_unlock_calls);
-
ret = gfs2_lm_unlock(sdp, gl->gl_lock, gl->gl_state);
if (gfs2_assert_withdraw(sdp, !(ret & LM_OUT_ERROR)))
struct gfs2_sbd *sdp = gl->gl_sbd;
int error = 0;
- atomic_inc(&sdp->sd_glock_nq_calls);
-
restart:
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
set_bit(HIF_ABORTED, &gh->gh_iflags);
struct gfs2_sbd *sdp = gl->gl_sbd;
struct gfs2_glock_operations *glops = gl->gl_ops;
- atomic_inc(&sdp->sd_glock_dq_calls);
-
if (gh->gh_flags & GL_SYNC)
set_bit(GLF_SYNC, &gl->gl_flags);
spin_unlock(&gl->gl_spin);
glops->go_xmote_th(gl, state, flags);
-
- atomic_inc(&gl->gl_sbd->sd_glock_prefetch_calls);
}
/**
{
struct gfs2_sbd *sdp = (struct gfs2_sbd *)fsdata;
- atomic_inc(&sdp->sd_lm_callbacks);
-
switch (type) {
case LM_CB_NEED_E:
blocking_cb(sdp, (struct lm_lockname *)data, LM_ST_UNLOCKED);
atomic_t sd_glock_count;
atomic_t sd_glock_held_count;
atomic_t sd_inode_count;
- atomic_t sd_bufdata_count;
-
- atomic_t sd_fh2dentry_misses;
atomic_t sd_reclaimed;
- atomic_t sd_log_flush_incore;
- atomic_t sd_log_flush_ondisk;
-
- atomic_t sd_glock_nq_calls;
- atomic_t sd_glock_dq_calls;
- atomic_t sd_glock_prefetch_calls;
- atomic_t sd_lm_lock_calls;
- atomic_t sd_lm_unlock_calls;
- atomic_t sd_lm_callbacks;
-
- atomic_t sd_ops_address;
- atomic_t sd_ops_dentry;
- atomic_t sd_ops_export;
- atomic_t sd_ops_file;
- atomic_t sd_ops_inode;
- atomic_t sd_ops_super;
- atomic_t sd_ops_vm;
char sd_fsname[GFS2_FSNAME_LEN];
char sd_table_name[GFS2_FSNAME_LEN];
unsigned int tail;
uint32_t hash;
- atomic_inc(&sdp->sd_log_flush_ondisk);
-
bh = sb_getblk(sdp->sd_vfs, blkno);
lock_buffer(bh);
memset(bh->b_data, 0, bh->b_size);
{
struct gfs2_ail *ai;
- atomic_inc(&sdp->sd_log_flush_incore);
-
ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL);
INIT_LIST_HEAD(&ai->ai_ail1_list);
INIT_LIST_HEAD(&ai->ai_ail2_list);
gfs2_assert_warn(sdp, list_empty(&bd->bd_le.le_list));
gfs2_assert_warn(sdp, !bd->bd_ail);
kmem_cache_free(gfs2_bufdata_cachep, bd);
- atomic_dec(&sdp->sd_bufdata_count);
set_v2bd(bh, NULL);
}
}
bd = kmem_cache_alloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL),
- atomic_inc(&gl->gl_sbd->sd_bufdata_count);
-
memset(bd, 0, sizeof(struct gfs2_bufdata));
bd->bd_bh = bh;
int error;
int done_trans = 0;
- atomic_inc(&sdp->sd_ops_address);
if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(ip->i_gl))) {
unlock_page(page);
return -EIO;
struct gfs2_holder gh;
int error;
- atomic_inc(&sdp->sd_ops_address);
-
if (file != &gfs2_internal_file_sentinal) {
gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh);
error = gfs2_glock_nq_m_atime(1, &gh);
loff_t end = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
struct gfs2_alloc *al;
- atomic_inc(&sdp->sd_ops_address);
-
gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME, &ip->i_gh);
error = gfs2_glock_nq_m_atime(1, &ip->i_gh);
if (error)
struct buffer_head *dibh;
struct gfs2_alloc *al = &ip->i_alloc;;
- atomic_inc(&sdp->sd_ops_address);
-
-
if (gfs2_assert_withdraw(sdp, gfs2_glock_is_locked_by_me(ip->i_gl)))
goto fail_nounlock;
sector_t dblock = 0;
int error;
- atomic_inc(&ip->i_sbd->sd_ops_address);
-
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
if (error)
return 0;
struct gfs2_inode *ip = get_v2ip(inode);
struct gfs2_sbd *sdp = ip->i_sbd;
- atomic_inc(&sdp->sd_ops_address);
-
if (rw == WRITE)
return gfs2_direct_IO_write(iocb, iov, offset, nr_segs);
lock_kernel();
- atomic_inc(&sdp->sd_ops_dentry);
-
inode = dentry->d_inode;
if (inode && is_bad_inode(inode))
goto invalid;
{
struct gfs2_inum this, parent;
- atomic_inc(&get_v2sdp(sb)->sd_ops_export);
-
if (fh_type != fh_len)
return NULL;
struct gfs2_inode *ip = get_v2ip(inode);
struct gfs2_sbd *sdp = ip->i_sbd;
- atomic_inc(&sdp->sd_ops_export);
-
if (*len < 4 || (connectable && *len < 8))
return 255;
if (!dir)
return -EINVAL;
- atomic_inc(&get_v2sdp(dir->i_sb)->sd_ops_export);
-
if (!S_ISDIR(dir->i_mode) || !inode)
return -EINVAL;
struct dentry *dentry;
int error;
- atomic_inc(&dip->i_sbd->sd_ops_export);
-
error = gfs2_lookupi(child->d_inode, &dotdot, 1, &inode);
if (error)
return ERR_PTR(error);
struct dentry *dentry;
int error;
- atomic_inc(&sdp->sd_ops_export);
-
/* System files? */
inode = gfs2_iget(sb, inum);
goto fail;
}
- atomic_inc(&sdp->sd_fh2dentry_misses);
-
out_ip:
error = -EIO;
if (ip->i_di.di_flags & GFS2_DIF_SYSTEM) {
struct gfs2_holder i_gh;
loff_t error;
- atomic_inc(&ip->i_sbd->sd_ops_file);
-
if (origin == 2) {
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
&i_gh);
struct kiocb kiocb;
ssize_t ret;
- atomic_inc(&get_v2sdp(filp->f_mapping->host->i_sb)->sd_ops_file);
-
init_sync_kiocb(&kiocb, filp);
ret = __gfs2_file_aio_read(&kiocb, &local_iov, 1, offset);
if (-EIOCBQUEUED == ret)
struct kiocb kiocb;
ssize_t ret;
- atomic_inc(&get_v2sdp(filp->f_mapping->host->i_sb)->sd_ops_file);
-
init_sync_kiocb(&kiocb, filp);
ret = __gfs2_file_aio_read(&kiocb, iov, nr_segs, ppos);
if (-EIOCBQUEUED == ret)
struct file *filp = iocb->ki_filp;
struct iovec local_iov = { .iov_base = buf, .iov_len = count };
- atomic_inc(&get_v2sdp(filp->f_mapping->host->i_sb)->sd_ops_file);
-
BUG_ON(iocb->ki_pos != pos);
return __gfs2_file_aio_read(iocb, &local_iov, 1, &iocb->ki_pos);
}
{
int error;
- atomic_inc(&get_v2sdp(file->f_mapping->host->i_sb)->sd_ops_file);
-
if (strcmp(current->comm, "nfsd") != 0)
error = readdir_reg(file, dirent, filldir);
else
return error;
}
-static int gfs2_ioctl_flags(struct gfs2_inode *ip, unsigned int cmd, unsigned long arg)
+static int gfs2_ioctl_flags(struct gfs2_inode *ip, unsigned int cmd,
+ unsigned long arg)
{
unsigned int lmode = (cmd == GFS2_IOCTL_SETFLAGS) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
struct buffer_head *dibh;
{
struct gfs2_inode *ip = get_v2ip(inode);
- atomic_inc(&ip->i_sbd->sd_ops_file);
-
switch (cmd) {
case GFS2_IOCTL_SETFLAGS:
case GFS2_IOCTL_GETFLAGS:
struct gfs2_holder i_gh;
int error;
- atomic_inc(&ip->i_sbd->sd_ops_file);
-
gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &i_gh);
error = gfs2_glock_nq_atime(&i_gh);
if (error) {
struct gfs2_file *fp;
int error;
- atomic_inc(&ip->i_sbd->sd_ops_file);
-
fp = kzalloc(sizeof(struct gfs2_file), GFP_KERNEL);
if (!fp)
return -ENOMEM;
struct gfs2_sbd *sdp = get_v2sdp(inode->i_sb);
struct gfs2_file *fp;
- atomic_inc(&sdp->sd_ops_file);
-
fp = get_v2fp(file);
set_v2fp(file, NULL);
{
struct gfs2_inode *ip = get_v2ip(dentry->d_inode);
- atomic_inc(&ip->i_sbd->sd_ops_file);
gfs2_log_flush_glock(ip->i_gl);
return 0;
{ .ln_number = ip->i_num.no_addr,
.ln_type = LM_TYPE_PLOCK };
- atomic_inc(&sdp->sd_ops_file);
-
if (!(fl->fl_flags & FL_POSIX))
return -ENOLCK;
if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
read_actor_t actor, void *target)
{
struct gfs2_inode *ip = get_v2ip(in_file->f_mapping->host);
-
- atomic_inc(&ip->i_sbd->sd_ops_file);
-
return generic_file_sendfile(in_file, offset, count, actor, target);
}
struct gfs2_inode *ip = get_v2ip(file->f_mapping->host);
struct gfs2_sbd *sdp = ip->i_sbd;
- atomic_inc(&ip->i_sbd->sd_ops_file);
-
if (!(fl->fl_flags & FL_FLOCK))
return -ENOLCK;
if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
int new = 1;
int error;
- atomic_inc(&sdp->sd_ops_inode);
-
gfs2_holder_init(dip->i_gl, 0, 0, ghs);
for (;;) {
struct inode *inode = NULL;
int error;
- atomic_inc(&sdp->sd_ops_inode);
-
if (!sdp->sd_args.ar_localcaching)
dentry->d_op = &gfs2_dops;
int alloc_required;
int error;
- atomic_inc(&sdp->sd_ops_inode);
-
if (S_ISDIR(ip->i_di.di_mode))
return -EPERM;
struct gfs2_holder ghs[2];
int error;
- atomic_inc(&sdp->sd_ops_inode);
-
error = gfs2_unlinked_get(sdp, &ul);
if (error)
return error;
int size;
int error;
- atomic_inc(&sdp->sd_ops_inode);
-
/* Must be stuffed with a null terminator for gfs2_follow_link() */
size = strlen(symname);
if (size > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode) - 1)
struct buffer_head *dibh;
int error;
- atomic_inc(&sdp->sd_ops_inode);
-
gfs2_holder_init(dip->i_gl, 0, 0, ghs);
inode = gfs2_createi(ghs, &dentry->d_name, S_IFDIR | mode);
struct gfs2_holder ghs[2];
int error;
- atomic_inc(&sdp->sd_ops_inode);
-
error = gfs2_unlinked_get(sdp, &ul);
if (error)
return error;
uint32_t major = 0, minor = 0;
int error;
- atomic_inc(&sdp->sd_ops_inode);
-
switch (mode & S_IFMT) {
case S_IFBLK:
case S_IFCHR:
unsigned int x;
int error;
- atomic_inc(&sdp->sd_ops_inode);
-
if (ndentry->d_inode) {
nip = get_v2ip(ndentry->d_inode);
if (ip == nip)
unsigned int len = GFS2_FAST_NAME_SIZE;
int error;
- atomic_inc(&ip->i_sbd->sd_ops_inode);
-
error = gfs2_readlinki(ip, &buf, &len);
if (error)
return error;
unsigned int len = GFS2_FAST_NAME_SIZE;
int error;
- atomic_inc(&ip->i_sbd->sd_ops_inode);
-
error = gfs2_readlinki(ip, &buf, &len);
if (!error) {
error = vfs_follow_link(nd, buf);
struct gfs2_holder i_gh;
int error;
- atomic_inc(&ip->i_sbd->sd_ops_inode);
-
if (ip->i_vn == ip->i_gl->gl_vn)
return generic_permission(inode, mask, gfs2_check_acl);
struct gfs2_holder i_gh;
int error;
- atomic_inc(&ip->i_sbd->sd_ops_inode);
-
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
if (error)
return error;
struct gfs2_holder gh;
int error;
- atomic_inc(&ip->i_sbd->sd_ops_inode);
-
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh);
if (!error) {
generic_fillattr(inode, stat);
struct gfs2_inode *ip = get_v2ip(dentry->d_inode);
struct gfs2_ea_request er;
- atomic_inc(&ip->i_sbd->sd_ops_inode);
-
memset(&er, 0, sizeof(struct gfs2_ea_request));
er.er_type = gfs2_ea_name2type(name, &er.er_name);
if (er.er_type == GFS2_EATYPE_UNUSED)
{
struct gfs2_ea_request er;
- atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode);
-
memset(&er, 0, sizeof(struct gfs2_ea_request));
er.er_type = gfs2_ea_name2type(name, &er.er_name);
if (er.er_type == GFS2_EATYPE_UNUSED)
{
struct gfs2_ea_request er;
- atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode);
-
memset(&er, 0, sizeof(struct gfs2_ea_request));
er.er_data = (size) ? buffer : NULL;
er.er_data_len = size;
{
struct gfs2_ea_request er;
- atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode);
-
memset(&er, 0, sizeof(struct gfs2_ea_request));
er.er_type = gfs2_ea_name2type(name, &er.er_name);
if (er.er_type == GFS2_EATYPE_UNUSED)
{
struct gfs2_inode *ip = get_v2ip(inode);
- atomic_inc(&ip->i_sbd->sd_ops_super);
-
if (current->flags & PF_MEMALLOC)
return 0;
if (ip && sync)
if (!sdp)
return;
- atomic_inc(&sdp->sd_ops_super);
-
/* Unfreeze the filesystem, if we need to */
mutex_lock(&sdp->sd_freeze_lock);
static void gfs2_write_super(struct super_block *sb)
{
struct gfs2_sbd *sdp = get_v2sdp(sb);
- atomic_inc(&sdp->sd_ops_super);
gfs2_log_flush(sdp);
}
struct gfs2_sbd *sdp = get_v2sdp(sb);
int error;
- atomic_inc(&sdp->sd_ops_super);
-
for (;;) {
error = gfs2_freeze_fs(sdp);
if (!error)
static void gfs2_unlockfs(struct super_block *sb)
{
struct gfs2_sbd *sdp = get_v2sdp(sb);
-
- atomic_inc(&sdp->sd_ops_super);
gfs2_unfreeze_fs(sdp);
}
struct gfs2_statfs_change sc;
int error;
- atomic_inc(&sdp->sd_ops_super);
-
if (gfs2_tune_get(sdp, gt_statfs_slow))
error = gfs2_statfs_slow(sdp, &sc);
else
struct gfs2_sbd *sdp = get_v2sdp(sb);
int error;
- atomic_inc(&sdp->sd_ops_super);
-
error = gfs2_mount_args(sdp, data, 1);
if (error)
return error;
{
struct gfs2_inode *ip = get_v2ip(inode);
- atomic_inc(&get_v2sdp(inode->i_sb)->sd_ops_super);
-
if (ip) {
spin_lock(&ip->i_spin);
ip->i_vnode = NULL;
struct gfs2_sbd *sdp = get_v2sdp(mnt->mnt_sb);
struct gfs2_args *args = &sdp->sd_args;
- atomic_inc(&sdp->sd_ops_super);
-
if (args->ar_lockproto[0])
seq_printf(s, ",lockproto=%s", args->ar_lockproto);
if (args->ar_locktable[0])
struct page *result;
int error;
- atomic_inc(&ip->i_sbd->sd_ops_vm);
-
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh);
if (error)
return NULL;
int alloc_required;
int error;
- atomic_inc(&ip->i_sbd->sd_ops_vm);
-
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
if (error)
return NULL;
ssize_t (*show)(struct gfs2_sbd *, char *);
};
-#define COUNTERS_ATTR_GENERAL(name, fmt, val) \
+#define COUNTERS_ATTR(name, fmt) \
static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
{ \
- return sprintf(buf, fmt, val); \
+ return sprintf(buf, fmt, (unsigned int)atomic_read(&sdp->sd_##name)); \
} \
static struct counters_attr counters_attr_##name = __ATTR_RO(name)
-#define COUNTERS_ATTR_SIMPLE(name, fmt) \
- COUNTERS_ATTR_GENERAL(name, fmt, sdp->sd_##name)
-
-#define COUNTERS_ATTR_ATOMIC(name, fmt) \
- COUNTERS_ATTR_GENERAL(name, fmt, (unsigned int)atomic_read(&sdp->sd_##name))
-
-COUNTERS_ATTR_ATOMIC(glock_count, "%u\n");
-COUNTERS_ATTR_ATOMIC(glock_held_count, "%u\n");
-COUNTERS_ATTR_ATOMIC(inode_count, "%u\n");
-COUNTERS_ATTR_ATOMIC(bufdata_count, "%u\n");
-COUNTERS_ATTR_ATOMIC(unlinked_count, "%u\n");
-COUNTERS_ATTR_ATOMIC(quota_count, "%u\n");
-COUNTERS_ATTR_SIMPLE(log_num_gl, "%u\n");
-COUNTERS_ATTR_SIMPLE(log_num_buf, "%u\n");
-COUNTERS_ATTR_SIMPLE(log_num_revoke, "%u\n");
-COUNTERS_ATTR_SIMPLE(log_num_rg, "%u\n");
-COUNTERS_ATTR_SIMPLE(log_num_databuf, "%u\n");
-COUNTERS_ATTR_SIMPLE(log_blks_free, "%u\n");
-COUNTERS_ATTR_GENERAL(jd_blocks, "%u\n", sdp->sd_jdesc->jd_blocks);
-COUNTERS_ATTR_ATOMIC(reclaim_count, "%u\n");
-COUNTERS_ATTR_SIMPLE(log_wraps, "%llu\n");
-COUNTERS_ATTR_ATOMIC(fh2dentry_misses, "%u\n");
-COUNTERS_ATTR_ATOMIC(reclaimed, "%u\n");
-COUNTERS_ATTR_ATOMIC(log_flush_incore, "%u\n");
-COUNTERS_ATTR_ATOMIC(log_flush_ondisk, "%u\n");
-COUNTERS_ATTR_ATOMIC(glock_nq_calls, "%u\n");
-COUNTERS_ATTR_ATOMIC(glock_dq_calls, "%u\n");
-COUNTERS_ATTR_ATOMIC(glock_prefetch_calls, "%u\n");
-COUNTERS_ATTR_ATOMIC(lm_lock_calls, "%u\n");
-COUNTERS_ATTR_ATOMIC(lm_unlock_calls, "%u\n");
-COUNTERS_ATTR_ATOMIC(lm_callbacks, "%u\n");
-COUNTERS_ATTR_ATOMIC(ops_address, "%u\n");
-COUNTERS_ATTR_ATOMIC(ops_dentry, "%u\n");
-COUNTERS_ATTR_ATOMIC(ops_export, "%u\n");
-COUNTERS_ATTR_ATOMIC(ops_file, "%u\n");
-COUNTERS_ATTR_ATOMIC(ops_inode, "%u\n");
-COUNTERS_ATTR_ATOMIC(ops_super, "%u\n");
-COUNTERS_ATTR_ATOMIC(ops_vm, "%u\n");
+COUNTERS_ATTR(glock_count, "%u\n");
+COUNTERS_ATTR(glock_held_count, "%u\n");
+COUNTERS_ATTR(inode_count, "%u\n");
+COUNTERS_ATTR(reclaimed, "%u\n");
static struct attribute *counters_attrs[] = {
&counters_attr_glock_count.attr,
&counters_attr_glock_held_count.attr,
&counters_attr_inode_count.attr,
- &counters_attr_bufdata_count.attr,
- &counters_attr_unlinked_count.attr,
- &counters_attr_quota_count.attr,
- &counters_attr_log_num_gl.attr,
- &counters_attr_log_num_buf.attr,
- &counters_attr_log_num_revoke.attr,
- &counters_attr_log_num_rg.attr,
- &counters_attr_log_num_databuf.attr,
- &counters_attr_log_blks_free.attr,
- &counters_attr_jd_blocks.attr,
- &counters_attr_reclaim_count.attr,
- &counters_attr_log_wraps.attr,
- &counters_attr_fh2dentry_misses.attr,
&counters_attr_reclaimed.attr,
- &counters_attr_log_flush_incore.attr,
- &counters_attr_log_flush_ondisk.attr,
- &counters_attr_glock_nq_calls.attr,
- &counters_attr_glock_dq_calls.attr,
- &counters_attr_glock_prefetch_calls.attr,
- &counters_attr_lm_lock_calls.attr,
- &counters_attr_lm_unlock_calls.attr,
- &counters_attr_lm_callbacks.attr,
- &counters_attr_ops_address.attr,
- &counters_attr_ops_dentry.attr,
- &counters_attr_ops_export.attr,
- &counters_attr_ops_file.attr,
- &counters_attr_ops_inode.attr,
- &counters_attr_ops_super.attr,
- &counters_attr_ops_vm.attr,
NULL
};