smb: simplify boolean expressions
Subsystems (3)
cover smb: simplify boolean expressions
This series simplifies boolean expressions in the SMB code by removing redundant comparisons with true/false.
Adarsh Das (2):
smb: remove redundant == true comparisons
smb: remove redundant == false comparisons
fs/smb/client/cifsacl.c | 2 +- fs/smb/client/connect.c | 6 ++--- fs/smb/client/file.c | 5 ++-- fs/smb/client/fs_context.c | 6 ++--- fs/smb/client/misc.c | 2 +- fs/smb/client/smb2misc.c | 4 ++-- fs/smb/client/smb2ops.c | 12 +++++----- fs/smb/client/smb2pdu.c | 2 +- fs/smb/client/transport.c | 2 +- fs/smb/server/oplock.c | 6 ++--- fs/smb/server/server.c | 2 +- fs/smb/server/smb2misc.c | 2 +- fs/smb/server/smb2pdu.c | 44 ++++++++++++++++------------------ fs/smb/server/smb_common.c | 2 +- fs/smb/server/transport_rdma.c | 2 +- fs/smb/server/vfs.c | 8 +++---- fs/smb/server/vfs_cache.c | 6 ++--- 17 files changed, 55 insertions(+), 58 deletions(-)
Signature · 1 line
2.53.0
PATCH 1/2 smb: remove redundant == true comparisons
Remove "== true" comparisons with boolean variables. Should improve readability.
--- fs/smb/client/connect.c | 4 ++-- fs/smb/client/misc.c | 2 +- fs/smb/client/smb2ops.c | 4 ++-- fs/smb/server/server.c | 2 +- fs/smb/server/smb2pdu.c | 12 ++++++------ fs/smb/server/vfs.c | 8 ++++---- fs/smb/server/vfs_cache.c | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-)
fs/smb/client/connect.c +2 -2
@@ -962,7 +962,7 @@ dequeue_mid(struct TCP_Server_Info *server, struct mid_q_entry *mid, bool malfor* Trying to handle/dequeue a mid after the send_recv() * function has finished processing it is a bug. */ -if (mid->deleted_from_q == true) { +if (mid->deleted_from_q) {spin_unlock (&server->mid_queue_lock);pr_warn_once ("trying to dequeue a deleted mid\n" ); }else {
@@ -3675,7 +3675,7 @@ int cifs_mount_get_session(struct cifs_mount_ctx *mnt_ctx) goto out; } -if ((ctx->persistent == true) && (!(ses->server->capabilities & +if (ctx->persistent && (!(ses->server->capabilities &SMB2_GLOBAL_CAP_PERSISTENT_HANDLES ))) {cifs_server_dbg (VFS ,"persistent handles not supported by server\n" ); rc = -EOPNOTSUPP ;
fs/smb/client/misc.c +1 -1
@@ -122,7 +122,7 @@ tcon_info_alloc(bool dir_leases_enabled, enum smb3_tcon_ref_trace trace)if (!ret_buf)return NULL ; -if (dir_leases_enabled == true) { +if (dir_leases_enabled) { ret_buf->cfids =init_cached_dirs ();if (!ret_buf->cfids) {kfree (ret_buf);
fs/smb/client/smb2ops.c +2 -2
@@ -3681,7 +3681,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, goto out; } -if (keep_size == true) { +if (keep_size) {/* * We can not preallocate pages beyond the end of the file * in SMB2
@@ -3699,7 +3699,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, } } -if ((keep_size == true) || (i_size_read (inode) >= off + len)) { +if (keep_size || (i_size_read (inode) >= off + len)) {/* * At this point, we are trying to fallocate an internal * regions of a sparse file. Since smb2 does not have a
fs/smb/server/server.c +1 -1
@@ -235,7 +235,7 @@ static void __handle_ksmbd_work(struct ksmbd_work *work, (work->sess->sign ||smb3_11_final_sess_setup_resp (work) || conn->ops->is_sign_req(work, command))) conn->ops->set_sign_rsp(work); - }while (is_chained == true); + }while (is_chained); send:if (work->tcon)
fs/smb/server/smb2pdu.c +6 -6
@@ -2601,7 +2601,7 @@ static int smb2_creat(struct ksmbd_work *work,return -EBADF ;ksmbd_debug (SMB ,"file does not exist, so creating\n" ); -if (is_dir == true) { +if (is_dir) {ksmbd_debug (SMB ,"creating directory\n" ); mode =share_config_directory_mode (share, posix_mode);
@@ -2987,7 +2987,7 @@ int smb2_open(struct ksmbd_work *work) goto err_out2; } -if (dh_info.reconnected == true) { +if (dh_info.reconnected) { rc =smb2_check_durable_oplock (conn, share, dh_info.fp, lc, name);if (rc) {ksmbd_put_durable_fd (dh_info.fp);
@@ -6222,7 +6222,7 @@ static int set_file_allocation_info(struct ksmbd_work *work,if (!(fp->daccess &FILE_WRITE_DATA_LE ))return -EACCES ; -if (ksmbd_stream_fd (fp) == true) +if (ksmbd_stream_fd (fp))return 0 ; rc = vfs_getattr(&fp->filp->f_path, &stat, STATX_BASIC_STATS,
@@ -6779,7 +6779,7 @@ int smb2_read(struct ksmbd_work *work) } } -if (is_rdma_channel == true) { +if (is_rdma_channel) {unsigned int ch_offset =le16_to_cpu (req->ReadChannelInfoOffset);if (ch_offset < offsetof(struct smb2_read_req , Buffer)) {
@@ -6849,7 +6849,7 @@ int smb2_read(struct ksmbd_work *work)ksmbd_debug (SMB ,"nbytes %zu, offset %lld mincount %zu\n" , nbytes, offset, mincount); -if (is_rdma_channel == true) { +if (is_rdma_channel) {/* write data to the client using rdma channel */ remain_bytes = smb2_read_rdma_channel(work, req, aux_payload_buf,
@@ -7043,7 +7043,7 @@ int smb2_write(struct ksmbd_work *work) length =le32_to_cpu (req->RemainingBytes); } -if (is_rdma_channel == true) { +if (is_rdma_channel) {unsigned int ch_offset =le16_to_cpu (req->WriteChannelInfoOffset); if (req->Length != 0 || req->DataOffset != 0 ||
fs/smb/server/vfs.c +4 -4
@@ -877,7 +877,7 @@ int ksmbd_vfs_setxattr(struct mnt_idmap *idmap, {int err; -if (get_write == true) { +if (get_write) { err =mnt_want_write (path->mnt);if (err)return err;
@@ -891,7 +891,7 @@ int ksmbd_vfs_setxattr(struct mnt_idmap *idmap, flags);if (err)ksmbd_debug (VFS ,"setxattr failed, err %d\n" , err); -if (get_write == true) +if (get_write)mnt_drop_write (path->mnt);return err; }
@@ -1001,7 +1001,7 @@ int ksmbd_vfs_remove_xattr(struct mnt_idmap *idmap, {int err; -if (get_write == true) { +if (get_write) { err =mnt_want_write (path->mnt);if (err)return err;
@@ -1009,7 +1009,7 @@ int ksmbd_vfs_remove_xattr(struct mnt_idmap *idmap, err =vfs_removexattr (idmap, path->dentry, attr_name); -if (get_write == true) +if (get_write)mnt_drop_write (path->mnt);return err;
fs/smb/server/vfs_cache.c +1 -1
@@ -863,7 +863,7 @@ void ksmbd_launch_ksmbd_durable_scavenger(void)return ;mutex_lock (&durable_scavenger_lock); -if (durable_scavenger_running == true) { +if (durable_scavenger_running) {mutex_unlock (&durable_scavenger_lock);return ; }
Signature · 1 line
2.53.0
PATCH 2/2 smb: remove redundant == false comparisons
In reply to Adarsh DasReplace "== false" with "!" operator. This should improve readability.
--- fs/smb/client/cifsacl.c | 2 +- fs/smb/client/connect.c | 2 +- fs/smb/client/file.c | 5 ++--- fs/smb/client/fs_context.c | 6 +++--- fs/smb/client/smb2misc.c | 4 ++-- fs/smb/client/smb2ops.c | 8 ++++---- fs/smb/client/smb2pdu.c | 2 +- fs/smb/client/transport.c | 2 +- fs/smb/server/oplock.c | 6 +++--- fs/smb/server/smb2misc.c | 2 +- fs/smb/server/smb2pdu.c | 32 +++++++++++++++----------------- fs/smb/server/smb_common.c | 2 +- fs/smb/server/transport_rdma.c | 2 +- fs/smb/server/vfs_cache.c | 4 ++-- 14 files changed, 38 insertions(+), 41 deletions(-)
fs/smb/client/cifsacl.c +1 -1
@@ -367,7 +367,7 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct smb_sid *psid,else is_group = false; -if (is_well_known_sid (psid, &unix_id, is_group) == false) +if (!is_well_known_sid (psid, &unix_id, is_group)) goto try_upcall_to_get_id;if (is_group) {
fs/smb/client/connect.c +1 -1
@@ -2801,7 +2801,7 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) } }else if ((tcon->capabilities &SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY ) && (ses->server->capabilities &SMB2_GLOBAL_CAP_PERSISTENT_HANDLES ) - && (ctx->nopersistent == false)) { + && !ctx->nopersistent) {cifs_dbg (FYI ,"enabling persistent handles\n" ); tcon->use_persistent = true; }else if (ctx->resilient) {
fs/smb/client/file.c +2 -3
@@ -1350,7 +1350,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)* not dirty locally we could do this. */ rc = server->ops->open (xid, &oparms, &oplock,NULL ); -if (rc == -ENOENT && oparms.reconnect == false) { +if (rc == -ENOENT && !oparms.reconnect) {/* durable handle timeout is expired - open the file again */ rc = server->ops->open (xid, &oparms, &oplock,NULL );/* indicate that we need to relock the file */
@@ -1459,8 +1459,7 @@ int cifs_close(struct inode *inode, struct file *file) cfile = file->private_data; file->private_data =NULL ; dclose =kmalloc (sizeof (struct cifs_deferred_close ),GFP_KERNEL ); -if ((cfile->status_file_deleted == false) && - (smb2_can_defer_close (inode, dclose))) { +if (!cfile->status_file_deleted &&smb2_can_defer_close (inode, dclose)) {if (test_and_clear_bit (NETFS_ICTX_MODIFIED_ATTR , &cinode->netfs.flags)) {inode_set_mtime_to_ts (inode,inode_set_ctime_current (inode));
fs/smb/client/fs_context.c +3 -3
@@ -851,7 +851,7 @@ static int smb3_fs_context_validate(struct fs_context *fc) }#endif -if (ctx->got_version == false) +if (!ctx->got_version)pr_warn_once ("No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3.1.1), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3.1.1 (or even SMB3 or SMB2.1) specify vers=1.0 on mount.\n" );
@@ -977,7 +977,7 @@ static int smb3_verify_reconfigure_ctx(struct fs_context *fc, }if (new_ctx->password && (!old_ctx->password ||strcmp (new_ctx->password, old_ctx->password))) { -if (need_recon == false) { +if (!need_recon) {cifs_errorf (fc,"can not change password of active session during remount\n" );return -EINVAL ;
@@ -1100,7 +1100,7 @@ static int smb3_reconfigure(struct fs_context *fc)STEAL_STRING (cifs_sb, ctx, source);STEAL_STRING (cifs_sb, ctx, username); -if (need_recon == false) +if (!need_recon)STEAL_STRING_SENSITIVE (cifs_sb, ctx, password);else {if (ctx->password) {
fs/smb/client/smb2misc.c +2 -2
@@ -425,7 +425,7 @@ smb2_calc_size(void *buf)*/ len +=le16_to_cpu (pdu->StructureSize2); -if (has_smb2_data_area[le16_to_cpu (shdr->Command)] == false) +if (!has_smb2_data_area[le16_to_cpu (shdr->Command)]) goto calc_size_exit;smb2_get_data_area_len (&offset, &data_length, shdr);
@@ -808,7 +808,7 @@ __smb2_handle_cancelled_cmd(struct cifs_tcon *tcon, __u16 cmd, __u64 mid, cancelled->cmd = cmd; cancelled->mid = mid;INIT_WORK (&cancelled->work, smb2_cancelled_close_fid); -WARN_ON (queue_work (cifsiod_wq, &cancelled->work) == false); +WARN_ON (!queue_work (cifsiod_wq, &cancelled->work));return 0 ; }
fs/smb/client/smb2ops.c +4 -4
@@ -3403,7 +3403,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,/* if file not oplocked can't be sure whether asking to extend size */ rc = -EOPNOTSUPP ; -if (keep_size == false && !CIFS_CACHE_READ (cifsi)) +if (!keep_size && !CIFS_CACHE_READ (cifsi)) goto zero_range_exit; rc =smb3_zero_data (file, tcon, offset, len, xid);
@@ -3414,7 +3414,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,* do we also need to change the size of the file? */ new_size = offset + len; -if (keep_size == false && (unsigned long long )i_size_read (inode) < new_size) { +if (!keep_size && (unsigned long long )i_size_read (inode) < new_size) { rc =SMB2_set_eof (xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, cfile->pid, new_size);if (rc >=0 ) {
@@ -3643,7 +3643,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, tcon->ses->Suid, off, len);/* if file not oplocked can't be sure whether asking to extend size */ if (!CIFS_CACHE_READ (cifsi)) -if (keep_size == false) { +if (!keep_size) {trace_smb3_falloc_err (xid, cfile->fid.persistent_fid, tcon->tid, tcon->ses->Suid, off, len, rc);free_xid (xid);
@@ -3653,7 +3653,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,/* * Extending the file */ -if ((keep_size == false) &&i_size_read (inode) < off + len) { +if (!keep_size &&i_size_read (inode) < off + len) { rc =inode_newsize_ok (inode, off + len);if (rc) goto out;
fs/smb/client/smb2pdu.c +1 -1
@@ -1636,7 +1636,7 @@ SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data)if (rc ==0 ) sess_data->ses->expired_pwd = false;else if ((rc == -EACCES ) || (rc == -EKEYEXPIRED ) || (rc == -EKEYREVOKED )) { -if (sess_data->ses->expired_pwd == false) +if (!sess_data->ses->expired_pwd) trace_smb3_key_expired(sess_data->server->hostname, sess_data->ses->user_name, sess_data->server->conn_id,
fs/smb/client/transport.c +1 -1
@@ -762,7 +762,7 @@ int cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server rc = mid->mid_rc;break ;default : -if (mid->deleted_from_q == false) { +if (!mid->deleted_from_q) {list_del_init (&mid->qhead); mid->deleted_from_q = true; }
fs/smb/server/oplock.c +3 -3
@@ -583,7 +583,7 @@ static int oplock_break_pending(struct oplock_info *opinfo, int req_op_level)if (opinfo->op_state ==OPLOCK_CLOSING )return -ENOENT ;else if (opinfo->level <= req_op_level) { -if (opinfo->is_lease == false) +if (!opinfo->is_lease)return 1 ; if (opinfo->o_lease->state !=
@@ -594,7 +594,7 @@ static int oplock_break_pending(struct oplock_info *opinfo, int req_op_level) }if (opinfo->level <= req_op_level) { -if (opinfo->is_lease == false) { +if (!opinfo->is_lease) {wake_up_oplock_break (opinfo);return 1 ; }
@@ -1816,7 +1816,7 @@ int smb2_check_durable_oplock(struct ksmbd_conn *conn,if (!opinfo)return 0 ; -if (opinfo->is_lease == false) { +if (!opinfo->is_lease) {if (lctx) {pr_err ("create context include lease\n" ); ret = -EBADF ;
fs/smb/server/smb2misc.c +1 -1
@@ -228,7 +228,7 @@ static int smb2_calc_size(void *buf, unsigned int *len)if (hdr->Command ==SMB2_LOCK ) *len -=sizeof (struct smb2_lock_element ); -if (has_smb2_data_area[le16_to_cpu (hdr->Command)] == false) +if (!has_smb2_data_area[le16_to_cpu (hdr->Command)]) goto calc_size_exit; ret =smb2_get_data_area_len (&offset, &data_length, hdr);
fs/smb/server/smb2pdu.c +15 -17
@@ -1488,7 +1488,7 @@ static int ntlm_authenticate(struct ksmbd_work *work,* Reuse session if anonymous try to connect * on reauthetication. */ -if (conn->binding == false &&ksmbd_anonymous_user (user)) { +if (!conn->binding &&ksmbd_anonymous_user (user)) {ksmbd_free_user (user);return 0 ; }
@@ -1502,7 +1502,7 @@ static int ntlm_authenticate(struct ksmbd_work *work, sess->user = user; } -if (conn->binding == false &&user_guest (sess->user)) { +if (!conn->binding &&user_guest (sess->user)) { rsp->SessionFlags =SMB2_SESSION_FLAG_IS_GUEST_LE ; }else {struct authenticate_message *authblob;
@@ -2945,7 +2945,7 @@ int smb2_open(struct ksmbd_work *work)ksmbd_debug (SMB ,"converted name = %s\n" , name); -if (posix_ctxt == false) { +if (!posix_ctxt) {if (strchr (name,':' )) {if (!test_share_config_flag (work->tcon->share_conf,KSMBD_SHARE_FLAG_STREAMS )) {
@@ -3553,7 +3553,7 @@ int smb2_open(struct ksmbd_work *work) query_disk_id =1 ; } -if (conn->is_aapl == false) { +if (!conn->is_aapl) { context =smb2_find_context_vals (req,SMB2_CREATE_AAPL ,4 );if (IS_ERR (context)) { rc =PTR_ERR (context);
@@ -4874,7 +4874,7 @@ static int get_file_standard_info(struct smb2_query_info_rsp *rsp, sinfo = (struct smb2_file_standard_info *)rsp->Buffer; delete_pending =ksmbd_inode_pending_delete (fp); -if (ksmbd_stream_fd (fp) == false) { +if (!ksmbd_stream_fd (fp)) { sinfo->AllocationSize =cpu_to_le64 (stat.blocks <<9 ); sinfo->EndOfFile =S_ISDIR (stat.mode) ?0 :cpu_to_le64 (stat.size); }else {
@@ -4945,7 +4945,7 @@ static int get_file_all_info(struct ksmbd_work *work, file_info->ChangeTime =cpu_to_le64 (time); file_info->Attributes = fp->f_ci->m_fattr; file_info->Pad1 =0 ; -if (ksmbd_stream_fd (fp) == false) { +if (!ksmbd_stream_fd (fp)) { file_info->AllocationSize =cpu_to_le64 (stat.blocks <<9 ); file_info->EndOfFile =S_ISDIR (stat.mode) ?0 :cpu_to_le64 (stat.size);
@@ -4961,7 +4961,7 @@ static int get_file_all_info(struct ksmbd_work *work, file_info->IndexNumber =cpu_to_le64 (stat.ino); file_info->EASize =0 ; file_info->AccessFlags = fp->daccess; -if (ksmbd_stream_fd (fp) == false) +if (!ksmbd_stream_fd (fp)) file_info->CurrentByteOffset =cpu_to_le64 (fp->filp->f_pos);else file_info->CurrentByteOffset =cpu_to_le64 (fp->stream.pos);
@@ -5152,7 +5152,7 @@ static int get_file_network_open_info(struct smb2_query_info_rsp *rsp, time =ksmbd_UnixTimeToNT (stat.ctime); file_info->ChangeTime =cpu_to_le64 (time); file_info->Attributes = fp->f_ci->m_fattr; -if (ksmbd_stream_fd (fp) == false) { +if (!ksmbd_stream_fd (fp)) { file_info->AllocationSize =cpu_to_le64 (stat.blocks <<9 ); file_info->EndOfFile =S_ISDIR (stat.mode) ?0 :cpu_to_le64 (stat.size); }else {
@@ -5181,7 +5181,7 @@ static void get_file_position_info(struct smb2_query_info_rsp *rsp,struct smb2_file_pos_info *file_info; file_info = (struct smb2_file_pos_info *)rsp->Buffer; -if (ksmbd_stream_fd (fp) == false) +if (!ksmbd_stream_fd (fp)) file_info->CurrentByteOffset =cpu_to_le64 (fp->filp->f_pos);else file_info->CurrentByteOffset =cpu_to_le64 (fp->stream.pos);
@@ -5274,7 +5274,7 @@ static int find_file_posix_info(struct smb2_query_info_rsp *rsp, file_info->ChangeTime =cpu_to_le64 (time); file_info->DosAttributes = fp->f_ci->m_fattr; file_info->Inode =cpu_to_le64 (stat.ino); -if (ksmbd_stream_fd (fp) == false) { +if (!ksmbd_stream_fd (fp)) { file_info->EndOfFile =cpu_to_le64 (stat.size); file_info->AllocationSize =cpu_to_le64 (stat.blocks <<9 ); }else {
@@ -6001,7 +6001,7 @@ static int smb2_rename(struct ksmbd_work *work,if (IS_ERR (new_name))return PTR_ERR (new_name); -if (fp->is_posix_ctxt == false &&strchr (new_name,':' )) { +if (!fp->is_posix_ctxt &&strchr (new_name,':' )) {int s_type;char *xattr_stream_name, *stream_name =NULL ;size_t xattr_stream_size;
@@ -6283,8 +6283,7 @@ static int set_end_of_file_info(struct ksmbd_work *work, struct ksmbd_file *fp,* truncate of some filesystem like FAT32 fill zero data in * truncated range. */ -if (inode->i_sb->s_magic !=MSDOS_SUPER_MAGIC && -ksmbd_stream_fd (fp) == false) { +if (inode->i_sb->s_magic !=MSDOS_SUPER_MAGIC && !ksmbd_stream_fd (fp)) {ksmbd_debug (SMB ,"truncated to newsize %lld\n" , newsize); rc =ksmbd_vfs_truncate (work, fp, newsize);if (rc) {
@@ -6357,7 +6356,7 @@ static int set_file_position_info(struct ksmbd_file *fp,return -EINVAL ; } -if (ksmbd_stream_fd (fp) == false) +if (!ksmbd_stream_fd (fp)) fp->filp->f_pos = current_byte_offset;else {if (current_byte_offset >XATTR_SIZE_MAX )
@@ -7089,7 +7088,7 @@ int smb2_write(struct ksmbd_work *work)if (le32_to_cpu (req->Flags) &SMB2_WRITEFLAG_WRITE_THROUGH ) writethrough = true; -if (is_rdma_channel == false) { +if (!is_rdma_channel) {if (le16_to_cpu (req->DataOffset) < offsetof(struct smb2_write_req , Buffer)) { err = -EINVAL ;
@@ -8982,8 +8981,7 @@ void smb3_set_sign_rsp(struct ksmbd_work *work) hdr =ksmbd_resp_buf_curr (work); -if (conn->binding == false && -le16_to_cpu (hdr->Command) ==SMB2_SESSION_SETUP_HE ) { +if (!conn->binding &&le16_to_cpu (hdr->Command) ==SMB2_SESSION_SETUP_HE ) { signing_key = work->sess->smb3signingkey; }else { chann =lookup_chann_list (work->sess, work->conn);
fs/smb/server/smb_common.c +1 -1
@@ -415,7 +415,7 @@ int ksmbd_init_smb_server(struct ksmbd_conn *conn)__le32 proto; proto = *(__le32 *)rcv_hdr->Protocol; -if (conn->need_neg == false) { +if (!conn->need_neg) {if (proto ==SMB1_PROTO_NUMBER )return -EINVAL ;return 0 ;
fs/smb/server/transport_rdma.c +1 -1
@@ -2785,7 +2785,7 @@ static bool ksmbd_find_rdma_capable_netdev(struct net_device *netdev) out:read_unlock (&smb_direct_device_lock); -if (rdma_capable == false) { +if (!rdma_capable) {struct ib_device *ibdev; ibdev =ib_device_get_by_netdev (netdev,RDMA_DRIVER_UNKNOWN );
fs/smb/server/vfs_cache.c +2 -2
@@ -810,7 +810,7 @@ static int ksmbd_durable_scavenger(void *dummy) found_fp_timeout = false; remaining_jiffies =wait_event_timeout (dh_wq, -ksmbd_durable_scavenger_alive () == false, + !ksmbd_durable_scavenger_alive (),__msecs_to_jiffies (min_timeout));if (remaining_jiffies) min_timeout =jiffies_to_msecs (remaining_jiffies);
@@ -846,7 +846,7 @@ static int ksmbd_durable_scavenger(void *dummy)ksmbd_scavenger_dispose_dh (&scavenger_list); -if (found_fp_timeout == false) +if (!found_fp_timeout)break ; }
Signature · 1 line
2.53.0
After getting feedback from others, it was felt that these two patches (eliminating the "== true" and "== false") don't improve readability enough to justify the risk that they would complicate future backports
of fixes. If we were already changing related code for a fix then
cleanup like this could be added on to a fix but not worth the risk if not related to a fix
Quoted 31 lines · Adarsh Das
This series simplifies boolean expressions in the SMB code by removing redundant comparisons with true/false.
Adarsh Das (2):
smb: remove redundant == true comparisons
smb: remove redundant == false comparisonsfs/smb/client/cifsacl.c | 2 +- fs/smb/client/connect.c | 6 ++--- fs/smb/client/file.c | 5 ++-- fs/smb/client/fs_context.c | 6 ++--- fs/smb/client/misc.c | 2 +- fs/smb/client/smb2misc.c | 4 ++-- fs/smb/client/smb2ops.c | 12 +++++----- fs/smb/client/smb2pdu.c | 2 +- fs/smb/client/transport.c | 2 +- fs/smb/server/oplock.c | 6 ++--- fs/smb/server/server.c | 2 +- fs/smb/server/smb2misc.c | 2 +- fs/smb/server/smb2pdu.c | 44 ++++++++++++++++------------------ fs/smb/server/smb_common.c | 2 +- fs/smb/server/transport_rdma.c | 2 +- fs/smb/server/vfs.c | 8 +++---- fs/smb/server/vfs_cache.c | 6 ++--- 17 files changed, 55 insertions(+), 58 deletions(-)--
2.53.0
Signature · 3 lines
Thanks, Steve