[PATCH] cifs: Remove unused functions

linux@treblig.org posted 1 patch 1 month, 3 weeks ago
fs/smb/client/cifsproto.h |  9 ---------
fs/smb/client/connect.c   | 12 ------------
fs/smb/client/sess.c      | 32 --------------------------------
3 files changed, 53 deletions(-)
[PATCH] cifs: Remove unused functions
Posted by linux@treblig.org 1 month, 3 weeks ago
From: "Dr. David Alan Gilbert" <linux@treblig.org>

cifs_ses_find_chan() has been unused since commit
f486ef8e2003 ("cifs: use the chans_need_reconnect bitmap for reconnect status")

cifs_read_page_from_socket() has been unused since commit
d08089f649a0 ("cifs: Change the I/O paths to use an iterator rather than a page list")

cifs_chan_in_reconnect() has been unused since commit
bc962159e8e3 ("cifs: avoid race conditions with parallel reconnects")

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 fs/smb/client/cifsproto.h |  9 ---------
 fs/smb/client/connect.c   | 12 ------------
 fs/smb/client/sess.c      | 32 --------------------------------
 3 files changed, 53 deletions(-)

diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
index 68c716e6261b..1d3470bca45e 100644
--- a/fs/smb/client/cifsproto.h
+++ b/fs/smb/client/cifsproto.h
@@ -252,10 +252,6 @@ extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
 			         unsigned int to_read);
 extern ssize_t cifs_discard_from_socket(struct TCP_Server_Info *server,
 					size_t to_read);
-extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,
-					struct page *page,
-					unsigned int page_offset,
-					unsigned int to_read);
 int cifs_read_iter_from_socket(struct TCP_Server_Info *server,
 			       struct iov_iter *iter,
 			       unsigned int to_read);
@@ -623,8 +619,6 @@ enum securityEnum cifs_select_sectype(struct TCP_Server_Info *,
 int cifs_alloc_hash(const char *name, struct shash_desc **sdesc);
 void cifs_free_hash(struct shash_desc **sdesc);
 
-struct cifs_chan *
-cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server);
 int cifs_try_adding_channels(struct cifs_ses *ses);
 bool is_server_using_iface(struct TCP_Server_Info *server,
 			   struct cifs_server_iface *iface);
@@ -640,9 +634,6 @@ cifs_chan_set_in_reconnect(struct cifs_ses *ses,
 void
 cifs_chan_clear_in_reconnect(struct cifs_ses *ses,
 			       struct TCP_Server_Info *server);
-bool
-cifs_chan_in_reconnect(struct cifs_ses *ses,
-			  struct TCP_Server_Info *server);
 void
 cifs_chan_set_need_reconnect(struct cifs_ses *ses,
 			     struct TCP_Server_Info *server);
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index adf8758847f6..15d94ac4095e 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -794,18 +794,6 @@ cifs_discard_from_socket(struct TCP_Server_Info *server, size_t to_read)
 	return cifs_readv_from_socket(server, &smb_msg);
 }
 
-int
-cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page,
-	unsigned int page_offset, unsigned int to_read)
-{
-	struct msghdr smb_msg = {};
-	struct bio_vec bv;
-
-	bvec_set_page(&bv, page, to_read, page_offset);
-	iov_iter_bvec(&smb_msg.msg_iter, ITER_DEST, &bv, 1, to_read);
-	return cifs_readv_from_socket(server, &smb_msg);
-}
-
 int
 cifs_read_iter_from_socket(struct TCP_Server_Info *server, struct iov_iter *iter,
 			   unsigned int to_read)
diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
index 3216f786908f..c88e9657f47a 100644
--- a/fs/smb/client/sess.c
+++ b/fs/smb/client/sess.c
@@ -115,18 +115,6 @@ cifs_chan_clear_in_reconnect(struct cifs_ses *ses,
 	ses->chans[chan_index].in_reconnect = false;
 }
 
-bool
-cifs_chan_in_reconnect(struct cifs_ses *ses,
-			  struct TCP_Server_Info *server)
-{
-	unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
-
-	if (chan_index == CIFS_INVAL_CHAN_INDEX)
-		return true;	/* err on the safer side */
-
-	return CIFS_CHAN_IN_RECONNECT(ses, chan_index);
-}
-
 void
 cifs_chan_set_need_reconnect(struct cifs_ses *ses,
 			     struct TCP_Server_Info *server)
@@ -487,26 +475,6 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
 	spin_unlock(&ses->chan_lock);
 }
 
-/*
- * If server is a channel of ses, return the corresponding enclosing
- * cifs_chan otherwise return NULL.
- */
-struct cifs_chan *
-cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server)
-{
-	int i;
-
-	spin_lock(&ses->chan_lock);
-	for (i = 0; i < ses->chan_count; i++) {
-		if (ses->chans[i].server == server) {
-			spin_unlock(&ses->chan_lock);
-			return &ses->chans[i];
-		}
-	}
-	spin_unlock(&ses->chan_lock);
-	return NULL;
-}
-
 static int
 cifs_ses_add_channel(struct cifs_ses *ses,
 		     struct cifs_server_iface *iface)
-- 
2.46.2
Re: [PATCH] cifs: Remove unused functions
Posted by Steve French 1 month, 3 weeks ago
tentatively merged into cifs-2.6.git for-next pending testing and any
additional reviews

