diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2016-02-16 09:00:24 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-03-25 13:51:52 -0400 |
commit | 34b759b4a22b0acb82423389a24699357798cf3c (patch) | |
tree | 02c1f45f274762ab91fd180e928aedb93612c5a5 | |
parent | ce4355932a9412e0519e70fb1d03d88e39cd621a (diff) |
ceph: kill ceph_empty_snapc
ceph_empty_snapc->num_snaps == 0 at all times. Passing such a snapc to
ceph_osdc_alloc_request() (possibly through ceph_osdc_new_request()) is
equivalent to passing NULL, as ceph_osdc_alloc_request() uses it only
for sizing the request message.
Further, in all four cases the subsequent ceph_osdc_build_request() is
passed NULL for snapc, meaning that 0 is encoded for seq and num_snaps
and making ceph_empty_snapc entirely useless. The two cases where it
actually mattered were removed in commits 860560904962 ("ceph: avoid
sending unnessesary FLUSHSNAP message") and 23078637e054 ("ceph: fix
queuing inode to mdsdir's snaprealm").
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Yan, Zheng <zyan@redhat.com>
-rw-r--r-- | fs/ceph/addr.c | 13 | ||||
-rw-r--r-- | fs/ceph/snap.c | 16 | ||||
-rw-r--r-- | fs/ceph/super.c | 8 | ||||
-rw-r--r-- | fs/ceph/super.h | 3 |
4 files changed, 6 insertions, 34 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index c9f305089981..888674c311c5 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -1609,7 +1609,7 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page) | |||
1609 | ceph_vino(inode), 0, &len, 0, 1, | 1609 | ceph_vino(inode), 0, &len, 0, 1, |
1610 | CEPH_OSD_OP_CREATE, | 1610 | CEPH_OSD_OP_CREATE, |
1611 | CEPH_OSD_FLAG_ONDISK | CEPH_OSD_FLAG_WRITE, | 1611 | CEPH_OSD_FLAG_ONDISK | CEPH_OSD_FLAG_WRITE, |
1612 | ceph_empty_snapc, 0, 0, false); | 1612 | NULL, 0, 0, false); |
1613 | if (IS_ERR(req)) { | 1613 | if (IS_ERR(req)) { |
1614 | err = PTR_ERR(req); | 1614 | err = PTR_ERR(req); |
1615 | goto out; | 1615 | goto out; |
@@ -1627,9 +1627,8 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page) | |||
1627 | ceph_vino(inode), 0, &len, 1, 3, | 1627 | ceph_vino(inode), 0, &len, 1, 3, |
1628 | CEPH_OSD_OP_WRITE, | 1628 | CEPH_OSD_OP_WRITE, |
1629 | CEPH_OSD_FLAG_ONDISK | CEPH_OSD_FLAG_WRITE, | 1629 | CEPH_OSD_FLAG_ONDISK | CEPH_OSD_FLAG_WRITE, |
1630 | ceph_empty_snapc, | 1630 | NULL, ci->i_truncate_seq, |
1631 | ci->i_truncate_seq, ci->i_truncate_size, | 1631 | ci->i_truncate_size, false); |
1632 | false); | ||
1633 | if (IS_ERR(req)) { | 1632 | if (IS_ERR(req)) { |
1634 | err = PTR_ERR(req); | 1633 | err = PTR_ERR(req); |
1635 | goto out; | 1634 | goto out; |
@@ -1750,8 +1749,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci, u32 pool) | |||
1750 | goto out; | 1749 | goto out; |
1751 | } | 1750 | } |
1752 | 1751 | ||
1753 | rd_req = ceph_osdc_alloc_request(&fsc->client->osdc, | 1752 | rd_req = ceph_osdc_alloc_request(&fsc->client->osdc, NULL, |
1754 | ceph_empty_snapc, | ||
1755 | 1, false, GFP_NOFS); | 1753 | 1, false, GFP_NOFS); |
1756 | if (!rd_req) { | 1754 | if (!rd_req) { |
1757 | err = -ENOMEM; | 1755 | err = -ENOMEM; |
@@ -1765,8 +1763,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci, u32 pool) | |||
1765 | "%llx.00000000", ci->i_vino.ino); | 1763 | "%llx.00000000", ci->i_vino.ino); |
1766 | rd_req->r_base_oid.name_len = strlen(rd_req->r_base_oid.name); | 1764 | rd_req->r_base_oid.name_len = strlen(rd_req->r_base_oid.name); |
1767 | 1765 | ||
1768 | wr_req = ceph_osdc_alloc_request(&fsc->client->osdc, | 1766 | wr_req = ceph_osdc_alloc_request(&fsc->client->osdc, NULL, |
1769 | ceph_empty_snapc, | ||
1770 | 1, false, GFP_NOFS); | 1767 | 1, false, GFP_NOFS); |
1771 | if (!wr_req) { | 1768 | if (!wr_req) { |
1772 | err = -ENOMEM; | 1769 | err = -ENOMEM; |
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index 4aa7122a8d38..9caaa7ffc93f 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c | |||
@@ -296,8 +296,6 @@ static int cmpu64_rev(const void *a, const void *b) | |||
296 | } | 296 | } |
297 | 297 | ||
298 | 298 | ||
299 | struct ceph_snap_context *ceph_empty_snapc; | ||
300 | |||
301 | /* | 299 | /* |
302 | * build the snap context for a given realm. | 300 | * build the snap context for a given realm. |
303 | */ | 301 | */ |
@@ -987,17 +985,3 @@ out: | |||
987 | up_write(&mdsc->snap_rwsem); | 985 | up_write(&mdsc->snap_rwsem); |
988 | return; | 986 | return; |
989 | } | 987 | } |
990 | |||
991 | int __init ceph_snap_init(void) | ||
992 | { | ||
993 | ceph_empty_snapc = ceph_create_snap_context(0, GFP_NOFS); | ||
994 | if (!ceph_empty_snapc) | ||
995 | return -ENOMEM; | ||
996 | ceph_empty_snapc->seq = 1; | ||
997 | return 0; | ||
998 | } | ||
999 | |||
1000 | void ceph_snap_exit(void) | ||
1001 | { | ||
1002 | ceph_put_snap_context(ceph_empty_snapc); | ||
1003 | } | ||
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index e82acc6f3ac3..715282a92a07 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -1042,19 +1042,14 @@ static int __init init_ceph(void) | |||
1042 | 1042 | ||
1043 | ceph_flock_init(); | 1043 | ceph_flock_init(); |
1044 | ceph_xattr_init(); | 1044 | ceph_xattr_init(); |
1045 | ret = ceph_snap_init(); | ||
1046 | if (ret) | ||
1047 | goto out_xattr; | ||
1048 | ret = register_filesystem(&ceph_fs_type); | 1045 | ret = register_filesystem(&ceph_fs_type); |
1049 | if (ret) | 1046 | if (ret) |
1050 | goto out_snap; | 1047 | goto out_xattr; |
1051 | 1048 | ||
1052 | pr_info("loaded (mds proto %d)\n", CEPH_MDSC_PROTOCOL); | 1049 | pr_info("loaded (mds proto %d)\n", CEPH_MDSC_PROTOCOL); |
1053 | 1050 | ||
1054 | return 0; | 1051 | return 0; |
1055 | 1052 | ||
1056 | out_snap: | ||
1057 | ceph_snap_exit(); | ||
1058 | out_xattr: | 1053 | out_xattr: |
1059 | ceph_xattr_exit(); | 1054 | ceph_xattr_exit(); |
1060 | destroy_caches(); | 1055 | destroy_caches(); |
@@ -1066,7 +1061,6 @@ static void __exit exit_ceph(void) | |||
1066 | { | 1061 | { |
1067 | dout("exit_ceph\n"); | 1062 | dout("exit_ceph\n"); |
1068 | unregister_filesystem(&ceph_fs_type); | 1063 | unregister_filesystem(&ceph_fs_type); |
1069 | ceph_snap_exit(); | ||
1070 | ceph_xattr_exit(); | 1064 | ceph_xattr_exit(); |
1071 | destroy_caches(); | 1065 | destroy_caches(); |
1072 | } | 1066 | } |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index d4425b172bb6..57ac43d64322 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -720,7 +720,6 @@ static inline int default_congestion_kb(void) | |||
720 | 720 | ||
721 | 721 | ||
722 | /* snap.c */ | 722 | /* snap.c */ |
723 | extern struct ceph_snap_context *ceph_empty_snapc; | ||
724 | struct ceph_snap_realm *ceph_lookup_snap_realm(struct ceph_mds_client *mdsc, | 723 | struct ceph_snap_realm *ceph_lookup_snap_realm(struct ceph_mds_client *mdsc, |
725 | u64 ino); | 724 | u64 ino); |
726 | extern void ceph_get_snap_realm(struct ceph_mds_client *mdsc, | 725 | extern void ceph_get_snap_realm(struct ceph_mds_client *mdsc, |
@@ -737,8 +736,6 @@ extern void ceph_queue_cap_snap(struct ceph_inode_info *ci); | |||
737 | extern int __ceph_finish_cap_snap(struct ceph_inode_info *ci, | 736 | extern int __ceph_finish_cap_snap(struct ceph_inode_info *ci, |
738 | struct ceph_cap_snap *capsnap); | 737 | struct ceph_cap_snap *capsnap); |
739 | extern void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc); | 738 | extern void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc); |
740 | extern int ceph_snap_init(void); | ||
741 | extern void ceph_snap_exit(void); | ||
742 | 739 | ||
743 | /* | 740 | /* |
744 | * a cap_snap is "pending" if it is still awaiting an in-progress | 741 | * a cap_snap is "pending" if it is still awaiting an in-progress |