Skip to contentSkip to conversation

Ceph deadcoding

PATCH Applied [email protected] 2 participants 9 messages Oct 6, 2024 – Oct 27, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Ceph deadcoding

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This series is a set of deadcoding in fs/ceph and net/ceph.
It's strictly function deletion so should have no change in behaviour.

(get_maintainer was suggesting the netdev team as well as ceph? Is that correct???)

Build & boot tested on x86-64.

Dave

Dr. David Alan Gilbert (5):
libceph: Remove unused ceph_pagelist functions
libceph: Remove unused pagevec functions
libceph: Remove unused ceph_osdc_watch_check
libceph: Remove unused ceph_crypto_key_encode
ceph: Remove fs/ceph deadcode

 fs/ceph/caps.c                  | 14 ---------
 fs/ceph/mds_client.c            |  8 -----
 fs/ceph/mds_client.h            |  2 --
 fs/ceph/super.h                 |  1 -
 include/linux/ceph/libceph.h    |  6 ----
 include/linux/ceph/osd_client.h |  2 --
 include/linux/ceph/pagelist.h   | 12 --------
 net/ceph/crypto.c               | 12 --------
 net/ceph/crypto.h               |  1 -
 net/ceph/osd_client.c           | 34 ---------------------
 net/ceph/pagelist.c             | 38 ------------------------
 net/ceph/pagevec.c              | 52 ---------------------------------
 12 files changed, 182 deletions(-)
Signature · 1 line
2.46.2
#1 lore raw

PATCH 1/5 libceph: Remove unused ceph_pagelist functions

From: "Dr. David Alan Gilbert" <[email protected]>

ceph_pagelist_truncate() and ceph_pagelist_set_cursor() have been unused since commit
39be95e9c8c0 ("ceph: ceph_pagelist_append might sleep while atomic")

Remove them.

---
 include/linux/ceph/pagelist.h | 12 -----------
 net/ceph/pagelist.c           | 38 -----------------------------------
 2 files changed, 50 deletions(-)
include/linux/ceph/pagelist.h +0 -12
index 5dead8486fd8..879bec0863aa 100644
@@ -17,12 +17,6 @@ struct ceph_pagelist {
 	refcount_t refcnt;
 };
 
-struct ceph_pagelist_cursor {
-	struct ceph_pagelist *pl;   /* pagelist, for error checking */
-	struct list_head *page_lru; /* page in list */
-	size_t room;		    /* room remaining to reset to */
-};
-
 struct ceph_pagelist *ceph_pagelist_alloc(gfp_t gfp_flags);
 
 extern void ceph_pagelist_release(struct ceph_pagelist *pl);
@@ -33,12 +27,6 @@ extern int ceph_pagelist_reserve(struct ceph_pagelist *pl, size_t space);
 
 extern int ceph_pagelist_free_reserve(struct ceph_pagelist *pl);
 
-extern void ceph_pagelist_set_cursor(struct ceph_pagelist *pl,
-				     struct ceph_pagelist_cursor *c);
-
-extern int ceph_pagelist_truncate(struct ceph_pagelist *pl,
-				  struct ceph_pagelist_cursor *c);
-
 static inline int ceph_pagelist_encode_64(struct ceph_pagelist *pl, u64 v)
 {
 	__le64 ev = cpu_to_le64(v);
net/ceph/pagelist.c +0 -38
index 74622b278d57..5a9c4be5f222 100644
@@ -131,41 +131,3 @@ int ceph_pagelist_free_reserve(struct ceph_pagelist *pl)
 	return 0;
 }
 EXPORT_SYMBOL(ceph_pagelist_free_reserve);