On Sun, Oct 6, 2024 at 7:49 PM <linux@treblig.org> wrote:
>
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>
> cifs_ses_find_chan() has been unused since commit
> f486ef8e2003 ("cifs: use the chans_need_reconnect bitmap for reconnect status")
>
> cifs_read_page_from_socket() has been unused since commit
> d08089f649a0 ("cifs: Change the I/O paths to use an iterator rather than a page list")
>
> cifs_chan_in_reconnect() has been unused since commit
> bc962159e8e3 ("cifs: avoid race conditions with parallel reconnects")
>
> Remove them.
>
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> ---
>  fs/smb/client/cifsproto.h |  9 ---------
>  fs/smb/client/connect.c   | 12 ------------
>  fs/smb/client/sess.c      | 32 --------------------------------
>  3 files changed, 53 deletions(-)
>
> diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
> index 68c716e6261b..1d3470bca45e 100644
> --- a/fs/smb/client/cifsproto.h
> +++ b/fs/smb/client/cifsproto.h
> @@ -252,10 +252,6 @@ extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
>                                  unsigned int to_read);
>  extern ssize_t cifs_discard_from_socket(struct TCP_Server_Info *server,
>                                         size_t to_read);
> -extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,
> -                                       struct page *page,
> -                                       unsigned int page_offset,
> -                                       unsigned int to_read);
>  int cifs_read_iter_from_socket(struct TCP_Server_Info *server,
>                                struct iov_iter *iter,
>                                unsigned int to_read);
> @@ -623,8 +619,6 @@ enum securityEnum cifs_select_sectype(struct TCP_Server_Info *,
>  int cifs_alloc_hash(const char *name, struct shash_desc **sdesc);
>  void cifs_free_hash(struct shash_desc **sdesc);
>
> -struct cifs_chan *
> -cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server);
>  int cifs_try_adding_channels(struct cifs_ses *ses);
>  bool is_server_using_iface(struct TCP_Server_Info *server,
>                            struct cifs_server_iface *iface);
> @@ -640,9 +634,6 @@ cifs_chan_set_in_reconnect(struct cifs_ses *ses,
>  void
>  cifs_chan_clear_in_reconnect(struct cifs_ses *ses,
>                                struct TCP_Server_Info *server);
> -bool
> -cifs_chan_in_reconnect(struct cifs_ses *ses,
> -                         struct TCP_Server_Info *server);
>  void
>  cifs_chan_set_need_reconnect(struct cifs_ses *ses,
>                              struct TCP_Server_Info *server);
> diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
> index adf8758847f6..15d94ac4095e 100644
> --- a/fs/smb/client/connect.c
> +++ b/fs/smb/client/connect.c
> @@ -794,18 +794,6 @@ cifs_discard_from_socket(struct TCP_Server_Info *server, size_t to_read)
>         return cifs_readv_from_socket(server, &smb_msg);
>  }
>
> -int
> -cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page,
> -       unsigned int page_offset, unsigned int to_read)
> -{
> -       struct msghdr smb_msg = {};
> -       struct bio_vec bv;
> -
> -       bvec_set_page(&bv, page, to_read, page_offset);
> -       iov_iter_bvec(&smb_msg.msg_iter, ITER_DEST, &bv, 1, to_read);
> -       return cifs_readv_from_socket(server, &smb_msg);
> -}
> -
>  int
>  cifs_read_iter_from_socket(struct TCP_Server_Info *server, struct iov_iter *iter,
>                            unsigned int to_read)
> diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
> index 3216f786908f..c88e9657f47a 100644
> --- a/fs/smb/client/sess.c
> +++ b/fs/smb/client/sess.c
> @@ -115,18 +115,6 @@ cifs_chan_clear_in_reconnect(struct cifs_ses *ses,
>         ses->chans[chan_index].in_reconnect = false;
>  }
>
> -bool
> -cifs_chan_in_reconnect(struct cifs_ses *ses,
> -                         struct TCP_Server_Info *server)
> -{
> -       unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
> -
> -       if (chan_index == CIFS_INVAL_CHAN_INDEX)
> -               return true;    /* err on the safer side */
> -
> -       return CIFS_CHAN_IN_RECONNECT(ses, chan_index);
> -}
> -
>  void
>  cifs_chan_set_need_reconnect(struct cifs_ses *ses,
>                              struct TCP_Server_Info *server)
> @@ -487,26 +475,6 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
>         spin_unlock(&ses->chan_lock);
>  }
>
> -/*
> - * If server is a channel of ses, return the corresponding enclosing
> - * cifs_chan otherwise return NULL.
> - */
> -struct cifs_chan *
> -cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server)
> -{
> -       int i;
> -
> -       spin_lock(&ses->chan_lock);
> -       for (i = 0; i < ses->chan_count; i++) {
> -               if (ses->chans[i].server == server) {
> -                       spin_unlock(&ses->chan_lock);
> -                       return &ses->chans[i];
> -               }
> -       }
> -       spin_unlock(&ses->chan_lock);
> -       return NULL;
> -}
> -
>  static int
>  cifs_ses_add_channel(struct cifs_ses *ses,
>                      struct cifs_server_iface *iface)
> --
> 2.46.2
>
>


-- 
Thanks,

Steve