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

fuse: refactor fuse_conn_put() to remove negative logic.

There is no functional change with this patch. It simply refactors
function fuse_conn_put() to not use negative logic, which makes it more
easier to read.

Signed-off-by: Luis Henriques <luis@igalia.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

authored by

Luis Henriques and committed by
Miklos Szeredi
b4909ae8 64becd22

+20 -19
+20 -19
fs/fuse/inode.c
··· 1022 1022 1023 1023 void fuse_conn_put(struct fuse_conn *fc) 1024 1024 { 1025 - if (refcount_dec_and_test(&fc->count)) { 1026 - struct fuse_iqueue *fiq = &fc->iq; 1027 - struct fuse_sync_bucket *bucket; 1025 + struct fuse_iqueue *fiq = &fc->iq; 1026 + struct fuse_sync_bucket *bucket; 1028 1027 1029 - if (IS_ENABLED(CONFIG_FUSE_DAX)) 1030 - fuse_dax_conn_free(fc); 1031 - if (fc->timeout.req_timeout) 1032 - cancel_delayed_work_sync(&fc->timeout.work); 1033 - cancel_work_sync(&fc->epoch_work); 1034 - if (fiq->ops->release) 1035 - fiq->ops->release(fiq); 1036 - put_pid_ns(fc->pid_ns); 1037 - bucket = rcu_dereference_protected(fc->curr_bucket, 1); 1038 - if (bucket) { 1039 - WARN_ON(atomic_read(&bucket->count) != 1); 1040 - kfree(bucket); 1041 - } 1042 - if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH)) 1043 - fuse_backing_files_free(fc); 1044 - call_rcu(&fc->rcu, delayed_release); 1028 + if (!refcount_dec_and_test(&fc->count)) 1029 + return; 1030 + 1031 + if (IS_ENABLED(CONFIG_FUSE_DAX)) 1032 + fuse_dax_conn_free(fc); 1033 + if (fc->timeout.req_timeout) 1034 + cancel_delayed_work_sync(&fc->timeout.work); 1035 + cancel_work_sync(&fc->epoch_work); 1036 + if (fiq->ops->release) 1037 + fiq->ops->release(fiq); 1038 + put_pid_ns(fc->pid_ns); 1039 + bucket = rcu_dereference_protected(fc->curr_bucket, 1); 1040 + if (bucket) { 1041 + WARN_ON(atomic_read(&bucket->count) != 1); 1042 + kfree(bucket); 1045 1043 } 1044 + if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH)) 1045 + fuse_backing_files_free(fc); 1046 + call_rcu(&fc->rcu, delayed_release); 1046 1047 } 1047 1048 EXPORT_SYMBOL_GPL(fuse_conn_put); 1048 1049