Skip to content

Commit 3b33f69

Browse files
Zhang Zhuoyuidryomov
authored andcommitted
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>
1 parent 224a754 commit 3b33f69

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

fs/ceph/cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static void ceph_vfs_readpage_complete_unlock(struct page *page, void *data, int
236236
unlock_page(page);
237237
}
238238

239-
static inline int cache_valid(struct ceph_inode_info *ci)
239+
static inline bool cache_valid(struct ceph_inode_info *ci)
240240
{
241241
return ((ceph_caps_issued(ci) & CEPH_CAP_FILE_CACHE) &&
242242
(ci->i_fscache_gen == ci->i_rdcache_gen));

fs/ceph/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
710710
return dentry;
711711
}
712712

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)
714714
{
715715
return ceph_ino(inode) == CEPH_INO_ROOT &&
716716
strncmp(dentry->d_name.name, ".ceph", 5) == 0;

include/linux/ceph/ceph_frag.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ static inline __u32 ceph_frag_make_child(__u32 f, int by, int i)
5151
return ceph_frag_make(newbits,
5252
ceph_frag_value(f) | (i << (24 - newbits)));
5353
}
54-
static inline int ceph_frag_is_leftmost(__u32 f)
54+
static inline bool ceph_frag_is_leftmost(__u32 f)
5555
{
5656
return ceph_frag_value(f) == 0;
5757
}
58-
static inline int ceph_frag_is_rightmost(__u32 f)
58+
static inline bool ceph_frag_is_rightmost(__u32 f)
5959
{
6060
return ceph_frag_value(f) == ceph_frag_mask(f);
6161
}

include/linux/ceph/decode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static inline void ceph_decode_copy(void **p, void *pv, size_t n)
4747
/*
4848
* bounds check input.
4949
*/
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)
5151
{
5252
return end >= *p && n <= end - *p;
5353
}

include/linux/ceph/osdmap.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,19 @@ struct ceph_osdmap {
172172
int crush_scratch_ary[CEPH_PG_MAX_SIZE * 3];
173173
};
174174

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)
176176
{
177177
return osd >= 0 && osd < map->max_osd &&
178178
(map->osd_state[osd] & CEPH_OSD_EXISTS);
179179
}
180180

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)
182182
{
183183
return ceph_osd_exists(map, osd) &&
184184
(map->osd_state[osd] & CEPH_OSD_UP);
185185
}
186186

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)
188188
{
189189
return !ceph_osd_is_up(map, osd);
190190
}

net/ceph/ceph_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ EXPORT_SYMBOL(ceph_destroy_client);
651651
/*
652652
* true if we have the mon map (and have thus joined the cluster)
653653
*/
654-
static int have_mon_and_osd_map(struct ceph_client *client)
654+
static bool have_mon_and_osd_map(struct ceph_client *client)
655655
{
656656
return client->monc.monmap && client->monc.monmap->epoch &&
657657
client->osdc.osdmap && client->osdc.osdmap->epoch;

0 commit comments

Comments
 (0)