ceph: use ceph_sb_to_client instead of ceph_client

ceph_sb_to_client and ceph_client are really identical, we need to dump
one; while function ceph_client is confusing with "struct ceph_client",
ceph_sb_to_client's definition is more clear; so we'd better switch all
call to ceph_sb_to_client.

  -static inline struct ceph_client *ceph_client(struct super_block *sb)
  -{
  -	return sb->s_fs_info;
  -}

Signed-off-by: Cheng Renquan <crquan@gmail.com>
Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Cheng Renquan 2010-03-26 17:40:33 +08:00 коммит произвёл Sage Weil
Родитель 2d06eeb877
Коммит 640ef79d27
11 изменённых файлов: 30 добавлений и 33 удалений

Просмотреть файл

@ -563,7 +563,7 @@ static void writepages_finish(struct ceph_osd_request *req,
ceph_release_pages(req->r_pages, req->r_num_pages); ceph_release_pages(req->r_pages, req->r_num_pages);
if (req->r_pages_from_pool) if (req->r_pages_from_pool)
mempool_free(req->r_pages, mempool_free(req->r_pages,
ceph_client(inode->i_sb)->wb_pagevec_pool); ceph_sb_to_client(inode->i_sb)->wb_pagevec_pool);
else else
kfree(req->r_pages); kfree(req->r_pages);
ceph_osdc_put_request(req); ceph_osdc_put_request(req);

Просмотреть файл

@ -867,7 +867,8 @@ void __ceph_remove_cap(struct ceph_cap *cap)
{ {
struct ceph_mds_session *session = cap->session; struct ceph_mds_session *session = cap->session;
struct ceph_inode_info *ci = cap->ci; struct ceph_inode_info *ci = cap->ci;
struct ceph_mds_client *mdsc = &ceph_client(ci->vfs_inode.i_sb)->mdsc; struct ceph_mds_client *mdsc =
&ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
int removed = 0; int removed = 0;
dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode); dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);
@ -1298,7 +1299,8 @@ static void ceph_flush_snaps(struct ceph_inode_info *ci)
*/ */
void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask)
{ {
struct ceph_mds_client *mdsc = &ceph_client(ci->vfs_inode.i_sb)->mdsc; struct ceph_mds_client *mdsc =
&ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
struct inode *inode = &ci->vfs_inode; struct inode *inode = &ci->vfs_inode;
int was = ci->i_dirty_caps; int was = ci->i_dirty_caps;
int dirty = 0; int dirty = 0;
@ -1336,7 +1338,7 @@ void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask)
static int __mark_caps_flushing(struct inode *inode, static int __mark_caps_flushing(struct inode *inode,
struct ceph_mds_session *session) struct ceph_mds_session *session)
{ {
struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
int flushing; int flushing;
@ -1663,7 +1665,7 @@ ack:
static int try_flush_caps(struct inode *inode, struct ceph_mds_session *session, static int try_flush_caps(struct inode *inode, struct ceph_mds_session *session,
unsigned *flush_tid) unsigned *flush_tid)
{ {
struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
int unlock_session = session ? 0 : 1; int unlock_session = session ? 0 : 1;
int flushing = 0; int flushing = 0;
@ -1829,7 +1831,8 @@ int ceph_write_inode(struct inode *inode, struct writeback_control *wbc)
err = wait_event_interruptible(ci->i_cap_wq, err = wait_event_interruptible(ci->i_cap_wq,
caps_are_flushed(inode, flush_tid)); caps_are_flushed(inode, flush_tid));
} else { } else {
struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; struct ceph_mds_client *mdsc =
&ceph_sb_to_client(inode->i_sb)->mdsc;
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (__ceph_caps_dirty(ci)) if (__ceph_caps_dirty(ci))
@ -2411,7 +2414,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,
__releases(inode->i_lock) __releases(inode->i_lock)
{ {
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
unsigned seq = le32_to_cpu(m->seq); unsigned seq = le32_to_cpu(m->seq);
int dirty = le32_to_cpu(m->dirty); int dirty = le32_to_cpu(m->dirty);
int cleaned = 0; int cleaned = 0;

Просмотреть файл

@ -478,7 +478,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin)
struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
struct dentry *dentry, int err) struct dentry *dentry, int err)
{ {
struct ceph_client *client = ceph_client(dentry->d_sb); struct ceph_client *client = ceph_sb_to_client(dentry->d_sb);
struct inode *parent = dentry->d_parent->d_inode; struct inode *parent = dentry->d_parent->d_inode;
/* .snap dir? */ /* .snap dir? */
@ -1059,7 +1059,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
int left; int left;
if (!ceph_test_opt(ceph_client(inode->i_sb), DIRSTAT)) if (!ceph_test_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT))
return -EISDIR; return -EISDIR;
if (!cf->dir_info) { if (!cf->dir_info) {
@ -1161,7 +1161,7 @@ void ceph_dentry_lru_add(struct dentry *dn)
dout("dentry_lru_add %p %p '%.*s'\n", di, dn, dout("dentry_lru_add %p %p '%.*s'\n", di, dn,
dn->d_name.len, dn->d_name.name); dn->d_name.len, dn->d_name.name);
if (di) { if (di) {
mdsc = &ceph_client(dn->d_sb)->mdsc; mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc;
spin_lock(&mdsc->dentry_lru_lock); spin_lock(&mdsc->dentry_lru_lock);
list_add_tail(&di->lru, &mdsc->dentry_lru); list_add_tail(&di->lru, &mdsc->dentry_lru);
mdsc->num_dentry++; mdsc->num_dentry++;
@ -1177,7 +1177,7 @@ void ceph_dentry_lru_touch(struct dentry *dn)
dout("dentry_lru_touch %p %p '%.*s'\n", di, dn, dout("dentry_lru_touch %p %p '%.*s'\n", di, dn,
dn->d_name.len, dn->d_name.name); dn->d_name.len, dn->d_name.name);
if (di) { if (di) {
mdsc = &ceph_client(dn->d_sb)->mdsc; mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc;
spin_lock(&mdsc->dentry_lru_lock); spin_lock(&mdsc->dentry_lru_lock);
list_move_tail(&di->lru, &mdsc->dentry_lru); list_move_tail(&di->lru, &mdsc->dentry_lru);
spin_unlock(&mdsc->dentry_lru_lock); spin_unlock(&mdsc->dentry_lru_lock);
@ -1192,7 +1192,7 @@ void ceph_dentry_lru_del(struct dentry *dn)
dout("dentry_lru_del %p %p '%.*s'\n", di, dn, dout("dentry_lru_del %p %p '%.*s'\n", di, dn,
dn->d_name.len, dn->d_name.name); dn->d_name.len, dn->d_name.name);
if (di) { if (di) {
mdsc = &ceph_client(dn->d_sb)->mdsc; mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc;
spin_lock(&mdsc->dentry_lru_lock); spin_lock(&mdsc->dentry_lru_lock);
list_del_init(&di->lru); list_del_init(&di->lru);
mdsc->num_dentry--; mdsc->num_dentry--;

Просмотреть файл

@ -115,7 +115,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
static struct dentry *__cfh_to_dentry(struct super_block *sb, static struct dentry *__cfh_to_dentry(struct super_block *sb,
struct ceph_nfs_confh *cfh) struct ceph_nfs_confh *cfh)
{ {
struct ceph_mds_client *mdsc = &ceph_client(sb)->mdsc; struct ceph_mds_client *mdsc = &ceph_sb_to_client(sb)->mdsc;
struct inode *inode; struct inode *inode;
struct dentry *dentry; struct dentry *dentry;
struct ceph_vino vino; struct ceph_vino vino;

Просмотреть файл

@ -809,7 +809,7 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_osd_client *osdc = &ceph_client(inode->i_sb)->osdc; struct ceph_osd_client *osdc = &ceph_sb_to_client(inode->i_sb)->osdc;
loff_t endoff = pos + iov->iov_len; loff_t endoff = pos + iov->iov_len;
int got = 0; int got = 0;
int ret, err; int ret, err;

Просмотреть файл

@ -384,7 +384,7 @@ void ceph_destroy_inode(struct inode *inode)
*/ */
if (ci->i_snap_realm) { if (ci->i_snap_realm) {
struct ceph_mds_client *mdsc = struct ceph_mds_client *mdsc =
&ceph_client(ci->vfs_inode.i_sb)->mdsc; &ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
struct ceph_snap_realm *realm = ci->i_snap_realm; struct ceph_snap_realm *realm = ci->i_snap_realm;
dout(" dropping residual ref to snap realm %p\n", realm); dout(" dropping residual ref to snap realm %p\n", realm);
@ -623,7 +623,7 @@ static int fill_inode(struct inode *inode,
inode->i_mapping->a_ops = &ceph_aops; inode->i_mapping->a_ops = &ceph_aops;
inode->i_mapping->backing_dev_info = inode->i_mapping->backing_dev_info =
&ceph_client(inode->i_sb)->backing_dev_info; &ceph_sb_to_client(inode->i_sb)->backing_dev_info;
switch (inode->i_mode & S_IFMT) { switch (inode->i_mode & S_IFMT) {
case S_IFIFO: case S_IFIFO:
@ -681,7 +681,7 @@ static int fill_inode(struct inode *inode,
} }
/* it may be better to set st_size in getattr instead? */ /* it may be better to set st_size in getattr instead? */
if (ceph_test_opt(ceph_client(inode->i_sb), RBYTES)) if (ceph_test_opt(ceph_sb_to_client(inode->i_sb), RBYTES))
inode->i_size = ci->i_rbytes; inode->i_size = ci->i_rbytes;
break; break;
default: default:
@ -1438,7 +1438,7 @@ void ceph_queue_vmtruncate(struct inode *inode)
{ {
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
if (queue_work(ceph_client(inode->i_sb)->trunc_wq, if (queue_work(ceph_sb_to_client(inode->i_sb)->trunc_wq,
&ci->i_vmtruncate_work)) { &ci->i_vmtruncate_work)) {
dout("ceph_queue_vmtruncate %p\n", inode); dout("ceph_queue_vmtruncate %p\n", inode);
igrab(inode); igrab(inode);
@ -1527,7 +1527,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
struct inode *parent_inode = dentry->d_parent->d_inode; struct inode *parent_inode = dentry->d_parent->d_inode;
const unsigned int ia_valid = attr->ia_valid; const unsigned int ia_valid = attr->ia_valid;
struct ceph_mds_request *req; struct ceph_mds_request *req;
struct ceph_mds_client *mdsc = &ceph_client(dentry->d_sb)->mdsc; struct ceph_mds_client *mdsc = &ceph_sb_to_client(dentry->d_sb)->mdsc;
int issued; int issued;
int release = 0, dirtied = 0; int release = 0, dirtied = 0;
int mask = 0; int mask = 0;

Просмотреть файл

@ -98,7 +98,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
struct ceph_ioctl_dataloc dl; struct ceph_ioctl_dataloc dl;
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_osd_client *osdc = &ceph_client(inode->i_sb)->osdc; struct ceph_osd_client *osdc = &ceph_sb_to_client(inode->i_sb)->osdc;
u64 len = 1, olen; u64 len = 1, olen;
u64 tmp; u64 tmp;
struct ceph_object_layout ol; struct ceph_object_layout ol;

Просмотреть файл

@ -512,7 +512,7 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
struct ceph_cap_snap *capsnap) struct ceph_cap_snap *capsnap)
{ {
struct inode *inode = &ci->vfs_inode; struct inode *inode = &ci->vfs_inode;
struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
BUG_ON(capsnap->writing); BUG_ON(capsnap->writing);
capsnap->size = inode->i_size; capsnap->size = inode->i_size;

Просмотреть файл

@ -107,8 +107,8 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
static int ceph_syncfs(struct super_block *sb, int wait) static int ceph_syncfs(struct super_block *sb, int wait)
{ {
dout("sync_fs %d\n", wait); dout("sync_fs %d\n", wait);
ceph_osdc_sync(&ceph_client(sb)->osdc); ceph_osdc_sync(&ceph_sb_to_client(sb)->osdc);
ceph_mdsc_sync(&ceph_client(sb)->mdsc); ceph_mdsc_sync(&ceph_sb_to_client(sb)->mdsc);
dout("sync_fs %d done\n", wait); dout("sync_fs %d done\n", wait);
return 0; return 0;
} }
@ -932,9 +932,9 @@ static int ceph_get_sb(struct file_system_type *fs_type,
goto out; goto out;
} }
if (ceph_client(sb) != client) { if (ceph_sb_to_client(sb) != client) {
ceph_destroy_client(client); ceph_destroy_client(client);
client = ceph_client(sb); client = ceph_sb_to_client(sb);
dout("get_sb got existing client %p\n", client); dout("get_sb got existing client %p\n", client);
} else { } else {
dout("get_sb using new client %p\n", client); dout("get_sb using new client %p\n", client);

Просмотреть файл

@ -160,12 +160,6 @@ struct ceph_client {
#endif #endif
}; };
static inline struct ceph_client *ceph_client(struct super_block *sb)
{
return sb->s_fs_info;
}
/* /*
* File i/o capability. This tracks shared state with the metadata * File i/o capability. This tracks shared state with the metadata
* server that allows us to cache or writeback attributes or to read * server that allows us to cache or writeback attributes or to read

Просмотреть файл

@ -616,7 +616,7 @@ out:
static int ceph_sync_setxattr(struct dentry *dentry, const char *name, static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
const char *value, size_t size, int flags) const char *value, size_t size, int flags)
{ {
struct ceph_client *client = ceph_client(dentry->d_sb); struct ceph_client *client = ceph_sb_to_client(dentry->d_sb);
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct inode *parent_inode = dentry->d_parent->d_inode; struct inode *parent_inode = dentry->d_parent->d_inode;
@ -773,7 +773,7 @@ out:
static int ceph_send_removexattr(struct dentry *dentry, const char *name) static int ceph_send_removexattr(struct dentry *dentry, const char *name)
{ {
struct ceph_client *client = ceph_client(dentry->d_sb); struct ceph_client *client = ceph_sb_to_client(dentry->d_sb);
struct ceph_mds_client *mdsc = &client->mdsc; struct ceph_mds_client *mdsc = &client->mdsc;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
struct inode *parent_inode = dentry->d_parent->d_inode; struct inode *parent_inode = dentry->d_parent->d_inode;