From: Yehuda Sadeh Date: Wed, 15 Oct 2008 22:10:56 +0000 (-0700) Subject: kclient: sparse code cleanup X-Git-Tag: v0.5~302 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=835e371a74b6f4a92f7b2afc48df4130876f859f;p=ceph.git kclient: sparse code cleanup --- diff --git a/src/crush/crush.c b/src/crush/crush.c index 4e630b0c80d3..74b866766a10 100644 --- a/src/crush/crush.c +++ b/src/crush/crush.c @@ -33,7 +33,7 @@ void crush_calc_parents(struct crush_map *map) { int i, b, c; for (b=0; bmax_buckets; b++) { - if (map->buckets[b] == 0) continue; + if (map->buckets[b] == NULL) continue; for (i=0; ibuckets[b]->size; i++) { c = map->buckets[b]->items[i]; BUG_ON(c >= map->max_devices); @@ -85,7 +85,7 @@ void crush_destroy(struct crush_map *map) /* buckets */ if (map->buckets) { for (b=0; bmax_buckets; b++) { - if (map->buckets[b] == 0) continue; + if (map->buckets[b] == NULL) continue; switch (map->buckets[b]->alg) { case CRUSH_BUCKET_UNIFORM: crush_destroy_bucket_uniform((struct crush_bucket_uniform*)map->buckets[b]); @@ -107,7 +107,7 @@ void crush_destroy(struct crush_map *map) /* rules */ if (map->rules) { for (b=0; bmax_rules; b++) { - if (map->rules[b] == 0) continue; + if (map->rules[b] == NULL) continue; free(map->rules[b]); } free(map->rules); diff --git a/src/crush/mapper.c b/src/crush/mapper.c index 8af4276ac2fb..31d4cfc06783 100644 --- a/src/crush/mapper.c +++ b/src/crush/mapper.c @@ -14,7 +14,7 @@ -int crush_find_rule(struct crush_map *map, int pool, int type, int size) +static int crush_find_rule(struct crush_map *map, int pool, int type, int size) { int i; for (i = 0; i < map->max_rules; i++) { @@ -260,7 +260,7 @@ static int crush_choose(struct crush_map *map, !crush_choose(map, map->buckets[-1-item], x, 1, 0, out2+outpos, 0, - firstn, 0, 0)) + firstn, 0, NULL)) reject = 1; if (reject || collide) { @@ -287,7 +287,7 @@ static int crush_choose(struct crush_map *map, } -int crush_do_rule(struct crush_map *map, +static int crush_do_rule(struct crush_map *map, int ruleno, int x, int *result, int result_max, int force) /* -1 for none */ { diff --git a/src/kernel/caps.c b/src/kernel/caps.c index dc44634b14df..023a4c3cd9d0 100644 --- a/src/kernel/caps.c +++ b/src/kernel/caps.c @@ -30,7 +30,7 @@ static struct ceph_cap *__get_cap_for_mds(struct inode *inode, int mds) else return cap; } - return 0; + return NULL; } static void __insert_cap_node(struct ceph_inode_info *ci, @@ -38,7 +38,7 @@ static void __insert_cap_node(struct ceph_inode_info *ci, { struct rb_node **p = &ci->i_caps.rb_node; struct rb_node *parent = NULL; - struct ceph_cap *cap = 0; + struct ceph_cap *cap = NULL; while (*p) { parent = *p; @@ -79,7 +79,7 @@ int ceph_get_cap_mds(struct inode *inode) { int mds; spin_lock(&inode->i_lock); - mds = __ceph_get_cap_mds(ceph_inode(inode), 0); + mds = __ceph_get_cap_mds(ceph_inode(inode), NULL); spin_unlock(&inode->i_lock); return mds; } @@ -100,7 +100,7 @@ int ceph_add_cap(struct inode *inode, struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_cap *cap; int is_first = 0; - struct ceph_snap_realm *realm = 0; + struct ceph_snap_realm *realm = NULL; struct ceph_mds_client *mdsc = &ceph_inode_to_client(inode)->mdsc; if (snapblob_len) @@ -117,11 +117,11 @@ retry: if (!cap) { if (new_cap) { cap = new_cap; - new_cap = 0; + new_cap = NULL; } else { spin_unlock(&inode->i_lock); new_cap = kmalloc(sizeof(*cap), GFP_NOFS); - if (new_cap == 0) + if (new_cap == NULL) return -ENOMEM; goto retry; } @@ -217,7 +217,7 @@ int __ceph_remove_cap(struct ceph_cap *cap) /* remove from inode list */ rb_erase(&cap->ci_node, &ci->i_caps); - cap->session = 0; + cap->session = NULL; kfree(cap); @@ -247,7 +247,7 @@ void ceph_remove_cap(struct ceph_cap *cap) * caller holds i_lock * -> client->cap_delay_lock */ -void __ceph_cap_delay_requeue(struct ceph_mds_client *mdsc, +static void __ceph_cap_delay_requeue(struct ceph_mds_client *mdsc, struct ceph_inode_info *ci) { ci->i_hold_caps_until = round_jiffies(jiffies + HZ * 5); @@ -280,7 +280,7 @@ static void send_cap(struct ceph_mds_client *mdsc, __u64 ino, int op, " follows %lld size %llu\n", ceph_cap_op_name(op), ino, caps, wanted, seq, mseq, follows, size); - msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPS, sizeof(*fc), 0, 0, 0); + msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPS, sizeof(*fc), 0, 0, NULL); if (IS_ERR(msg)) return; @@ -319,7 +319,7 @@ void __ceph_flush_snaps(struct ceph_inode_info *ci) u64 time_warp_seq; u32 mseq; struct ceph_mds_client *mdsc = &ceph_inode_to_client(inode)->mdsc; - struct ceph_mds_session *session = 0; + struct ceph_mds_session *session = NULL; dout(10, "__flush_snaps %p\n", inode); retry: @@ -336,7 +336,7 @@ retry: dout(30, "oops, wrong session %p mutex\n", session); mutex_unlock(&session->s_mutex); ceph_put_mds_session(session); - session = 0; + session = NULL; } if (!session) { spin_unlock(&inode->i_lock); @@ -347,8 +347,8 @@ retry: dout(10, "inverting session/ino locks on %p\n", session); mutex_lock(&session->s_mutex); - spin_lock(&inode->i_lock); } + spin_lock(&inode->i_lock); goto retry; } @@ -394,7 +394,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int is_delayed) struct inode *inode = &ci->vfs_inode; struct ceph_cap *cap; int wanted, used; - struct ceph_mds_session *session = 0; /* if non-NULL, i hold s_mutex */ + struct ceph_mds_session *session = NULL; /* if non-NULL, i hold s_mutex */ int took_snap_rwsem = 0; /* true if mdsc->snap_rwsem held */ int revoking; int mds = -1; @@ -412,7 +412,7 @@ first: wanted = __ceph_caps_wanted(ci); used = __ceph_caps_used(ci); dout(10, "check_caps %p wanted %d used %d issued %d\n", - inode, wanted, used, __ceph_caps_issued(ci, 0)); + inode, wanted, used, __ceph_caps_issued(ci, NULL)); if (!is_delayed) __ceph_cap_delay_requeue(mdsc, ci); @@ -472,7 +472,7 @@ ack: if (session && session != cap->session) { dout(30, "oops, wrong session %p mutex\n", session); mutex_unlock(&session->s_mutex); - session = 0; + session = NULL; } if (!session) { session = cap->session; @@ -645,7 +645,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, last ? " LAST":""); } else { struct list_head *p; - struct ceph_cap_snap *capsnap = 0; + struct ceph_cap_snap *capsnap = NULL; list_for_each(p, &ci->i_cap_snaps) { capsnap = list_entry(p, struct ceph_cap_snap, ci_item); if (capsnap->context == snapc) { @@ -728,7 +728,7 @@ static int handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, cap->gen = session->s_cap_gen; /* size/ctime/mtime/atime? */ - issued = __ceph_caps_issued(ci, 0); + issued = __ceph_caps_issued(ci, NULL); ceph_decode_timespec(&mtime, &grant->mtime); ceph_decode_timespec(&atime, &grant->atime); ceph_decode_timespec(&ctime, &grant->ctime); @@ -947,7 +947,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, struct ceph_inode_info *ci = ceph_inode(inode); int mds = session->s_mds; unsigned mseq = le32_to_cpu(ex->migrate_seq); - struct ceph_cap *cap = 0, *t; + struct ceph_cap *cap = NULL, *t; struct rb_node *p; int was_last = 0; @@ -1065,7 +1065,7 @@ void ceph_handle_caps(struct ceph_mds_client *mdsc, if (!inode) { dout(10, " i don't have ino %llx, sending release\n", vino.ino); send_cap(mdsc, vino.ino, CEPH_CAP_OP_RELEASE, 0, 0, seq, - size, 0, 0, 0, 0, 0, 0, mds); + size, 0, 0, NULL, NULL, 0, 0, mds); goto no_inode; } @@ -1137,7 +1137,7 @@ int __ceph_send_cap(struct ceph_mds_client *mdsc, struct ceph_mds_session *session, struct ceph_cap *cap, int used, int wanted, - int flush_snap) + int flush_snap) __releases(cap->ci->vfs_inode->i_lock) { struct ceph_inode_info *ci = cap->ci; struct inode *inode = &ci->vfs_inode; diff --git a/src/kernel/export.c b/src/kernel/export.c index fc8e12822dbb..f595ae86ea74 100644 --- a/src/kernel/export.c +++ b/src/kernel/export.c @@ -55,7 +55,7 @@ static int ceph_encode_fh(struct dentry *dentry, __u32 *rawfh, int *max_len, return type; } -struct dentry *__fh_to_dentry(struct super_block *sb, +static struct dentry *__fh_to_dentry(struct super_block *sb, struct ceph_inopath_item *fh, int len) { struct ceph_mds_client *mdsc = &ceph_client(sb)->mdsc; @@ -75,7 +75,7 @@ struct dentry *__fh_to_dentry(struct super_block *sb, req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_FINDINODE, - len, (char *)fh, 0, 0, + len, (char *)fh, 0, NULL, NULL, USE_ANY_MDS); if (IS_ERR(req)) return ERR_PTR(PTR_ERR(req)); @@ -101,14 +101,14 @@ struct dentry *__fh_to_dentry(struct super_block *sb, } -struct dentry *ceph_fh_to_dentry(struct super_block *sb, struct fid *fid, +static struct dentry *ceph_fh_to_dentry(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) { u32 *fh = fid->raw; return __fh_to_dentry(sb, (struct ceph_inopath_item *)fh, fh_len/IPSZ); } -struct dentry *ceph_fh_to_parent(struct super_block *sb, struct fid *fid, +static struct dentry *ceph_fh_to_parent(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) { u32 *fh = fid->raw; diff --git a/src/kernel/inode.c b/src/kernel/inode.c index 83ecaa73f4d2..66c907279f58 100644 --- a/src/kernel/inode.c +++ b/src/kernel/inode.c @@ -18,7 +18,7 @@ int ceph_debug_inode = -1; #include "super.h" #include "decode.h" -const struct inode_operations ceph_symlink_iops; +static const struct inode_operations ceph_symlink_iops; /* * find or create an inode, given the ceph ino number @@ -77,7 +77,7 @@ const struct inode_operations ceph_file_iops = { /* * find/create a frag in the tree */ -struct ceph_inode_frag *__get_or_create_frag(struct ceph_inode_info *ci, u32 f) +static struct ceph_inode_frag *__get_or_create_frag(struct ceph_inode_info *ci, u32 f) { struct rb_node **p; struct rb_node *parent = NULL; @@ -310,7 +310,7 @@ int ceph_fill_inode(struct inode *inode, int issued; struct timespec mtime, atime, ctime; u32 nsplits; - void *xattr_data = 0; + void *xattr_data = NULL; int err = 0; dout(30, "fill_inode %p ino %llx.%llx v %llu had %llu\n", @@ -344,7 +344,7 @@ int ceph_fill_inode(struct inode *inode, ceph_decode_timespec(&atime, &info->atime); ceph_decode_timespec(&mtime, &info->mtime); ceph_decode_timespec(&ctime, &info->ctime); - issued = __ceph_caps_issued(ci, 0); + issued = __ceph_caps_issued(ci, NULL); ceph_fill_file_bits(inode, issued, le64_to_cpu(info->truncate_seq), le64_to_cpu(info->size), @@ -361,7 +361,7 @@ int ceph_fill_inode(struct inode *inode, kfree(ci->i_xattr_data); ci->i_xattr_len = iinfo->xattr_len; ci->i_xattr_data = xattr_data; - xattr_data = 0; + xattr_data = NULL; } if (ci->i_xattr_len) memcpy(ci->i_xattr_data, iinfo->xattr_data, @@ -511,7 +511,7 @@ int ceph_inode_lease_valid(struct inode *inode, int mask) /* EXCL cap counts for an ICONTENT lease... check caps? */ if ((mask & CEPH_LOCK_ICONTENT) && - __ceph_caps_issued(ci, 0) & CEPH_CAP_EXCL) { + __ceph_caps_issued(ci, NULL) & CEPH_CAP_EXCL) { dout(20, "lease_valid inode %p EXCL cap -> ICONTENT\n", inode); havemask |= CEPH_LOCK_ICONTENT; } @@ -753,7 +753,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, if (vino.ino == 1) { err = ceph_fill_inode(in, &rinfo->trace_in[0], rinfo->trace_numd ? - rinfo->trace_dir[0]:0); + rinfo->trace_dir[0]:NULL); if (err < 0) return err; if (rinfo->trace_numd == 0) @@ -770,7 +770,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, dname.name = rinfo->trace_dname[d]; dname.len = rinfo->trace_dname_len[d]; parent = dn; - dn = 0; + dn = NULL; dout(10, "fill_trace %d/%d parent %p inode %p: '%.*s'" " ic %d dmask %d\n", @@ -877,7 +877,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, dn, dn->d_name.len, dn->d_name.name); dput(dn); /* dn is dropped */ dn = req->r_old_dentry; /* use old_dentry */ - req->r_old_dentry = 0; + req->r_old_dentry = NULL; } /* attach proper inode */ @@ -921,7 +921,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, err = ceph_fill_inode(in, &rinfo->trace_in[d+1], rinfo->trace_numd <= d ? - rinfo->trace_dir[d+1]:0); + rinfo->trace_dir[d+1]:NULL); if (err < 0) { derr(30, "ceph_fill_inode badness\n"); d_delete(dn); @@ -964,7 +964,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, /* drop i_mutex */ if (req->r_locked_dir != parent->d_inode) mutex_unlock(&parent->d_inode->i_mutex); - in = 0; + in = NULL; break; @@ -984,7 +984,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, if (d+1 == rinfo->trace_numi) { if (dn && dn->d_inode) d_delete(dn); - in = 0; + in = NULL; break; } @@ -996,7 +996,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, if (IS_ERR(in)) { derr(30, "ceph_get_inode badness\n"); err = PTR_ERR(in); - in = 0; + in = NULL; break; } existing = d_find_alias(in); @@ -1054,7 +1054,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req) struct dentry *dn; struct inode *in; int err = 0, i; - struct inode *snapdir = 0; + struct inode *snapdir = NULL; if (le32_to_cpu(rinfo->head->op) == CEPH_MDS_OP_LSSNAP) { snapdir = ceph_get_snapdir(parent->d_inode); @@ -1118,7 +1118,7 @@ retry_lookup: dn = splice_dentry(dn, in, NULL); } - if (ceph_fill_inode(in, &rinfo->dir_in[i], 0) < 0) { + if (ceph_fill_inode(in, &rinfo->dir_in[i], NULL) < 0) { dout(0, "ceph_fill_inode badness on %p\n", in); dput(dn); continue; @@ -1248,7 +1248,7 @@ static void *ceph_sym_follow_link(struct dentry *dentry, struct nameidata *nd) return NULL; } -const struct inode_operations ceph_symlink_iops = { +static const struct inode_operations ceph_symlink_iops = { .readlink = generic_readlink, .follow_link = ceph_sym_follow_link, }; @@ -1273,14 +1273,14 @@ static struct ceph_mds_request *prepare_setattr(struct ceph_mds_client *mdsc, ceph_vinop(dentry->d_inode)); req = ceph_mdsc_create_request(mdsc, op, ceph_ino(dentry->d_inode), - "", 0, 0, + "", 0, NULL, dentry, USE_CAP_MDS); } else { dout(5, "prepare_setattr dentry %p (full path)\n", dentry); path = ceph_build_path(dentry, &pathlen, &pathbase, 0); if (IS_ERR(path)) return ERR_PTR(PTR_ERR(path)); - req = ceph_mdsc_create_request(mdsc, op, pathbase, path, 0, 0, + req = ceph_mdsc_create_request(mdsc, op, pathbase, path, 0, NULL, dentry, USE_ANY_MDS); kfree(path); } @@ -1311,7 +1311,7 @@ static int ceph_setattr_chown(struct dentry *dentry, struct iattr *attr) mask |= CEPH_CHOWN_GID; } reqh->args.chown.mask = cpu_to_le32(mask); - ceph_mdsc_lease_release(mdsc, inode, 0, CEPH_LOCK_IAUTH); + ceph_mdsc_lease_release(mdsc, inode, NULL, CEPH_LOCK_IAUTH); err = ceph_mdsc_do_request(mdsc, req); ceph_mdsc_put_request(req); dout(10, "chown result %d\n", err); @@ -1332,7 +1332,7 @@ static int ceph_setattr_chmod(struct dentry *dentry, struct iattr *attr) return PTR_ERR(req); reqh = req->r_request->front.iov_base; reqh->args.chmod.mode = cpu_to_le32(attr->ia_mode); - ceph_mdsc_lease_release(mdsc, inode, 0, CEPH_LOCK_IAUTH); + ceph_mdsc_lease_release(mdsc, inode, NULL, CEPH_LOCK_IAUTH); err = ceph_mdsc_do_request(mdsc, req); ceph_mdsc_put_request(req); dout(10, "chmod result %d\n", err); @@ -1400,7 +1400,7 @@ static int ceph_setattr_time(struct dentry *dentry, struct iattr *attr) if (ia_valid & ATTR_MTIME) reqh->args.utime.mask |= CEPH_UTIME_MTIME; - ceph_mdsc_lease_release(mdsc, inode, 0, CEPH_LOCK_ICONTENT); + ceph_mdsc_lease_release(mdsc, inode, NULL, CEPH_LOCK_ICONTENT); err = ceph_mdsc_do_request(mdsc, req); ceph_mdsc_put_request(req); dout(10, "utime result %d\n", err); @@ -1443,7 +1443,7 @@ static int ceph_setattr_size(struct dentry *dentry, struct iattr *attr) return PTR_ERR(req); reqh = req->r_request->front.iov_base; reqh->args.truncate.length = cpu_to_le64(attr->ia_size); - ceph_mdsc_lease_release(mdsc, inode, 0, CEPH_LOCK_ICONTENT); + ceph_mdsc_lease_release(mdsc, inode, NULL, CEPH_LOCK_ICONTENT); err = ceph_mdsc_do_request(mdsc, req); ceph_mdsc_put_request(req); dout(10, "truncate result %d\n", err); @@ -1742,7 +1742,6 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) end = p + ci->i_xattr_len; ceph_decode_32_safe(&p, end, numattr, bad); while (numattr--) { - u32 len; ceph_decode_32_safe(&p, end, len, bad); namelen += len + 1; p += len; @@ -1811,7 +1810,7 @@ int ceph_setxattr(struct dentry *dentry, const char *name, u64 pathbase; int err; int i, nr_pages; - struct page **pages = 0; + struct page **pages = NULL; void *kaddr; if (ceph_snap(inode) != CEPH_NOSNAP) @@ -1862,7 +1861,7 @@ int ceph_setxattr(struct dentry *dentry, const char *name, req->r_request->hdr.data_len = cpu_to_le32(size); req->r_request->hdr.data_off = cpu_to_le32(0); - ceph_mdsc_lease_release(mdsc, inode, 0, CEPH_LOCK_IXATTR); + ceph_mdsc_lease_release(mdsc, inode, NULL, CEPH_LOCK_IXATTR); err = ceph_mdsc_do_request(mdsc, req); ceph_mdsc_put_request(req); @@ -1906,7 +1905,7 @@ int ceph_removexattr(struct dentry *dentry, const char *name) if (IS_ERR(req)) return PTR_ERR(req); - ceph_mdsc_lease_release(mdsc, inode, 0, CEPH_LOCK_IXATTR); + ceph_mdsc_lease_release(mdsc, inode, NULL, CEPH_LOCK_IXATTR); err = ceph_mdsc_do_request(mdsc, req); ceph_mdsc_put_request(req); return err; diff --git a/src/kernel/mds_client.c b/src/kernel/mds_client.c index 43e95b80848a..7dc9f3504e5d 100644 --- a/src/kernel/mds_client.c +++ b/src/kernel/mds_client.c @@ -66,7 +66,7 @@ static int parse_reply_info_trace(void **p, void *end, info->trace_numd = numd; info->trace_snapdirpos = snapdirpos; if (numi == 0) { - info->trace_in = 0; + info->trace_in = NULL; goto done; /* hrm, this shouldn't actually happen, but.. */ } @@ -248,7 +248,7 @@ struct ceph_mds_session *__ceph_get_mds_session(struct ceph_mds_client *mdsc, int mds) { struct ceph_mds_session *session; - if (mds >= mdsc->max_sessions || mdsc->sessions[mds] == 0) + if (mds >= mdsc->max_sessions || mdsc->sessions[mds] == NULL) return NULL; session = mdsc->sessions[mds]; dout(30, "get_mds_session %p %d -> %d\n", session, @@ -324,7 +324,7 @@ static void __unregister_session(struct ceph_mds_client *mdsc, int mds) { dout(10, "__unregister_session mds%d %p\n", mds, mdsc->sessions[mds]); ceph_put_mds_session(mdsc->sessions[mds]); - mdsc->sessions[mds] = 0; + mdsc->sessions[mds] = NULL; } @@ -341,11 +341,11 @@ static void put_request_sessions(struct ceph_mds_request *req) { if (req->r_session) { ceph_put_mds_session(req->r_session); - req->r_session = 0; + req->r_session = NULL; } if (req->r_fwd_session) { ceph_put_mds_session(req->r_fwd_session); - req->r_fwd_session = 0; + req->r_fwd_session = NULL; } } @@ -390,21 +390,21 @@ static struct ceph_mds_request *new_request(struct ceph_msg *msg) req = kzalloc(sizeof(*req), GFP_NOFS); req->r_request = msg; - req->r_reply = 0; + req->r_reply = NULL; req->r_timeout = 0; req->r_started = jiffies; req->r_err = 0; - req->r_direct_dentry = 0; + req->r_direct_dentry = NULL; req->r_direct_mode = USE_ANY_MDS; req->r_direct_hash = 0; req->r_direct_is_hash = false; - req->r_last_inode = 0; - req->r_last_dentry = 0; - req->r_old_dentry = 0; - req->r_expected_cap = 0; + req->r_last_inode = NULL; + req->r_last_dentry = NULL; + req->r_old_dentry = NULL; + req->r_expected_cap = NULL; req->r_fmode = 0; - req->r_session = 0; - req->r_fwd_session = 0; + req->r_session = NULL; + req->r_fwd_session = NULL; req->r_attempts = 0; req->r_num_fwd = 0; req->r_resend_mds = -1; @@ -455,7 +455,7 @@ static int choose_mds(struct ceph_mds_client *mdsc, bool is_hash = req->r_direct_is_hash; struct dentry *dentry = req->r_direct_dentry; struct ceph_inode_info *ci; - struct ceph_inode_frag *frag = 0; + struct ceph_inode_frag *frag = NULL; int mode = req->r_direct_mode; /* is there a specific mds we should try? */ @@ -550,7 +550,7 @@ static struct ceph_msg *create_session_msg(__u32 op, __u64 seq) struct ceph_msg *msg; struct ceph_mds_session_head *h; - msg = ceph_msg_new(CEPH_MSG_CLIENT_SESSION, sizeof(*h), 0, 0, 0); + msg = ceph_msg_new(CEPH_MSG_CLIENT_SESSION, sizeof(*h), 0, 0, NULL); if (IS_ERR(msg)) { derr("ENOMEM creating session msg\n"); return ERR_PTR(-ENOMEM); @@ -674,7 +674,7 @@ static void revoke_dentry_lease(struct dentry *dentry) if (di) { list_del(&di->lease_item); kfree(di); - dentry->d_fsdata = 0; + dentry->d_fsdata = NULL; } spin_unlock(&dentry->d_lock); if (di) @@ -695,7 +695,7 @@ static void revoke_inode_lease(struct ceph_inode_info *ci, int mask) ci->i_lease_mask &= ~mask; if (ci->i_lease_mask == 0) { list_del_init(&ci->i_lease_item); - ci->i_lease_session = 0; + ci->i_lease_session = NULL; drop = 1; } } @@ -729,7 +729,7 @@ static void trim_session_leases(struct ceph_mds_session *session) } dout(20, "trim_session_leases inode %p mask %d\n", &ci->vfs_inode, ci->i_lease_mask); - ci->i_lease_session = 0; + ci->i_lease_session = NULL; ci->i_lease_mask = 0; list_del_init(&ci->i_lease_item); spin_unlock(&ci->vfs_inode.i_lock); @@ -749,7 +749,7 @@ static void trim_session_leases(struct ceph_mds_session *session) dout(20, "trim_session_leases dentry %p\n", dentry); list_del(&di->lease_item); kfree(di); - dentry->d_fsdata = 0; + dentry->d_fsdata = NULL; spin_unlock(&dentry->d_lock); dput(dentry); } @@ -860,7 +860,7 @@ void ceph_mdsc_handle_session(struct ceph_mds_client *mdsc, { __u32 op; __u64 seq; - struct ceph_mds_session *session = 0; + struct ceph_mds_session *session = NULL; int mds = le32_to_cpu(msg->hdr.src.name.num); struct ceph_mds_session_head *h = msg->front.iov_base; int was_stale; @@ -988,7 +988,7 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, msg = ceph_msg_new(CEPH_MSG_CLIENT_REQUEST, sizeof(struct ceph_mds_request_head) + pathlen, - 0, 0, 0); + 0, 0, NULL); if (IS_ERR(msg)) return ERR_PTR(PTR_ERR(msg)); req = new_request(msg); @@ -1139,7 +1139,7 @@ retry: } if (IS_ERR(req->r_reply)) { err = PTR_ERR(req->r_reply); - req->r_reply = 0; + req->r_reply = NULL; } if (!err) err = le32_to_cpu(req->r_reply_info.head->result); @@ -1150,7 +1150,7 @@ finish: mutex_unlock(&mdsc->mutex); ceph_msg_put(req->r_request); - req->r_request = 0; + req->r_request = NULL; dout(30, "do_request done on %p result %d\n", req, err); return err; @@ -1188,7 +1188,7 @@ void ceph_mdsc_handle_reply(struct ceph_mds_client *mdsc, struct ceph_msg *msg) ceph_put_mds_session(req->r_session); req->r_session = __ceph_get_mds_session(mdsc, mds); } - if (req->r_session == 0) { + if (req->r_session == NULL) { derr(1, "got reply on %llu, but no session for mds%d\n", tid, mds); mutex_unlock(&mdsc->mutex); @@ -1234,7 +1234,7 @@ void ceph_mdsc_handle_reply(struct ceph_mds_client *mdsc, struct ceph_msg *msg) rinfo->snapblob, rinfo->snapblob_len, req->r_expected_cap); - req->r_expected_cap = 0; + req->r_expected_cap = NULL; if (err) goto done; } else { @@ -1387,7 +1387,7 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds) retry: /* build reply */ - reply = ceph_msg_new(CEPH_MSG_CLIENT_RECONNECT, len, 0, 0, 0); + reply = ceph_msg_new(CEPH_MSG_CLIENT_RECONNECT, len, 0, 0, NULL); if (IS_ERR(reply)) { err = PTR_ERR(reply); goto bad; @@ -1427,7 +1427,7 @@ retry: BUG_ON(err); } } else { - path = 0; + path = NULL; pathlen = 0; } ceph_decode_need(&p, end, pathlen+4, needmore); @@ -1440,7 +1440,7 @@ retry: spin_lock(&inode->i_lock); cap->seq = 0; /* reset cap seq */ rec->wanted = cpu_to_le32(__ceph_caps_wanted(ci)); - rec->issued = cpu_to_le32(__ceph_caps_issued(ci, 0)); + rec->issued = cpu_to_le32(__ceph_caps_issued(ci, NULL)); rec->size = cpu_to_le64(inode->i_size); ceph_encode_timespec(&rec->mtime, &inode->i_mtime); ceph_encode_timespec(&rec->atime, &inode->i_atime); @@ -1460,7 +1460,7 @@ retry: num_realms = 0; while (1) { struct ceph_snap_realm *realm; - struct ceph_mds_snaprealm_reconnect *rec; + struct ceph_mds_snaprealm_reconnect *sr_rec; got = radix_tree_gang_lookup(&mdsc->snap_realms, (void **)&realm, next_snap_ino, 1); if (!got) @@ -1468,12 +1468,12 @@ retry: dout(10, " adding snap realm %llx seq %lld parent %llx\n", realm->ino, realm->seq, realm->parent_ino); - ceph_decode_need(&p, end, sizeof(*rec), needmore); - rec = p; - rec->ino = cpu_to_le64(realm->ino); - rec->seq = cpu_to_le64(realm->seq); - rec->parent = cpu_to_le64(realm->parent_ino); - p += sizeof(*rec); + ceph_decode_need(&p, end, sizeof(*sr_rec), needmore); + sr_rec = p; + sr_rec->ino = cpu_to_le64(realm->ino); + sr_rec->seq = cpu_to_le64(realm->seq); + sr_rec->parent = cpu_to_le64(realm->parent_ino); + p += sizeof(*sr_rec); num_realms++; next_snap_ino = realm->ino + 1; } @@ -1545,7 +1545,7 @@ static void check_new_map(struct ceph_mds_client *mdsc, newmap->m_epoch, oldmap->m_epoch); for (i = 0; i < oldmap->m_max_mds && i < mdsc->max_sessions; i++) { - if (mdsc->sessions[i] == 0) + if (mdsc->sessions[i] == NULL) continue; session = mdsc->sessions[i]; oldstate = ceph_mdsmap_get_state(oldmap, i); @@ -1715,7 +1715,7 @@ void ceph_mdsc_lease_release(struct ceph_mds_client *mdsc, struct inode *inode, int len = sizeof(*lease) + sizeof(__u32); int dnamelen = 0; - BUG_ON(inode == 0); + BUG_ON(inode == NULL); /* is dentry lease valid? */ if ((mask & CEPH_LOCK_DN) && dentry) { @@ -1759,7 +1759,7 @@ void ceph_mdsc_lease_release(struct ceph_mds_client *mdsc, struct inode *inode, dout(10, "lease_release inode %p dentry %p %d mask %d to mds%d\n", inode, dentry, dnamelen, mask, mds); - msg = ceph_msg_new(CEPH_MSG_CLIENT_LEASE, len, 0, 0, 0); + msg = ceph_msg_new(CEPH_MSG_CLIENT_LEASE, len, 0, 0, NULL); if (IS_ERR(msg)) return; lease = msg->front.iov_base; @@ -1810,7 +1810,7 @@ static void delayed_work(struct work_struct *work) for (i = 0; i < mdsc->max_sessions; i++) { struct ceph_mds_session *session = __ceph_get_mds_session(mdsc, i); - if (session == 0) + if (session == NULL) continue; if (session->s_state == CEPH_MDS_SESSION_CLOSING) { dout(10, "resending session close request for mds%d\n", @@ -1852,8 +1852,8 @@ void ceph_mdsc_init(struct ceph_mds_client *mdsc, struct ceph_client *client) mutex_init(&mdsc->mutex); init_rwsem(&mdsc->snap_rwsem); mdsc->client = client; - mdsc->mdsmap = 0; /* none yet */ - mdsc->sessions = 0; + mdsc->mdsmap = NULL; /* none yet */ + mdsc->sessions = NULL; mdsc->max_sessions = 0; mdsc->last_tid = 0; mdsc->stopping = 0; diff --git a/src/kernel/messenger.c b/src/kernel/messenger.c index eb0f970bac98..03cacd6fd1d1 100644 --- a/src/kernel/messenger.c +++ b/src/kernel/messenger.c @@ -42,7 +42,7 @@ int ceph_msgr_init(void) if (IS_ERR(ceph_msgr_wq)) { int ret = PTR_ERR(ceph_msgr_wq); derr(0, "failed to create workqueue: %d\n", ret); - ceph_msgr_wq = 0; + ceph_msgr_wq = NULL; return ret; } return 0; @@ -158,7 +158,7 @@ static void set_sock_callbacks(struct socket *sock, /* * initiate connection to a remote socket. */ -struct socket *ceph_tcp_connect(struct ceph_connection *con) +static struct socket *ceph_tcp_connect(struct ceph_connection *con) { int ret; struct sockaddr *paddr = (struct sockaddr *)&con->peer_addr.ipaddr; @@ -188,7 +188,7 @@ struct socket *ceph_tcp_connect(struct ceph_connection *con) derr(1, "connect %u.%u.%u.%u:%u error: %d\n", IPQUADPORT(*(struct sockaddr_in *)paddr), ret); sock_release(sock); - con->sock = 0; + con->sock = NULL; } if (ret < 0) @@ -199,7 +199,7 @@ struct socket *ceph_tcp_connect(struct ceph_connection *con) /* * setup listening socket */ -int ceph_tcp_listen(struct ceph_messenger *msgr) +static int ceph_tcp_listen(struct ceph_messenger *msgr) { int ret; int optval = 1; @@ -264,7 +264,7 @@ err: /* * accept a connection */ -int ceph_tcp_accept(struct socket *lsock, struct ceph_connection *con) +static int ceph_tcp_accept(struct socket *lsock, struct ceph_connection *con) { int ret; struct sockaddr *paddr = (struct sockaddr *)&con->peer_addr.ipaddr; @@ -306,7 +306,7 @@ err: /* * receive a message this may return after partial send */ -int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len) +static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len) { struct kvec iov = {buf, len}; struct msghdr msg = {.msg_flags = 0}; @@ -321,7 +321,7 @@ int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len) /* * Send a message this may return after partial send */ -int ceph_tcp_sendmsg(struct socket *sock, struct kvec *iov, +static int ceph_tcp_sendmsg(struct socket *sock, struct kvec *iov, size_t kvlen, size_t len, int more) { struct msghdr msg = {.msg_flags = 0}; @@ -424,7 +424,7 @@ static int con_close_socket(struct ceph_connection *con) return 0; rc = con->sock->ops->shutdown(con->sock, SHUT_RDWR); sock_release(con->sock); - con->sock = 0; + con->sock = NULL; return rc; } @@ -695,7 +695,7 @@ static int write_partial_msg_pages(struct ceph_connection *con, while (con->out_msg_pos.page < con->out_msg->nr_pages) { struct page *page = NULL; - void *kaddr = 0; + void *kaddr = NULL; mutex_lock(&msg->page_mutex); if (msg->pages) { @@ -756,7 +756,7 @@ static int write_partial_msg_pages(struct ceph_connection *con, sizeof(con->out_msg->footer); con->out_kvec_left = 1; con->out_kvec_cur = con->out_kvec; - con->out_msg = 0; + con->out_msg = NULL; con->out_more = 0; /* end of message */ ret = 1; @@ -979,7 +979,7 @@ more: dout(30, "try_write out_kvec_bytes %d\n", con->out_kvec_bytes); /* initiate connect? */ - if (con->sock == 0) { + if (con->sock == NULL) { if (test_and_clear_bit(STANDBY, &con->state)) con->connect_seq++; con->global_seq = get_global_seq(msgr, 0); @@ -993,7 +993,7 @@ more: con->sock = ceph_tcp_connect(con); dout(10, "tcp_connect returned %p\n", con->sock); if (IS_ERR(con->sock)) { - con->sock = 0; + con->sock = NULL; con->error_msg = "connect error"; ret = -1; goto out; @@ -1025,7 +1025,7 @@ more_kvec: goto done; } } - con->out_msg = 0; /* done with this message. */ + con->out_msg = NULL; /* done with this message. */ /* anything else pending? */ spin_lock(&con->out_queue_lock); @@ -1058,11 +1058,11 @@ static int prepare_read_message(struct ceph_connection *con) int err; BUG_ON(con->in_msg != NULL); con->in_base_pos = 0; - con->in_msg = ceph_msg_new(0, 0, 0, 0, 0); + con->in_msg = ceph_msg_new(0, 0, 0, 0, NULL); if (IS_ERR(con->in_msg)) { /* TBD: we don't check for error in caller, handle it here? */ err = PTR_ERR(con->in_msg); - con->in_msg = 0; + con->in_msg = NULL; derr(1, "kmalloc failure on incoming message %d\n", err); return err; } @@ -1141,7 +1141,7 @@ static int read_message_partial(struct ceph_connection *con) dout(10, "prepare_pages failed, skipping payload\n"); con->in_base_pos = -data_len - sizeof(m->footer); ceph_msg_put(con->in_msg); - con->in_msg = 0; + con->in_msg = NULL; con->in_tag = CEPH_MSGR_TAG_READY; return 0; } else { @@ -1158,7 +1158,7 @@ static int read_message_partial(struct ceph_connection *con) con->in_base_pos = con->in_msg_pos.data_pos - data_len - sizeof(m->footer); ceph_msg_put(m); - con->in_msg = 0; + con->in_msg = NULL; con->in_tag = CEPH_MSGR_TAG_READY; return 0; } @@ -1244,7 +1244,7 @@ static void process_message(struct ceph_connection *con) le32_to_cpu(con->in_msg->hdr.data_len), con->in_front_crc, con->in_data_crc); con->msgr->dispatch(con->msgr->parent, con->in_msg); - con->in_msg = 0; + con->in_msg = NULL; con->in_tag = CEPH_MSGR_TAG_READY; } @@ -1404,9 +1404,9 @@ static void reset_connection(struct ceph_connection *con) con->connect_seq = 0; con->out_seq = 0; - con->out_msg = 0; + con->out_msg = NULL; con->in_seq = 0; - con->in_msg = 0; + con->in_msg = NULL; spin_unlock(&con->out_queue_lock); } @@ -2004,7 +2004,7 @@ struct ceph_msg *ceph_msg_maybe_dup(struct ceph_msg *old) /* revoke old message's pages */ mutex_lock(&old->page_mutex); - old->pages = 0; + old->pages = NULL; old->footer.flags |= CEPH_MSG_FOOTER_ABORTED; mutex_unlock(&old->page_mutex); @@ -2144,7 +2144,7 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, goto out2; } } else { - m->front.iov_base = 0; + m->front.iov_base = NULL; } m->front.iov_len = front_len; @@ -2189,7 +2189,7 @@ void ceph_ping(struct ceph_messenger *msgr, struct ceph_entity_name name, { struct ceph_msg *m; - m = ceph_msg_new(CEPH_MSG_PING, 0, 0, 0, 0); + m = ceph_msg_new(CEPH_MSG_PING, 0, 0, 0, NULL); if (!m) return; memset(m->front.iov_base, 0, m->front.iov_len); diff --git a/src/kernel/mon_client.c b/src/kernel/mon_client.c index 447409209108..1abd2f943dd0 100644 --- a/src/kernel/mon_client.c +++ b/src/kernel/mon_client.c @@ -100,7 +100,7 @@ static void do_request_mdsmap(struct work_struct *work) dout(5, "request_mdsmap from mon%d want %u\n", mon, monc->want_mdsmap); - msg = ceph_msg_new(CEPH_MSG_MDS_GETMAP, sizeof(*h), 0, 0, 0); + msg = ceph_msg_new(CEPH_MSG_MDS_GETMAP, sizeof(*h), 0, 0, NULL); if (IS_ERR(msg)) return; h = msg->front.iov_base; @@ -162,7 +162,7 @@ static void do_request_osdmap(struct work_struct *work) int mon = pick_mon(monc, -1); dout(5, "request_osdmap from mon%d have %u\n", mon, monc->have_osdmap); - msg = ceph_msg_new(CEPH_MSG_OSD_GETMAP, sizeof(*h), 0, 0, 0); + msg = ceph_msg_new(CEPH_MSG_OSD_GETMAP, sizeof(*h), 0, 0, NULL); if (IS_ERR(msg)) return; h = msg->front.iov_base; @@ -219,7 +219,7 @@ static void do_request_umount(struct work_struct *work) int mon = pick_mon(monc, -1); dout(5, "do_request_umount from mon%d\n", mon); - msg = ceph_msg_new(CEPH_MSG_CLIENT_UNMOUNT, 0, 0, 0, 0); + msg = ceph_msg_new(CEPH_MSG_CLIENT_UNMOUNT, 0, 0, 0, NULL); if (IS_ERR(msg)) return; msg->hdr.dst = monc->monmap->mon_inst[mon]; @@ -287,14 +287,14 @@ bad: derr(10, "corrupt statfs reply, no tid\n"); } -int send_statfs(struct ceph_mon_client *monc, u64 tid) +static int send_statfs(struct ceph_mon_client *monc, u64 tid) { struct ceph_msg *msg; int mon = pick_mon(monc, -1); struct ceph_mon_statfs *h; dout(10, "send_statfs to mon%d tid %llu\n", mon, tid); - msg = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), 0, 0, 0); + msg = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), 0, 0, NULL); if (IS_ERR(msg)) return PTR_ERR(msg); h = msg->front.iov_base; diff --git a/src/kernel/osd_client.c b/src/kernel/osd_client.c index 20def075a824..9ce758b284e7 100644 --- a/src/kernel/osd_client.c +++ b/src/kernel/osd_client.c @@ -87,7 +87,7 @@ void ceph_osdc_put_request(struct ceph_osd_request *req) -struct ceph_msg *new_request_msg(struct ceph_osd_client *osdc, int op, +static struct ceph_msg *new_request_msg(struct ceph_osd_client *osdc, int op, struct ceph_snap_context *snapc) { struct ceph_msg *req; @@ -96,7 +96,7 @@ struct ceph_msg *new_request_msg(struct ceph_osd_client *osdc, int op, if (snapc) size += sizeof(u64) * snapc->num_snaps; - req = ceph_msg_new(CEPH_MSG_OSD_OP, size, 0, 0, 0); + req = ceph_msg_new(CEPH_MSG_OSD_OP, size, 0, 0, NULL); if (IS_ERR(req)) return req; memset(req->front.iov_base, 0, req->front.iov_len); @@ -172,7 +172,7 @@ static int register_request(struct ceph_osd_client *osdc, req->r_tid = head->tid = ++osdc->last_tid; req->r_flags = 0; req->r_pgid.pg64 = le64_to_cpu(head->layout.ol_pgid); - req->r_reply = 0; + req->r_reply = NULL; req->r_result = 0; init_completion(&req->r_completion); @@ -395,7 +395,7 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) void *p, *end, *next; __u32 nr_maps, maplen; __u32 epoch; - struct ceph_osdmap *newmap = 0; + struct ceph_osdmap *newmap = NULL; int err; struct ceph_fsid fsid; @@ -486,7 +486,7 @@ done: downgrade_write(&osdc->map_sem); ceph_monc_got_osdmap(&osdc->client->monc, osdc->osdmap->epoch); if (newmap) - kick_requests(osdc, 0); + kick_requests(osdc, NULL); up_read(&osdc->map_sem); return; @@ -534,7 +534,7 @@ int ceph_osdc_prepare_pages(void *p, struct ceph_msg *m, int want) dout(10, "prepare_pages tid %llu have %d pages, want %d\n", tid, req->r_num_pages, want); if (likely(req->r_num_pages >= want && - req->r_reply == 0)) { + req->r_reply == NULL)) { m->pages = req->r_pages; m->nr_pages = req->r_num_pages; ceph_msg_get(m); @@ -547,7 +547,7 @@ out: } -int start_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req) +static int start_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req) { int rc; @@ -566,7 +566,7 @@ int start_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req) /* * synchronously do an osd request. */ -int do_sync_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req) +static int do_sync_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req) { struct ceph_osd_reply_head *replyhead; __s32 rc; @@ -590,11 +590,11 @@ int do_sync_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req) req->r_aborted = 1; msg = req->r_request; mutex_lock(&msg->page_mutex); - msg->pages = 0; + msg->pages = NULL; mutex_unlock(&msg->page_mutex); if (req->r_reply) { mutex_lock(&req->r_reply->page_mutex); - req->r_reply->pages = 0; + req->r_reply->pages = NULL; mutex_unlock(&req->r_reply->page_mutex); } return rc; @@ -611,7 +611,7 @@ int do_sync_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req) return bytes; } -void handle_timeout(struct work_struct *work) +static void handle_timeout(struct work_struct *work) { u64 next_tid = 0; struct ceph_osd_client *osdc = @@ -671,7 +671,7 @@ void ceph_osdc_stop(struct ceph_osd_client *osdc) if (osdc->osdmap) { osdmap_destroy(osdc->osdmap); - osdc->osdmap = 0; + osdc->osdmap = NULL; } } @@ -699,7 +699,7 @@ int ceph_osdc_sync_read(struct ceph_osd_client *osdc, struct ceph_vino vino, more: req = ceph_osdc_new_request(osdc, layout, vino, off, &len, - CEPH_OSD_OP_READ, 0); + CEPH_OSD_OP_READ, NULL); if (IS_ERR(req)) return PTR_ERR(req); @@ -773,8 +773,8 @@ int ceph_osdc_readpage(struct ceph_osd_client *osdc, struct ceph_vino vino, vino.snap, off, len); /* request msg */ - req = ceph_osdc_new_request(osdc, layout, vino, off, &len, - CEPH_OSD_OP_READ, 0); + req = ceph_osdc_new_request(osdc, layout, vino, off, (__u64 *)&len, + CEPH_OSD_OP_READ, NULL); if (IS_ERR(req)) return PTR_ERR(req); BUG_ON(len != PAGE_CACHE_SIZE); @@ -816,7 +816,7 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc, /* alloc request, w/ optimistically-sized page vector */ req = ceph_osdc_new_request(osdc, layout, vino, off, &len, - CEPH_OSD_OP_READ, 0); + CEPH_OSD_OP_READ, NULL); if (IS_ERR(req)) return PTR_ERR(req); @@ -953,7 +953,7 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino, BUG_ON(vino.snap != CEPH_NOSNAP); /* request + msg */ - req = ceph_osdc_new_request(osdc, layout, vino, off, &len, + req = ceph_osdc_new_request(osdc, layout, vino, off, (__u64 *)&len, CEPH_OSD_OP_WRITE, snapc); if (IS_ERR(req)) return PTR_ERR(req); diff --git a/src/kernel/osdmap.c b/src/kernel/osdmap.c index 1870af501188..ec616f777b32 100644 --- a/src/kernel/osdmap.c +++ b/src/kernel/osdmap.c @@ -156,7 +156,7 @@ static struct crush_map *crush_decode(void **p, void *end) ceph_decode_32_safe(p, end, type, bad); if (type == 0) { - c->buckets[i] = 0; + c->buckets[i] = NULL; continue; } @@ -237,7 +237,7 @@ static struct crush_map *crush_decode(void **p, void *end) if (!yes) { dout(30, "crush_decode NO rule %d off %x %p to %p\n", i, (int)(*p-start), *p, end); - c->rules[i] = 0; + c->rules[i] = NULL; continue; } @@ -392,7 +392,7 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) map->crush = crush_decode(p, end); if (IS_ERR(map->crush)) { err = PTR_ERR(map->crush); - map->crush = 0; + map->crush = NULL; goto bad; } @@ -415,7 +415,7 @@ struct ceph_osdmap *apply_incremental(void **p, void *end, struct ceph_messenger *msgr) { struct ceph_osdmap *newmap = map; - struct crush_map *newcrush = 0; + struct crush_map *newcrush = NULL; struct ceph_fsid fsid; __u32 epoch = 0; struct ceph_timespec ctime; @@ -462,7 +462,7 @@ struct ceph_osdmap *apply_incremental(void **p, void *end, /* new max? */ ceph_decode_32(p, max); if (max >= 0) { - int err = osdmap_set_max_osd(map, max); + err = osdmap_set_max_osd(map, max); if (err < 0) goto bad; } @@ -485,7 +485,7 @@ struct ceph_osdmap *apply_incremental(void **p, void *end, if (map->crush) crush_destroy(map->crush); map->crush = newcrush; - newcrush = 0; + newcrush = NULL; } /* new_up */ diff --git a/src/kernel/proc.c b/src/kernel/proc.c index c17b901f1a34..f9a26ecfc8ed 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -3,6 +3,8 @@ #include #include +#include "ceph_debug.h" + int ceph_debug_proc = -1; #define DOUT_MASK DOUT_MASK_PROC #define DOUT_VAR ceph_debug_proc @@ -175,7 +177,7 @@ int ceph_proc_init(void) return 0; } -void ceph_proc_cleanup() +void ceph_proc_cleanup(void) { remove_proc_entry("debug", proc_fs_ceph); remove_proc_entry("debug_msgr", proc_fs_ceph); diff --git a/src/kernel/snap.c b/src/kernel/snap.c index 801463b3231f..c022fe196f90 100644 --- a/src/kernel/snap.c +++ b/src/kernel/snap.c @@ -13,7 +13,7 @@ int ceph_debug_snap = -1; #include "decode.h" -struct ceph_snap_realm *ceph_get_snap_realm(struct ceph_mds_client *mdsc, u64 ino) +static struct ceph_snap_realm *ceph_get_snap_realm(struct ceph_mds_client *mdsc, u64 ino) { struct ceph_snap_realm *realm; @@ -150,7 +150,7 @@ static int build_snap_context(struct ceph_snap_realm *realm) fail: if (realm->cached_context) { ceph_put_snap_context(realm->cached_context); - realm->cached_context = 0; + realm->cached_context = NULL; } derr(0, "build_snap_context %llx %p fail %d\n", realm->ino, realm, err); @@ -185,7 +185,7 @@ static int dup_array(u64 **dst, u64 *src, int num) for (i = 0; i < num; i++) (*dst)[i] = le64_to_cpu(src[i]); } else - *dst = 0; + *dst = NULL; return 0; } @@ -234,7 +234,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci, igrab(inode); capsnap->follows = snapc->seq; capsnap->context = ceph_get_snap_context(snapc); - capsnap->issued = __ceph_caps_issued(ci, 0); + capsnap->issued = __ceph_caps_issued(ci, NULL); capsnap->dirty = ci->i_wrbuffer_ref_head; ci->i_wrbuffer_ref_head = 0; list_add_tail(&capsnap->ci_item, &ci->i_cap_snaps); @@ -260,7 +260,7 @@ struct ceph_snap_realm *ceph_update_snap_trace(struct ceph_mds_client *mdsc, int err = -ENOMEM; u64 *snaps; u64 *prior_parent_snaps; - struct ceph_snap_realm *realm, *first = 0; + struct ceph_snap_realm *realm, *first = NULL; int invalidate = 0; dout(10, "update_snap_trace must_flush=%d\n", must_flush); @@ -284,13 +284,13 @@ more: } if (le64_to_cpu(ri->seq) > realm->seq) { - struct list_head *p; + struct list_head *pi; dout(10, "update_snap_trace updating %llx %p %lld -> %lld\n", realm->ino, realm, realm->seq, le64_to_cpu(ri->seq)); - list_for_each(p, &realm->inodes_with_caps) { + list_for_each(pi, &realm->inodes_with_caps) { struct ceph_inode_info *ci = - list_entry(p, struct ceph_inode_info, + list_entry(pi, struct ceph_inode_info, i_snap_realm_item); ceph_queue_cap_snap(ci, realm->cached_context); } @@ -355,12 +355,12 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, u64 split; int op; int trace_len; - struct ceph_snap_realm *realm = 0; + struct ceph_snap_realm *realm = NULL; void *p = msg->front.iov_base; void *e = p + msg->front.iov_len; struct ceph_mds_snap_head *h; int num_split_inos, num_split_realms; - __le64 *split_inos = 0, *split_realms = 0; + __le64 *split_inos = NULL, *split_realms = NULL; int i; /* decode */ diff --git a/src/kernel/super.h b/src/kernel/super.h index d03fc5b62db5..f0a288273776 100644 --- a/src/kernel/super.h +++ b/src/kernel/super.h @@ -406,7 +406,7 @@ static inline int ceph_caps_issued(struct ceph_inode_info *ci) { int issued; spin_lock(&ci->vfs_inode.i_lock); - issued = __ceph_caps_issued(ci, 0); + issued = __ceph_caps_issued(ci, NULL); spin_unlock(&ci->vfs_inode.i_lock); return issued; }