aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCheng Renquan <crquan@gmail.com>2010-03-26 05:40:33 -0400
committerSage Weil <sage@newdream.net>2010-05-17 18:25:17 -0400
commit640ef79d27c81b7a3265a344ec1d25644dd463ad (patch)
treef5632a0b2a2f6cef7c6f3a513bbb6020d6ac694a
parent2d06eeb877581a7f53209af1582c5f66c799f0bd (diff)
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>
-rw-r--r--fs/ceph/addr.c2
-rw-r--r--fs/ceph/caps.c15
-rw-r--r--fs/ceph/dir.c10
-rw-r--r--fs/ceph/export.c2
-rw-r--r--fs/ceph/file.c2
-rw-r--r--fs/ceph/inode.c10
-rw-r--r--fs/ceph/ioctl.c2
-rw-r--r--fs/ceph/snap.c2
-rw-r--r--fs/ceph/super.c8
-rw-r--r--fs/ceph/super.h6
-rw-r--r--fs/ceph/xattr.c4
11 files changed, 30 insertions, 33 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index caf76c7fa77c..d9c60b84949a 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -563,7 +563,7 @@ static void writepages_finish(struct ceph_osd_request *req,
563 ceph_release_pages(req->r_pages, req->r_num_pages); 563 ceph_release_pages(req->r_pages, req->r_num_pages);
564 if (req->r_pages_from_pool) 564 if (req->r_pages_from_pool)
565 mempool_free(req->r_pages, 565 mempool_free(req->r_pages,
566 ceph_client(inode->i_sb)->wb_pagevec_pool); 566 ceph_sb_to_client(inode->i_sb)->wb_pagevec_pool);
567 else 567 else
568 kfree(req->r_pages); 568 kfree(req->r_pages);
569 ceph_osdc_put_request(req); 569 ceph_osdc_put_request(req);
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index d9400534b279..51fd39da1470 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -867,7 +867,8 @@ void __ceph_remove_cap(struct ceph_cap *cap)
867{ 867{
868 struct ceph_mds_session *session = cap->session; 868 struct ceph_mds_session *session = cap->session;
869 struct ceph_inode_info *ci = cap->ci; 869 struct ceph_inode_info *ci = cap->ci;
870 struct ceph_mds_client *mdsc = &ceph_client(ci->vfs_inode.i_sb)->mdsc; 870 struct ceph_mds_client *mdsc =
871 &ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
871 int removed = 0; 872 int removed = 0;
872 873
873 dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode); 874 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)
1298 */ 1299 */
1299void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) 1300void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask)
1300{ 1301{
1301 struct ceph_mds_client *mdsc = &ceph_client(ci->vfs_inode.i_sb)->mdsc; 1302 struct ceph_mds_client *mdsc =
1303 &ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
1302 struct inode *inode = &ci->vfs_inode; 1304 struct inode *inode = &ci->vfs_inode;
1303 int was = ci->i_dirty_caps; 1305 int was = ci->i_dirty_caps;
1304 int dirty = 0; 1306 int dirty = 0;
@@ -1336,7 +1338,7 @@ void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask)
1336static int __mark_caps_flushing(struct inode *inode, 1338static int __mark_caps_flushing(struct inode *inode,
1337 struct ceph_mds_session *session) 1339 struct ceph_mds_session *session)
1338{ 1340{
1339 struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; 1341 struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
1340 struct ceph_inode_info *ci = ceph_inode(inode); 1342 struct ceph_inode_info *ci = ceph_inode(inode);
1341 int flushing; 1343 int flushing;
1342 1344
@@ -1663,7 +1665,7 @@ ack:
1663static int try_flush_caps(struct inode *inode, struct ceph_mds_session *session, 1665static int try_flush_caps(struct inode *inode, struct ceph_mds_session *session,
1664 unsigned *flush_tid) 1666 unsigned *flush_tid)
1665{ 1667{
1666 struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; 1668 struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
1667 struct ceph_inode_info *ci = ceph_inode(inode); 1669 struct ceph_inode_info *ci = ceph_inode(inode);
1668 int unlock_session = session ? 0 : 1; 1670 int unlock_session = session ? 0 : 1;
1669 int flushing = 0; 1671 int flushing = 0;
@@ -1829,7 +1831,8 @@ int ceph_write_inode(struct inode *inode, struct writeback_control *wbc)
1829 err = wait_event_interruptible(ci->i_cap_wq, 1831 err = wait_event_interruptible(ci->i_cap_wq,
1830 caps_are_flushed(inode, flush_tid)); 1832 caps_are_flushed(inode, flush_tid));
1831 } else { 1833 } else {
1832 struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; 1834 struct ceph_mds_client *mdsc =
1835 &ceph_sb_to_client(inode->i_sb)->mdsc;
1833 1836
1834 spin_lock(&inode->i_lock); 1837 spin_lock(&inode->i_lock);
1835 if (__ceph_caps_dirty(ci)) 1838 if (__ceph_caps_dirty(ci))
@@ -2411,7 +2414,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,
2411 __releases(inode->i_lock) 2414 __releases(inode->i_lock)
2412{ 2415{
2413 struct ceph_inode_info *ci = ceph_inode(inode); 2416 struct ceph_inode_info *ci = ceph_inode(inode);
2414 struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; 2417 struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
2415 unsigned seq = le32_to_cpu(m->seq); 2418 unsigned seq = le32_to_cpu(m->seq);
2416 int dirty = le32_to_cpu(m->dirty); 2419 int dirty = le32_to_cpu(m->dirty);
2417 int cleaned = 0; 2420 int cleaned = 0;
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 4b1a7a4bae0b..33feac75c532 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -478,7 +478,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin)
478struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, 478struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
479 struct dentry *dentry, int err) 479 struct dentry *dentry, int err)
480{ 480{
481 struct ceph_client *client = ceph_client(dentry->d_sb); 481 struct ceph_client *client = ceph_sb_to_client(dentry->d_sb);
482 struct inode *parent = dentry->d_parent->d_inode; 482 struct inode *parent = dentry->d_parent->d_inode;
483 483
484 /* .snap dir? */ 484 /* .snap dir? */
@@ -1059,7 +1059,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
1059 struct ceph_inode_info *ci = ceph_inode(inode); 1059 struct ceph_inode_info *ci = ceph_inode(inode);
1060 int left; 1060 int left;
1061 1061
1062 if (!ceph_test_opt(ceph_client(inode->i_sb), DIRSTAT)) 1062 if (!ceph_test_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT))
1063 return -EISDIR; 1063 return -EISDIR;
1064 1064
1065 if (!cf->dir_info) { 1065 if (!cf->dir_info) {
@@ -1161,7 +1161,7 @@ void ceph_dentry_lru_add(struct dentry *dn)
1161 dout("dentry_lru_add %p %p '%.*s'\n", di, dn, 1161 dout("dentry_lru_add %p %p '%.*s'\n", di, dn,
1162 dn->d_name.len, dn->d_name.name); 1162 dn->d_name.len, dn->d_name.name);
1163 if (di) { 1163 if (di) {
1164 mdsc = &ceph_client(dn->d_sb)->mdsc; 1164 mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc;
1165 spin_lock(&mdsc->dentry_lru_lock); 1165 spin_lock(&mdsc->dentry_lru_lock);
1166 list_add_tail(&di->lru, &mdsc->dentry_lru); 1166 list_add_tail(&di->lru, &mdsc->dentry_lru);
1167 mdsc->num_dentry++; 1167 mdsc->num_dentry++;
@@ -1177,7 +1177,7 @@ void ceph_dentry_lru_touch(struct dentry *dn)
1177 dout("dentry_lru_touch %p %p '%.*s'\n", di, dn, 1177 dout("dentry_lru_touch %p %p '%.*s'\n", di, dn,
1178 dn->d_name.len, dn->d_name.name); 1178 dn->d_name.len, dn->d_name.name);
1179 if (di) { 1179 if (di) {
1180 mdsc = &ceph_client(dn->d_sb)->mdsc; 1180 mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc;
1181 spin_lock(&mdsc->dentry_lru_lock); 1181 spin_lock(&mdsc->dentry_lru_lock);
1182 list_move_tail(&di->lru, &mdsc->dentry_lru); 1182 list_move_tail(&di->lru, &mdsc->dentry_lru);
1183 spin_unlock(&mdsc->dentry_lru_lock); 1183 spin_unlock(&mdsc->dentry_lru_lock);
@@ -1192,7 +1192,7 @@ void ceph_dentry_lru_del(struct dentry *dn)
1192 dout("dentry_lru_del %p %p '%.*s'\n", di, dn, 1192 dout("dentry_lru_del %p %p '%.*s'\n", di, dn,
1193 dn->d_name.len, dn->d_name.name); 1193 dn->d_name.len, dn->d_name.name);
1194 if (di) { 1194 if (di) {
1195 mdsc = &ceph_client(dn->d_sb)->mdsc; 1195 mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc;
1196 spin_lock(&mdsc->dentry_lru_lock); 1196 spin_lock(&mdsc->dentry_lru_lock);
1197 list_del_init(&di->lru); 1197 list_del_init(&di->lru);
1198 mdsc->num_dentry--; 1198 mdsc->num_dentry--;
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 9d67572fb328..15683905a7b6 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -115,7 +115,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
115static struct dentry *__cfh_to_dentry(struct super_block *sb, 115static struct dentry *__cfh_to_dentry(struct super_block *sb,
116 struct ceph_nfs_confh *cfh) 116 struct ceph_nfs_confh *cfh)
117{ 117{
118 struct ceph_mds_client *mdsc = &ceph_client(sb)->mdsc; 118 struct ceph_mds_client *mdsc = &ceph_sb_to_client(sb)->mdsc;
119 struct inode *inode; 119 struct inode *inode;
120 struct dentry *dentry; 120 struct dentry *dentry;
121 struct ceph_vino vino; 121 struct ceph_vino vino;
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 6230c3de1f06..834d2b83834a 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -809,7 +809,7 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
809 struct file *file = iocb->ki_filp; 809 struct file *file = iocb->ki_filp;
810 struct inode *inode = file->f_dentry->d_inode; 810 struct inode *inode = file->f_dentry->d_inode;
811 struct ceph_inode_info *ci = ceph_inode(inode); 811 struct ceph_inode_info *ci = ceph_inode(inode);
812 struct ceph_osd_client *osdc = &ceph_client(inode->i_sb)->osdc; 812 struct ceph_osd_client *osdc = &ceph_sb_to_client(inode->i_sb)->osdc;
813 loff_t endoff = pos + iov->iov_len; 813 loff_t endoff = pos + iov->iov_len;
814 int got = 0; 814 int got = 0;
815 int ret, err; 815 int ret, err;
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 220a2aec0545..ef917232cf37 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -384,7 +384,7 @@ void ceph_destroy_inode(struct inode *inode)
384 */ 384 */
385 if (ci->i_snap_realm) { 385 if (ci->i_snap_realm) {
386 struct ceph_mds_client *mdsc = 386 struct ceph_mds_client *mdsc =
387 &ceph_client(ci->vfs_inode.i_sb)->mdsc; 387 &ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
388 struct ceph_snap_realm *realm = ci->i_snap_realm; 388 struct ceph_snap_realm *realm = ci->i_snap_realm;
389 389
390 dout(" dropping residual ref to snap realm %p\n", realm); 390 dout(" dropping residual ref to snap realm %p\n", realm);
@@ -623,7 +623,7 @@ static int fill_inode(struct inode *inode,
623 623
624 inode->i_mapping->a_ops = &ceph_aops; 624 inode->i_mapping->a_ops = &ceph_aops;
625 inode->i_mapping->backing_dev_info = 625 inode->i_mapping->backing_dev_info =
626 &ceph_client(inode->i_sb)->backing_dev_info; 626 &ceph_sb_to_client(inode->i_sb)->backing_dev_info;
627 627
628 switch (inode->i_mode & S_IFMT) { 628 switch (inode->i_mode & S_IFMT) {
629 case S_IFIFO: 629 case S_IFIFO:
@@ -681,7 +681,7 @@ static int fill_inode(struct inode *inode,
681 } 681 }
682 682
683 /* it may be better to set st_size in getattr instead? */ 683 /* it may be better to set st_size in getattr instead? */
684 if (ceph_test_opt(ceph_client(inode->i_sb), RBYTES)) 684 if (ceph_test_opt(ceph_sb_to_client(inode->i_sb), RBYTES))
685 inode->i_size = ci->i_rbytes; 685 inode->i_size = ci->i_rbytes;
686 break; 686 break;
687 default: 687 default:
@@ -1438,7 +1438,7 @@ void ceph_queue_vmtruncate(struct inode *inode)
1438{ 1438{
1439 struct ceph_inode_info *ci = ceph_inode(inode); 1439 struct ceph_inode_info *ci = ceph_inode(inode);
1440 1440
1441 if (queue_work(ceph_client(inode->i_sb)->trunc_wq, 1441 if (queue_work(ceph_sb_to_client(inode->i_sb)->trunc_wq,
1442 &ci->i_vmtruncate_work)) { 1442 &ci->i_vmtruncate_work)) {
1443 dout("ceph_queue_vmtruncate %p\n", inode); 1443 dout("ceph_queue_vmtruncate %p\n", inode);
1444 igrab(inode); 1444 igrab(inode);
@@ -1527,7 +1527,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
1527 struct inode *parent_inode = dentry->d_parent->d_inode; 1527 struct inode *parent_inode = dentry->d_parent->d_inode;
1528 const unsigned int ia_valid = attr->ia_valid; 1528 const unsigned int ia_valid = attr->ia_valid;
1529 struct ceph_mds_request *req; 1529 struct ceph_mds_request *req;
1530 struct ceph_mds_client *mdsc = &ceph_client(dentry->d_sb)->mdsc; 1530 struct ceph_mds_client *mdsc = &ceph_sb_to_client(dentry->d_sb)->mdsc;
1531 int issued; 1531 int issued;
1532 int release = 0, dirtied = 0; 1532 int release = 0, dirtied = 0;
1533 int mask = 0; 1533 int mask = 0;
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
index 8a5bcae62846..d085f07756b4 100644
--- a/fs/ceph/ioctl.c
+++ b/fs/ceph/ioctl.c
@@ -98,7 +98,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
98 struct ceph_ioctl_dataloc dl; 98 struct ceph_ioctl_dataloc dl;
99 struct inode *inode = file->f_dentry->d_inode; 99 struct inode *inode = file->f_dentry->d_inode;
100 struct ceph_inode_info *ci = ceph_inode(inode); 100 struct ceph_inode_info *ci = ceph_inode(inode);
101 struct ceph_osd_client *osdc = &ceph_client(inode->i_sb)->osdc; 101 struct ceph_osd_client *osdc = &ceph_sb_to_client(inode->i_sb)->osdc;
102 u64 len = 1, olen; 102 u64 len = 1, olen;
103 u64 tmp; 103 u64 tmp;
104 struct ceph_object_layout ol; 104 struct ceph_object_layout ol;
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index d5114db70453..c0b26b6badba 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -512,7 +512,7 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
512 struct ceph_cap_snap *capsnap) 512 struct ceph_cap_snap *capsnap)
513{ 513{
514 struct inode *inode = &ci->vfs_inode; 514 struct inode *inode = &ci->vfs_inode;
515 struct ceph_mds_client *mdsc = &ceph_client(inode->i_sb)->mdsc; 515 struct ceph_mds_client *mdsc = &ceph_sb_to_client(inode->i_sb)->mdsc;
516 516
517 BUG_ON(capsnap->writing); 517 BUG_ON(capsnap->writing);
518 capsnap->size = inode->i_size; 518 capsnap->size = inode->i_size;
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 110857ba9269..93ad169a6ae1 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -107,8 +107,8 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
107static int ceph_syncfs(struct super_block *sb, int wait) 107static int ceph_syncfs(struct super_block *sb, int wait)
108{ 108{
109 dout("sync_fs %d\n", wait); 109 dout("sync_fs %d\n", wait);
110 ceph_osdc_sync(&ceph_client(sb)->osdc); 110 ceph_osdc_sync(&ceph_sb_to_client(sb)->osdc);
111 ceph_mdsc_sync(&ceph_client(sb)->mdsc); 111 ceph_mdsc_sync(&ceph_sb_to_client(sb)->mdsc);
112 dout("sync_fs %d done\n", wait); 112 dout("sync_fs %d done\n", wait);
113 return 0; 113 return 0;
114} 114}
@@ -932,9 +932,9 @@ static int ceph_get_sb(struct file_system_type *fs_type,
932 goto out; 932 goto out;
933 } 933 }
934 934
935 if (ceph_client(sb) != client) { 935 if (ceph_sb_to_client(sb) != client) {
936 ceph_destroy_client(client); 936 ceph_destroy_client(client);
937 client = ceph_client(sb); 937 client = ceph_sb_to_client(sb);
938 dout("get_sb got existing client %p\n", client); 938 dout("get_sb got existing client %p\n", client);
939 } else { 939 } else {
940 dout("get_sb using new client %p\n", client); 940 dout("get_sb using new client %p\n", client);
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index cfe3b0834d54..51b3ff238454 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -160,12 +160,6 @@ struct ceph_client {
160#endif 160#endif
161}; 161};
162 162
163static inline struct ceph_client *ceph_client(struct super_block *sb)
164{
165 return sb->s_fs_info;
166}
167
168
169/* 163/*
170 * File i/o capability. This tracks shared state with the metadata 164 * File i/o capability. This tracks shared state with the metadata
171 * server that allows us to cache or writeback attributes or to read 165 * server that allows us to cache or writeback attributes or to read
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index d940d14f6922..3b4c2620030a 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -616,7 +616,7 @@ out:
616static int ceph_sync_setxattr(struct dentry *dentry, const char *name, 616static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
617 const char *value, size_t size, int flags) 617 const char *value, size_t size, int flags)
618{ 618{
619 struct ceph_client *client = ceph_client(dentry->d_sb); 619 struct ceph_client *client = ceph_sb_to_client(dentry->d_sb);
620 struct inode *inode = dentry->d_inode; 620 struct inode *inode = dentry->d_inode;
621 struct ceph_inode_info *ci = ceph_inode(inode); 621 struct ceph_inode_info *ci = ceph_inode(inode);
622 struct inode *parent_inode = dentry->d_parent->d_inode; 622 struct inode *parent_inode = dentry->d_parent->d_inode;
@@ -773,7 +773,7 @@ out:
773 773
774static int ceph_send_removexattr(struct dentry *dentry, const char *name) 774static int ceph_send_removexattr(struct dentry *dentry, const char *name)
775{ 775{
776 struct ceph_client *client = ceph_client(dentry->d_sb); 776 struct ceph_client *client = ceph_sb_to_client(dentry->d_sb);
777 struct ceph_mds_client *mdsc = &client->mdsc; 777 struct ceph_mds_client *mdsc = &client->mdsc;
778 struct inode *inode = dentry->d_inode; 778 struct inode *inode = dentry->d_inode;
779 struct inode *parent_inode = dentry->d_parent->d_inode; 779 struct inode *parent_inode = dentry->d_parent->d_inode;