Skip to content

Commit

Permalink
ceph: make logical calculation functions return bool
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Zhang Zhuoyu authored and idryomov committed May 25, 2016
1 parent 224a754 commit 3b33f69
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion fs/ceph/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static void ceph_vfs_readpage_complete_unlock(struct page *page, void *data, int
unlock_page(page);
}

static inline int cache_valid(struct ceph_inode_info *ci)
static inline bool cache_valid(struct ceph_inode_info *ci)
{
return ((ceph_caps_issued(ci) & CEPH_CAP_FILE_CACHE) &&
(ci->i_fscache_gen == ci->i_rdcache_gen));
Expand Down
2 changes: 1 addition & 1 deletion fs/ceph/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
return dentry;
}

static int is_root_ceph_dentry(struct inode *inode, struct dentry *dentry)
static bool is_root_ceph_dentry(struct inode *inode, struct dentry *dentry)
{
return ceph_ino(inode) == CEPH_INO_ROOT &&
strncmp(dentry->d_name.name, ".ceph", 5) == 0;
Expand Down
4 changes: 2 additions & 2 deletions include/linux/ceph/ceph_frag.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ static inline __u32 ceph_frag_make_child(__u32 f, int by, int i)
return ceph_frag_make(newbits,
ceph_frag_value(f) | (i << (24 - newbits)));
}
static inline int ceph_frag_is_leftmost(__u32 f)
static inline bool ceph_frag_is_leftmost(__u32 f)
{
return ceph_frag_value(f) == 0;
}
static inline int ceph_frag_is_rightmost(__u32 f)
static inline bool ceph_frag_is_rightmost(__u32 f)
{
return ceph_frag_value(f) == ceph_frag_mask(f);
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/ceph/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static inline void ceph_decode_copy(void **p, void *pv, size_t n)
/*
* bounds check input.
*/
static inline int ceph_has_room(void **p, void *end, size_t n)
static inline bool ceph_has_room(void **p, void *end, size_t n)
{
return end >= *p && n <= end - *p;
}
Expand Down
6 changes: 3 additions & 3 deletions include/linux/ceph/osdmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,19 @@ struct ceph_osdmap {
int crush_scratch_ary[CEPH_PG_MAX_SIZE * 3];
};

static inline int ceph_osd_exists(struct ceph_osdmap *map, int osd)
static inline bool ceph_osd_exists(struct ceph_osdmap *map, int osd)
{
return osd >= 0 && osd < map->max_osd &&
(map->osd_state[osd] & CEPH_OSD_EXISTS);
}

static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd)
static inline bool ceph_osd_is_up(struct ceph_osdmap *map, int osd)
{
return ceph_osd_exists(map, osd) &&
(map->osd_state[osd] & CEPH_OSD_UP);
}

static inline int ceph_osd_is_down(struct ceph_osdmap *map, int osd)
static inline bool ceph_osd_is_down(struct ceph_osdmap *map, int osd)
{
return !ceph_osd_is_up(map, osd);
}
Expand Down
2 changes: 1 addition & 1 deletion net/ceph/ceph_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ EXPORT_SYMBOL(ceph_destroy_client);
/*
* true if we have the mon map (and have thus joined the cluster)
*/
static int have_mon_and_osd_map(struct ceph_client *client)
static bool have_mon_and_osd_map(struct ceph_client *client)
{
return client->monc.monmap && client->monc.monmap->epoch &&
client->osdc.osdmap && client->osdc.osdmap->epoch;
Expand Down

0 comments on commit 3b33f69

Please sign in to comment.