From: Enzo Matsumiya <ematsumiya@suse.de>
To: linux-cifs@vger.kernel.org
Cc: smfrench@gmail.com, pc@cjr.nz, ronniesahlberg@gmail.com,
nspmangalore@gmail.com
Subject: [RFC PATCH 09/14] cifs: typedef tcon status enum
Date: Sun, 24 Jul 2022 12:11:32 -0300 [thread overview]
Message-ID: <20220724151137.7538-10-ematsumiya@suse.de> (raw)
In-Reply-To: <20220724151137.7538-1-ematsumiya@suse.de>
typedef "enum tid_status_enum" to "cifs_tcon_status_t".
Rename the status values.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifsfs.c | 4 ++--
fs/cifs/cifsglob.h | 22 +++++++++++-----------
fs/cifs/cifssmb.c | 11 ++++++-----
fs/cifs/connect.c | 32 ++++++++++++++++----------------
fs/cifs/misc.c | 2 +-
fs/cifs/smb2pdu.c | 4 ++--
6 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 6db4b008dbb1..a8eb41657859 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -712,14 +712,14 @@ static void cifs_umount_begin(struct super_block *sb)
tcon = cifs_sb_master_tcon(cifs_sb);
spin_lock(&g_servers_lock);
- if ((tcon->tc_count > 1) || (tcon->status == TID_EXITING)) {
+ if ((tcon->tc_count > 1) || (tcon->status == TCON_STATUS_EXITING)) {
/* we have other mounts to same share or we have
already tried to force umount this and woken up
all waiting network requests, nothing to do */
spin_unlock(&g_servers_lock);
return;
} else if (tcon->tc_count == 1)
- tcon->status = TID_EXITING;
+ tcon->status = TCON_STATUS_EXITING;
spin_unlock(&g_servers_lock);
/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 0fa23f392bb9..dddd63b6dc82 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -130,16 +130,16 @@ typedef enum {
} cifs_ses_status_t;
/* associated with each tree connection to the server */
-enum tid_status_enum {
- TID_NEW = 0,
- TID_GOOD,
- TID_EXITING,
- TID_NEED_RECON,
- TID_NEED_TCON,
- TID_IN_TCON,
- TID_NEED_FILES_INVALIDATE, /* currently unused */
- TID_IN_FILES_INVALIDATE
-};
+typedef enum {
+ TCON_STATUS_NEW = 0,
+ TCON_STATUS_GOOD,
+ TCON_STATUS_EXITING,
+ TCON_STATUS_NEED_RECONNECT,
+ TCON_STATUS_NEED_TCON,
+ TCON_STATUS_IN_TCON,
+ TCON_STATUS_NEED_FILES_INVALIDATE, /* currently unused */
+ TCON_STATUS_IN_FILES_INVALIDATE
+} cifs_tcon_status_t;
enum securityEnum {
Unspecified = 0, /* not specified */
@@ -1179,7 +1179,7 @@ struct cifs_tcon {
char *password; /* for share-level security */
__u32 tid; /* The 4 byte tree id */
__u16 Flags; /* optional support bits */
- enum tid_status_enum status;
+ cifs_tcon_status_t status;
atomic_t num_smbs_sent;
union {
struct {
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 25009dd47f96..e286bb535c5d 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -75,11 +75,12 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
/* only send once per connect */
spin_lock(&g_servers_lock);
- if ((tcon->ses->status != SES_STATUS_GOOD) || (tcon->status != TID_NEED_RECON)) {
+ if ((tcon->ses->status != SES_STATUS_GOOD) ||
+ (tcon->status != TCON_STATUS_NEED_RECONNECT)) {
spin_unlock(&g_servers_lock);
return;
}
- tcon->status = TID_IN_FILES_INVALIDATE;
+ tcon->status = TCON_STATUS_IN_FILES_INVALIDATE;
spin_unlock(&g_servers_lock);
/* list all files open on tree connection and mark them invalid */
@@ -99,8 +100,8 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
mutex_unlock(&tcon->crfid.fid_mutex);
spin_lock(&g_servers_lock);
- if (tcon->status == TID_IN_FILES_INVALIDATE)
- tcon->status = TID_NEED_TCON;
+ if (tcon->status == TCON_STATUS_IN_FILES_INVALIDATE)
+ tcon->status = TCON_STATUS_NEED_TCON;
spin_unlock(&g_servers_lock);
/*
@@ -135,7 +136,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
* have tcon) are allowed as we start force umount
*/
spin_lock(&g_servers_lock);
- if (tcon->status == TID_EXITING) {
+ if (tcon->status == TCON_STATUS_EXITING) {
if (smb_command != SMB_COM_WRITE_ANDX &&
smb_command != SMB_COM_OPEN_ANDX &&
smb_command != SMB_COM_TREE_DISCONNECT) {
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 55264aef1b83..467f1b598eec 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -281,7 +281,7 @@ cifs_mark_server_conns_for_reconnect(struct cifs_server_info *server,
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
tcon->need_reconnect = true;
- tcon->status = TID_NEED_RECON;
+ tcon->status = TCON_STATUS_NEED_RECONNECT;
}
if (ses->tcon_ipc)
ses->tcon_ipc->need_reconnect = true;
@@ -2237,7 +2237,7 @@ cifs_get_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx)
static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
{
- if (tcon->status == TID_EXITING)
+ if (tcon->status == TCON_STATUS_EXITING)
return 0;
if (strncmp(tcon->treeName, ctx->UNC, MAX_TREE_SIZE))
return 0;
@@ -4560,12 +4560,12 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
/* only send once per connect */
spin_lock(&g_servers_lock);
if (tcon->ses->status != SES_STATUS_GOOD ||
- (tcon->status != TID_NEW &&
- tcon->status != TID_NEED_TCON)) {
+ (tcon->status != TCON_STATUS_NEW &&
+ tcon->status != TCON_STATUS_NEED_TCON)) {
spin_unlock(&g_servers_lock);
return 0;
}
- tcon->status = TID_IN_TCON;
+ tcon->status = TCON_STATUS_IN_TCON;
spin_unlock(&g_servers_lock);
tree = kzalloc(MAX_TREE_SIZE, GFP_KERNEL);
@@ -4606,13 +4606,13 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
if (rc) {
spin_lock(&g_servers_lock);
- if (tcon->status == TID_IN_TCON)
- tcon->status = TID_NEED_TCON;
+ if (tcon->status == TCON_STATUS_IN_TCON)
+ tcon->status = TCON_STATUS_NEED_TCON;
spin_unlock(&g_servers_lock);
} else {
spin_lock(&g_servers_lock);
- if (tcon->status == TID_IN_TCON)
- tcon->status = TID_GOOD;
+ if (tcon->status == TCON_STATUS_IN_TCON)
+ tcon->status = TCON_STATUS_GOOD;
spin_unlock(&g_servers_lock);
tcon->need_reconnect = false;
}
@@ -4628,24 +4628,24 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
/* only send once per connect */
spin_lock(&g_servers_lock);
if (tcon->ses->status != SES_STATUS_GOOD ||
- (tcon->status != TID_NEW &&
- tcon->status != TID_NEED_TCON)) {
+ (tcon->status != TCON_STATUS_NEW &&
+ tcon->status != TCON_STATUS_NEED_TCON)) {
spin_unlock(&g_servers_lock);
return 0;
}
- tcon->status = TID_IN_TCON;
+ tcon->status = TCON_STATUS_IN_TCON;
spin_unlock(&g_servers_lock);
rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc);
if (rc) {
spin_lock(&g_servers_lock);
- if (tcon->status == TID_IN_TCON)
- tcon->status = TID_NEED_TCON;
+ if (tcon->status == TCON_STATUS_IN_TCON)
+ tcon->status = TCON_STATUS_NEED_TCON;
spin_unlock(&g_servers_lock);
} else {
spin_lock(&g_servers_lock);
- if (tcon->status == TID_IN_TCON)
- tcon->status = TID_GOOD;
+ if (tcon->status == TCON_STATUS_IN_TCON)
+ tcon->status = TCON_STATUS_GOOD;
spin_unlock(&g_servers_lock);
tcon->need_reconnect = false;
}
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index e209aa3194de..c37ad2bb3ac4 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -124,7 +124,7 @@ tconInfoAlloc(void)
mutex_init(&ret_buf->crfid.dirents.de_mutex);
atomic_inc(&g_tcon_alloc_count);
- ret_buf->status = TID_NEW;
+ ret_buf->status = TCON_STATUS_NEW;
++ret_buf->tc_count;
INIT_LIST_HEAD(&ret_buf->openFileList);
INIT_LIST_HEAD(&ret_buf->tcon_list);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index e495121f7d99..73d28b2b4517 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -163,7 +163,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
return 0;
spin_lock(&g_servers_lock);
- if (tcon->status == TID_EXITING) {
+ if (tcon->status == TCON_STATUS_EXITING) {
/*
* only tree disconnect, open, and write,
* (and ulogoff which does not have tcon)
@@ -3873,7 +3873,7 @@ void smb2_reconnect_server(struct work_struct *work)
goto done;
}
- tcon->status = TID_GOOD;
+ tcon->status = TCON_STATUS_GOOD;
tcon->retry = false;
tcon->need_reconnect = false;
--
2.35.3
next prev parent reply other threads:[~2022-07-24 15:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-24 15:11 [RFC PATCH 00/14] cifs: rename of several structs and variables Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 01/14] cifs: rename servers list, lock, functions, and vars Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 02/14] cifs: rename xid/mid globals Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 03/14] cifs: rename global counters Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 06/14] cifs: convert server info vars to snake_case Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 07/14] cifs: typedef server status enum Enzo Matsumiya
2022-07-25 5:31 ` Christoph Hellwig
2022-07-24 15:11 ` [RFC PATCH 08/14] cifs: typedef ses " Enzo Matsumiya
2022-07-24 15:11 ` Enzo Matsumiya [this message]
2022-07-24 15:11 ` [RFC PATCH 10/14] cifs: typedef securityEnum Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 11/14] cifs: rename cifsFYI to debug_level Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 12/14] cifs: rename list_head fields Enzo Matsumiya
2022-07-24 15:11 ` [RFC PATCH 14/14] cifs: rename more list_heads, remove redundant prefixes Enzo Matsumiya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220724151137.7538-10-ematsumiya@suse.de \
--to=ematsumiya@suse.de \
--cc=linux-cifs@vger.kernel.org \
--cc=nspmangalore@gmail.com \
--cc=pc@cjr.nz \
--cc=ronniesahlberg@gmail.com \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox