aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSF Markus Elfring <elfring@users.sourceforge.net>2014-11-02 09:20:59 -0500
committerIlya Dryomov <idryomov@redhat.com>2014-12-17 12:09:50 -0500
commite96a650a8174e20112b400e72e0b2429aa66de20 (patch)
tree44fa588afe9ee1b9504016e012c3dcffb184b87b /fs
parent70db4f3629b3476cf506be869ef9d15688d2d44a (diff)
ceph, rbd: delete unnecessary checks before two function calls
The functions ceph_put_snap_context() and iput() test whether their argument is NULL and then return immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> [idryomov@redhat.com: squashed rbd.c hunk, changelog] Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ceph/caps.c3
-rw-r--r--fs/ceph/mds_client.c6
-rw-r--r--fs/ceph/snap.c9
3 files changed, 6 insertions, 12 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index cefca661464b..eb1bf1f35e0e 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3137,8 +3137,7 @@ flush_cap_releases:
3137done: 3137done:
3138 mutex_unlock(&session->s_mutex); 3138 mutex_unlock(&session->s_mutex);
3139done_unlocked: 3139done_unlocked:
3140 if (inode) 3140 iput(inode);
3141 iput(inode);
3142 return; 3141 return;
3143 3142
3144bad: 3143bad:
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 5a47ed760e6d..fc74617069a3 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -524,8 +524,7 @@ void ceph_mdsc_release_request(struct kref *kref)
524 } 524 }
525 if (req->r_locked_dir) 525 if (req->r_locked_dir)
526 ceph_put_cap_refs(ceph_inode(req->r_locked_dir), CEPH_CAP_PIN); 526 ceph_put_cap_refs(ceph_inode(req->r_locked_dir), CEPH_CAP_PIN);
527 if (req->r_target_inode) 527 iput(req->r_target_inode);
528 iput(req->r_target_inode);
529 if (req->r_dentry) 528 if (req->r_dentry)
530 dput(req->r_dentry); 529 dput(req->r_dentry);
531 if (req->r_old_dentry) 530 if (req->r_old_dentry)
@@ -1066,8 +1065,7 @@ out:
1066 session->s_cap_iterator = NULL; 1065 session->s_cap_iterator = NULL;
1067 spin_unlock(&session->s_cap_lock); 1066 spin_unlock(&session->s_cap_lock);
1068 1067
1069 if (last_inode) 1068 iput(last_inode);
1070 iput(last_inode);
1071 if (old_cap) 1069 if (old_cap)
1072 ceph_put_cap(session->s_mdsc, old_cap); 1070 ceph_put_cap(session->s_mdsc, old_cap);
1073 1071
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index f01645a27752..c1cc993225e3 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -365,8 +365,7 @@ static int build_snap_context(struct ceph_snap_realm *realm)
365 realm->ino, realm, snapc, snapc->seq, 365 realm->ino, realm, snapc, snapc->seq,
366 (unsigned int) snapc->num_snaps); 366 (unsigned int) snapc->num_snaps);
367 367
368 if (realm->cached_context) 368 ceph_put_snap_context(realm->cached_context);
369 ceph_put_snap_context(realm->cached_context);
370 realm->cached_context = snapc; 369 realm->cached_context = snapc;
371 return 0; 370 return 0;
372 371
@@ -590,15 +589,13 @@ static void queue_realm_cap_snaps(struct ceph_snap_realm *realm)
590 if (!inode) 589 if (!inode)
591 continue; 590 continue;
592 spin_unlock(&realm->inodes_with_caps_lock); 591 spin_unlock(&realm->inodes_with_caps_lock);
593 if (lastinode) 592 iput(lastinode);
594 iput(lastinode);
595 lastinode = inode; 593 lastinode = inode;
596 ceph_queue_cap_snap(ci); 594 ceph_queue_cap_snap(ci);
597 spin_lock(&realm->inodes_with_caps_lock); 595 spin_lock(&realm->inodes_with_caps_lock);
598 } 596 }
599 spin_unlock(&realm->inodes_with_caps_lock); 597 spin_unlock(&realm->inodes_with_caps_lock);
600 if (lastinode) 598 iput(lastinode);
601 iput(lastinode);
602 599
603 list_for_each_entry(child, &realm->children, child_item) { 600 list_for_each_entry(child, &realm->children, child_item) {
604 dout("queue_realm_cap_snaps %p %llx queue child %p %llx\n", 601 dout("queue_realm_cap_snaps %p %llx queue child %p %llx\n",