aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Zhuoyu <zhangzhuoyu@cmss.chinamobile.com>2016-03-25 05:18:39 -0400
committerIlya Dryomov <idryomov@gmail.com>2016-05-25 19:15:39 -0400
commit3b33f692c84c28cc8178aaeeb9264d82b48787f1 (patch)
treec2d56a816c39928e5c82b6fde4d233b800f2a8fb
parent224a7542b8fdde3cc7c600f8b0870c5541a9f678 (diff)
ceph: make logical calculation functions return bool
This patch makes serverl logical caculation functions return bool to improve readability due to these particular functions only using 0/1 as their return value. No functional change. Signed-off-by: Zhang Zhuoyu <zhangzhuoyu@cmss.chinamobile.com>
-rw-r--r--fs/ceph/cache.c2
-rw-r--r--fs/ceph/dir.c2
-rw-r--r--include/linux/ceph/ceph_frag.h4
-rw-r--r--include/linux/ceph/decode.h2
-rw-r--r--include/linux/ceph/osdmap.h6
-rw-r--r--net/ceph/ceph_common.c2
6 files changed, 9 insertions, 9 deletions
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c
index a351480dbabc..c052b5bf219b 100644
--- a/fs/ceph/cache.c
+++ b/fs/ceph/cache.c
@@ -236,7 +236,7 @@ static void ceph_vfs_readpage_complete_unlock(struct page *page, void *data, int
236 unlock_page(page); 236 unlock_page(page);
237} 237}
238 238
239static inline int cache_valid(struct ceph_inode_info *ci) 239static inline bool cache_valid(struct ceph_inode_info *ci)
240{ 240{
241 return ((ceph_caps_issued(ci) & CEPH_CAP_FILE_CACHE) && 241 return ((ceph_caps_issued(ci) & CEPH_CAP_FILE_CACHE) &&
242 (ci->i_fscache_gen == ci->i_rdcache_gen)); 242 (ci->i_fscache_gen == ci->i_rdcache_gen));
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 4850c3624a87..f6279a1bd6ec 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -710,7 +710,7 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
710 return dentry; 710 return dentry;
711} 711}
712 712
713static int is_root_ceph_dentry(struct inode *inode, struct dentry *dentry) 713static bool is_root_ceph_dentry(struct inode *inode, struct dentry *dentry)
714{ 714{
715 return ceph_ino(inode) == CEPH_INO_ROOT && 715 return ceph_ino(inode) == CEPH_INO_ROOT &&
716 strncmp(dentry->d_name.name, ".ceph", 5) == 0; 716 strncmp(dentry->d_name.name, ".ceph", 5) == 0;
diff --git a/include/linux/ceph/ceph_frag.h b/include/linux/ceph/ceph_frag.h
index b827e066e55a..146507df8650 100644
--- a/include/linux/ceph/ceph_frag.h
+++ b/include/linux/ceph/ceph_frag.h
@@ -51,11 +51,11 @@ static inline __u32 ceph_frag_make_child(__u32 f, int by, int i)
51 return ceph_frag_make(newbits, 51 return ceph_frag_make(newbits,
52 ceph_frag_value(f) | (i << (24 - newbits))); 52 ceph_frag_value(f) | (i << (24 - newbits)));
53} 53}
54static inline int ceph_frag_is_leftmost(__u32 f) 54static inline bool ceph_frag_is_leftmost(__u32 f)
55{ 55{
56 return ceph_frag_value(f) == 0; 56 return ceph_frag_value(f) == 0;
57} 57}
58static inline int ceph_frag_is_rightmost(__u32 f) 58static inline bool ceph_frag_is_rightmost(__u32 f)
59{ 59{
60 return ceph_frag_value(f) == ceph_frag_mask(f); 60 return ceph_frag_value(f) == ceph_frag_mask(f);
61} 61}
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index a6ef9cc267ec..19e9932f3e77 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -47,7 +47,7 @@ static inline void ceph_decode_copy(void **p, void *pv, size_t n)
47/* 47/*
48 * bounds check input. 48 * bounds check input.
49 */ 49 */
50static inline int ceph_has_room(void **p, void *end, size_t n) 50static inline bool ceph_has_room(void **p, void *end, size_t n)
51{ 51{
52 return end >= *p && n <= end - *p; 52 return end >= *p && n <= end - *p;
53} 53}
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 821e16fff39a..ddc426b22d81 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -172,19 +172,19 @@ struct ceph_osdmap {
172 int crush_scratch_ary[CEPH_PG_MAX_SIZE * 3]; 172 int crush_scratch_ary[CEPH_PG_MAX_SIZE * 3];
173}; 173};
174 174
175static inline int ceph_osd_exists(struct ceph_osdmap *map, int osd) 175static inline bool ceph_osd_exists(struct ceph_osdmap *map, int osd)
176{ 176{
177 return osd >= 0 && osd < map->max_osd && 177 return osd >= 0 && osd < map->max_osd &&
178 (map->osd_state[osd] & CEPH_OSD_EXISTS); 178 (map->osd_state[osd] & CEPH_OSD_EXISTS);
179} 179}
180 180
181static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) 181static inline bool ceph_osd_is_up(struct ceph_osdmap *map, int osd)
182{ 182{
183 return ceph_osd_exists(map, osd) && 183 return ceph_osd_exists(map, osd) &&
184 (map->osd_state[osd] & CEPH_OSD_UP); 184 (map->osd_state[osd] & CEPH_OSD_UP);
185} 185}
186 186
187static inline int ceph_osd_is_down(struct ceph_osdmap *map, int osd) 187static inline bool ceph_osd_is_down(struct ceph_osdmap *map, int osd)
188{ 188{
189 return !ceph_osd_is_up(map, osd); 189 return !ceph_osd_is_up(map, osd);
190} 190}
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index dcc18c6f7cf9..55d2bfee16d7 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -651,7 +651,7 @@ EXPORT_SYMBOL(ceph_destroy_client);
651/* 651/*
652 * true if we have the mon map (and have thus joined the cluster) 652 * true if we have the mon map (and have thus joined the cluster)
653 */ 653 */
654static int have_mon_and_osd_map(struct ceph_client *client) 654static bool have_mon_and_osd_map(struct ceph_client *client)
655{ 655{
656 return client->monc.monmap && client->monc.monmap->epoch && 656 return client->monc.monmap && client->monc.monmap->epoch &&
657 client->osdc.osdmap && client->osdc.osdmap->epoch; 657 client->osdc.osdmap && client->osdc.osdmap->epoch;