-
-/* Create a truncation point. */
-void ceph_pagelist_set_cursor(struct ceph_pagelist *pl,
-			      struct ceph_pagelist_cursor *c)
-{
-	c->pl = pl;
-	c->page_lru = pl->head.prev;
-	c->room = pl->room;
-}
-EXPORT_SYMBOL(ceph_pagelist_set_cursor);
-
-/* Truncate a pagelist to the given point. Move extra pages to reserve.
- * This won't sleep.
- * Returns: 0 on success,
- *          -EINVAL if the pagelist doesn't match the trunc point pagelist
- */
-int ceph_pagelist_truncate(struct ceph_pagelist *pl,
-			   struct ceph_pagelist_cursor *c)
-{
-	struct page *page;
-
-	if (pl != c->pl)
-		return -EINVAL;
-	ceph_pagelist_unmap_tail(pl);
-	while (pl->head.prev != c->page_lru) {
-		page = list_entry(pl->head.prev, struct page, lru);
-		/* move from pagelist to reserve */
-		list_move_tail(&page->lru, &pl->free_list);
-		++pl->num_pages_free;
-	}
-	pl->room = c->room;
-	if (!list_empty(&pl->head)) {
-		page = list_entry(pl->head.prev, struct page, lru);
-		pl->mapped_tail = kmap(page);
-	}
-	return 0;
-}
-EXPORT_SYMBOL(ceph_pagelist_truncate);
Signature · 1 line
2.46.2
#2 lore raw

PATCH 2/5 libceph: Remove unused pagevec functions

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

ceph_copy_user_to_page_vector() has been unused since 2013's commit e8344e668915 ("ceph: Implement writev/pwritev for sync operation.")

ceph_copy_to_page_vector() has been unused since 2012's commit 913d2fdcf605 ("rbd: always pass ops array to rbd_req_sync_op()")

Remove them.

---
 include/linux/ceph/libceph.h |  6 -----
 net/ceph/pagevec.c           | 52 ------------------------------------
 2 files changed, 58 deletions(-)
include/linux/ceph/libceph.h +0 -6
index 15fb566d3f46..733e7f93db66 100644
@@ -317,12 +317,6 @@ extern void ceph_release_page_vector(struct page **pages, int num_pages);
 extern void ceph_put_page_vector(struct page **pages, int num_pages,
 				 bool dirty);
 extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
-extern int ceph_copy_user_to_page_vector(struct page **pages,
-					 const void __user *data,
-					 loff_t off, size_t len);
-extern void ceph_copy_to_page_vector(struct page **pages,
-				    const void *data,
-				    loff_t off, size_t len);
 extern void ceph_copy_from_page_vector(struct page **pages,
 				    void *data,
 				    loff_t off, size_t len);
net/ceph/pagevec.c +0 -52

58 lines not on this page · raw message

Signature · 1 line
2.46.2
#3 lore raw

PATCH 3/5 libceph: Remove unused ceph_osdc_watch_check

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

ceph_osdc_watch_check() has been unused since it was added in commit b07d3c4bd727 ("libceph: support for checking on status of watch")

Remove it.

---
 include/linux/ceph/osd_client.h |  2 --
 net/ceph/osd_client.c           | 34 ---------------------------------
 2 files changed, 36 deletions(-)
include/linux/ceph/osd_client.h +0 -2
index d7941478158c..d55b30057a45 100644
@@ -626,8 +626,6 @@ int ceph_osdc_notify(struct ceph_osd_client *osdc,
 		     u32 timeout,
 		     struct page ***preply_pages,
 		     size_t *preply_len);
