Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Zhang Zhuoyu and committed by
Ilya Dryomov
3b33f692 224a7542

+9 -9
+1 -1
fs/ceph/cache.c
··· 236 236 unlock_page(page); 237 237 } 238 238 239 - static inline int cache_valid(struct ceph_inode_info *ci) 239 + static inline bool cache_valid(struct ceph_inode_info *ci) 240 240 { 241 241 return ((ceph_caps_issued(ci) & CEPH_CAP_FILE_CACHE) && 242 242 (ci->i_fscache_gen == ci->i_rdcache_gen));
+1 -1
fs/ceph/dir.c
··· 710 710 return dentry; 711 711 } 712 712 713 - static int is_root_ceph_dentry(struct inode *inode, struct dentry *dentry) 713 + static bool is_root_ceph_dentry(struct inode *inode, struct dentry *dentry) 714 714 { 715 715 return ceph_ino(inode) == CEPH_INO_ROOT && 716 716 strncmp(dentry->d_name.name, ".ceph", 5) == 0;
+2 -2
include/linux/ceph/ceph_frag.h
··· 51 51 return ceph_frag_make(newbits, 52 52 ceph_frag_value(f) | (i << (24 - newbits))); 53 53 } 54 - static inline int ceph_frag_is_leftmost(__u32 f) 54 + static inline bool ceph_frag_is_leftmost(__u32 f) 55 55 { 56 56 return ceph_frag_value(f) == 0; 57 57 } 58 - static inline int ceph_frag_is_rightmost(__u32 f) 58 + static inline bool ceph_frag_is_rightmost(__u32 f) 59 59 { 60 60 return ceph_frag_value(f) == ceph_frag_mask(f); 61 61 }
+1 -1
include/linux/ceph/decode.h
··· 47 47 /* 48 48 * bounds check input. 49 49 */ 50 - static inline int ceph_has_room(void **p, void *end, size_t n) 50 + static inline bool ceph_has_room(void **p, void *end, size_t n) 51 51 { 52 52 return end >= *p && n <= end - *p; 53 53 }
+3 -3
include/linux/ceph/osdmap.h
··· 172 172 int crush_scratch_ary[CEPH_PG_MAX_SIZE * 3]; 173 173 }; 174 174 175 - static inline int ceph_osd_exists(struct ceph_osdmap *map, int osd) 175 + static inline bool ceph_osd_exists(struct ceph_osdmap *map, int osd) 176 176 { 177 177 return osd >= 0 && osd < map->max_osd && 178 178 (map->osd_state[osd] & CEPH_OSD_EXISTS); 179 179 } 180 180 181 - static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) 181 + static inline bool ceph_osd_is_up(struct ceph_osdmap *map, int osd) 182 182 { 183 183 return ceph_osd_exists(map, osd) && 184 184 (map->osd_state[osd] & CEPH_OSD_UP); 185 185 } 186 186 187 - static inline int ceph_osd_is_down(struct ceph_osdmap *map, int osd) 187 + static inline bool ceph_osd_is_down(struct ceph_osdmap *map, int osd) 188 188 { 189 189 return !ceph_osd_is_up(map, osd); 190 190 }
+1 -1
net/ceph/ceph_common.c
··· 651 651 /* 652 652 * true if we have the mon map (and have thus joined the cluster) 653 653 */ 654 - static int have_mon_and_osd_map(struct ceph_client *client) 654 + static bool have_mon_and_osd_map(struct ceph_client *client) 655 655 { 656 656 return client->monc.monmap && client->monc.monmap->epoch && 657 657 client->osdc.osdmap && client->osdc.osdmap->epoch;