-int ceph_osdc_watch_check(struct ceph_osd_client *osdc,
-			  struct ceph_osd_linger_request *lreq);
 int ceph_osdc_list_watchers(struct ceph_osd_client *osdc,
 			    struct ceph_object_id *oid,
 			    struct ceph_object_locator *oloc,
net/ceph/osd_client.c +0 -34
index 9d078b37fe0b..9b1168eb77ab 100644
@@ -4999,40 +4999,6 @@ int ceph_osdc_notify(struct ceph_osd_client *osdc,
 }
 EXPORT_SYMBOL(ceph_osdc_notify);
 
-/*
- * Return the number of milliseconds since the watch was last
- * confirmed, or an error.  If there is an error, the watch is no
- * longer valid, and should be destroyed with ceph_osdc_unwatch().
- */
-int ceph_osdc_watch_check(struct ceph_osd_client *osdc,
-			  struct ceph_osd_linger_request *lreq)
-{
-	unsigned long stamp, age;
-	int ret;
-
-	down_read(&osdc->lock);
-	mutex_lock(&lreq->lock);
-	stamp = lreq->watch_valid_thru;
-	if (!list_empty(&lreq->pending_lworks)) {
-		struct linger_work *lwork =
-		    list_first_entry(&lreq->pending_lworks,
-				     struct linger_work,
-				     pending_item);
-
-		if (time_before(lwork->queued_stamp, stamp))
-			stamp = lwork->queued_stamp;
-	}
-	age = jiffies - stamp;
-	dout("%s lreq %p linger_id %llu age %lu last_error %d\n", __func__,
-	     lreq, lreq->linger_id, age, lreq->last_error);
-	/* we are truncating to msecs, so return a safe upper bound */
-	ret = lreq->last_error ?: 1 + jiffies_to_msecs(age);
-
-	mutex_unlock(&lreq->lock);
-	up_read(&osdc->lock);
-	return ret;
-}
-
 static int decode_watcher(void **p, void *end, struct ceph_watch_item *item)
 {
 	u8 struct_v;
Signature · 1 line
2.46.2
#4 lore raw

PATCH 4/5 libceph: Remove unused ceph_crypto_key_encode

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

ceph_crypto_key_encode() was added in 2010's commit 8b6e4f2d8b21 ("ceph: aes crypto and base64 encode/decode helpers")

but has remained unused (the decode is used).

Remove it.

---
 net/ceph/crypto.c | 12 ------------
 net/ceph/crypto.h |  1 -
 2 files changed, 13 deletions(-)
net/ceph/crypto.c +0 -12
index 051d22c0e4ad..01b2ce1e8fc0 100644
@@ -74,18 +74,6 @@ int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
 	return set_secret(dst, src->key);
 }
 
-int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end)
-{
-	if (*p + sizeof(u16) + sizeof(key->created) +
-	    sizeof(u16) + key->len > end)
-		return -ERANGE;
-	ceph_encode_16(p, key->type);
-	ceph_encode_copy(p, &key->created, sizeof(key->created));
-	ceph_encode_16(p, key->len);
-	ceph_encode_copy(p, key->key, key->len);
-	return 0;
-}
-
 int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end)
 {
 	int ret;
net/ceph/crypto.h +0 -1
index 13bd526349fa..23de29fc613c 100644
@@ -21,7 +21,6 @@ struct ceph_crypto_key {
 
 int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
 			  const struct ceph_crypto_key *src);
-int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end);
 int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end);
 int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *in);
 void ceph_crypto_key_destroy(struct ceph_crypto_key *key);
Signature · 1 line
2.46.2
#5 lore raw

PATCH 5/5 ceph: Remove fs/ceph deadcode

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

ceph_caps_revoking() has been unused since 2017's commit 3fb99d483e61 ("ceph: nuke startsync op")

ceph_mdsc_open_export_target_sessions() has been unused since 2013's commit 11df2dfb610d ("ceph: add imported caps when handling cap export message")

Remove them.

---
 fs/ceph/caps.c       | 14 --------------
 fs/ceph/mds_client.c |  8 --------
 fs/ceph/mds_client.h |  2 --
 fs/ceph/super.h      |  1 -
 4 files changed, 25 deletions(-)
fs/ceph/caps.c +0 -14
index bed34fc11c91..0d6b2c0269bf 100644
@@ -978,20 +978,6 @@ int __ceph_caps_revoking_other(struct ceph_inode_info *ci,
 	return 0;
 }
 
-int ceph_caps_revoking(struct ceph_inode_info *ci, int mask)
-{
-	struct inode *inode = &ci->netfs.inode;
-	struct ceph_client *cl = ceph_inode_to_client(inode);
-	int ret;
-
-	spin_lock(&ci->i_ceph_lock);
-	ret = __ceph_caps_revoking_other(ci, NULL, mask);
-	spin_unlock(&ci->i_ceph_lock);
-	doutc(cl, "%p %llx.%llx %s = %d\n", inode, ceph_vinop(inode),
-	      ceph_cap_string(mask), ret);
-	return ret;
-}
-
 int __ceph_caps_used(struct ceph_inode_info *ci)
 {
 	int used = 0;
fs/ceph/mds_client.c +0 -8
index c4a5fd94bbbb..923635532f03 100644
@@ -1747,14 +1747,6 @@ static void __open_export_target_sessions(struct ceph_mds_client *mdsc,
 	}
 }
 
-void ceph_mdsc_open_export_target_sessions(struct ceph_mds_client *mdsc,
-					   struct ceph_mds_session *session)
-{
-	mutex_lock(&mdsc->mutex);
-	__open_export_target_sessions(mdsc, session);
-	mutex_unlock(&mdsc->mutex);
-}
-
 /*
  * session caps
  */
fs/ceph/mds_client.h +0 -2
index 3dd54587944a..38bb7e0d2d79 100644
@@ -634,8 +634,6 @@ extern void ceph_mdsc_handle_fsmap(struct ceph_mds_client *mdsc,
 
 extern struct ceph_mds_session *
 ceph_mdsc_open_export_target_session(struct ceph_mds_client *mdsc, int target);
-extern void ceph_mdsc_open_export_target_sessions(struct ceph_mds_client *mdsc,
-					  struct ceph_mds_session *session);
 
 extern int ceph_trim_caps(struct ceph_mds_client *mdsc,
 			  struct ceph_mds_session *session,
fs/ceph/super.h +0 -1
index 037eac35a9e0..b0b15e87251d 100644
@@ -796,7 +796,6 @@ extern int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask,
 
 extern int __ceph_caps_revoking_other(struct ceph_inode_info *ci,
 				      struct ceph_cap *ocap, int mask);
-extern int ceph_caps_revoking(struct ceph_inode_info *ci, int mask);
 extern int __ceph_caps_used(struct ceph_inode_info *ci);
 
 static inline bool __ceph_is_file_opened(struct ceph_inode_info *ci)
Signature · 1 line
2.46.2
maintainer Applied
#6 lore raw
In reply to [email protected]
Quoted 22 lines · On Sun, Oct 6, 2024 at 3:19 AM <[email protected]> wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This series is a set of deadcoding in fs/ceph and net/ceph.
It's strictly function deletion so should have no change in behaviour.

(get_maintainer was suggesting the netdev team as well as ceph? Is that correct???)

Build & boot tested on x86-64.

Dave

Dr. David Alan Gilbert (5):
libceph: Remove unused ceph_pagelist functions
libceph: Remove unused pagevec functions
libceph: Remove unused ceph_osdc_watch_check
libceph: Remove unused ceph_crypto_key_encode
ceph: Remove fs/ceph deadcode

Quoted 13 lines
 fs/ceph/caps.c                  | 14 ---------
 fs/ceph/mds_client.c            |  8 -----
 fs/ceph/mds_client.h            |  2 --
 fs/ceph/super.h                 |  1 -
 include/linux/ceph/libceph.h    |  6 ----
 include/linux/ceph/osd_client.h |  2 --
 include/linux/ceph/pagelist.h   | 12 --------
 net/ceph/crypto.c               | 12 --------
 net/ceph/crypto.h               |  1 -
 net/ceph/osd_client.c           | 34 ---------------------
 net/ceph/pagelist.c             | 38 ------------------------
 net/ceph/pagevec.c              | 52 ---------------------------------
 12 files changed, 182 deletions(-)

Applied.

Thanks,

Ilya

maintainer
#7 lore raw
In reply to [email protected]
Quoted 10 lines · On Sun, Oct 6, 2024 at 3:19 AM <[email protected]> wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This series is a set of deadcoding in fs/ceph and net/ceph.
It's strictly function deletion so should have no change in behaviour.

(get_maintainer was suggesting the netdev team as well as ceph? Is that correct???)

Hi David,

No, it's not correct. It's probably caused by

F: net/

entry in "NETWORKING [GENERAL]" section. I don't recall get_maintainer.pl doing that in the past, but I could be wrong. Anyway, I'll send a patch to exclude net/ceph there.

Thanks,

Ilya

#8 lore raw
Quoted 12 lines · * Ilya Dryomov ([email protected]) wrote:
Quoted 10 lines · On Sun, Oct 6, 2024 at 3:19 AM <[email protected]> wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This series is a set of deadcoding in fs/ceph and net/ceph.
It's strictly function deletion so should have no change in behaviour.

(get_maintainer was suggesting the netdev team as well as ceph? Is that correct???)

Quoted 8 lines

Hi David,

No, it's not correct. It's probably caused by

F: net/

entry in "NETWORKING [GENERAL]" section. I don't recall get_maintainer.pl doing that in the past, but I could be wrong.

THanks, I didn't think it was right.

Quoted 1 line

Anyway, I'll send a patch to exclude net/ceph there.

Thanks, and thanks for applying the cleanup.

Dave

Quoted 4 lines

Thanks,

Ilya

Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/