Skip to contentSkip to conversation

ceph: add a has_stable_inodes operation for ceph

PATCH In review Jeff Layton 2 participants 2 messages Mar 25, 2022 – Mar 28, 2022 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: add a has_stable_inodes operation for ceph

...and just have it return true. It should never change inode numbers out from under us, as they are baked into the object names.

---
 fs/ceph/crypto.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
fs/ceph/crypto.c +13 -7
index 2a8f95885e7d..3a9214b1e8b3 100644
@@ -59,6 +59,11 @@ static int ceph_crypt_set_context(struct inode *inode, const void *ctx, size_t l
 	return ret;
 }
 
+static const union fscrypt_policy *ceph_get_dummy_policy(struct super_block *sb)
+{
+	return ceph_sb_to_client(sb)->dummy_enc_policy.policy;
+}
+
 static bool ceph_crypt_empty_dir(struct inode *inode)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
@@ -66,14 +71,9 @@ static bool ceph_crypt_empty_dir(struct inode *inode)
 	return ci->i_rsubdirs + ci->i_rfiles == 1;
 }
 
-void ceph_fscrypt_free_dummy_policy(struct ceph_fs_client *fsc)
+static bool ceph_crypt_has_stable_inodes(struct super_block *sb)
 {
-	fscrypt_free_dummy_policy(&fsc->dummy_enc_policy);
-}
-
-static const union fscrypt_policy *ceph_get_dummy_policy(struct super_block *sb)
-{
-	return ceph_sb_to_client(sb)->dummy_enc_policy.policy;
+	return true;
 }
 
 static struct fscrypt_operations ceph_fscrypt_ops = {
@@ -82,6 +82,7 @@ static struct fscrypt_operations ceph_fscrypt_ops = {
 	.set_context		= ceph_crypt_set_context,
 	.get_dummy_policy	= ceph_get_dummy_policy,
 	.empty_dir		= ceph_crypt_empty_dir,
+	.has_stable_inodes	= ceph_crypt_has_stable_inodes,
 };
 
 void ceph_fscrypt_set_ops(struct super_block *sb)
@@ -89,6 +90,11 @@ void ceph_fscrypt_set_ops(struct super_block *sb)
 	fscrypt_set_ops(sb, &ceph_fscrypt_ops);
 }
 
+void ceph_fscrypt_free_dummy_policy(struct ceph_fs_client *fsc)
+{
+	fscrypt_free_dummy_policy(&fsc->dummy_enc_policy);
+}
+
 int ceph_fscrypt_prepare_context(struct inode *dir, struct inode *inode,
 				 struct ceph_acl_sec_ctx *as)
 {
Signature · 1 line
2.35.1
#1 lore raw
Quoted 8 lines · Jeff Layton

...and just have it return true. It should never change inode numbers out from under us, as they are baked into the object names.

---
 fs/ceph/crypto.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

Thanks, this looks good. I've also tried it for a bit and seems work fine. Feel free to add my Reviewed-by (and Tested-by).

Cheers,

Signature · 1 line
Luís
Quoted 58 lines
fs/ceph/crypto.c +13 -7
index 2a8f95885e7d..3a9214b1e8b3 100644
@@ -59,6 +59,11 @@ static int ceph_crypt_set_context(struct inode *inode, const void *ctx, size_t l
 	return ret;
 }
 
+static const union fscrypt_policy *ceph_get_dummy_policy(struct super_block *sb)
+{
+	return ceph_sb_to_client(sb)->dummy_enc_policy.policy;
+}
+
 static bool ceph_crypt_empty_dir(struct inode *inode)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
@@ -66,14 +71,9 @@ static bool ceph_crypt_empty_dir(struct inode *inode)
 	return ci->i_rsubdirs + ci->i_rfiles == 1;
 }
 
-void ceph_fscrypt_free_dummy_policy(struct ceph_fs_client *fsc)
+static bool ceph_crypt_has_stable_inodes(struct super_block *sb)
 {
-	fscrypt_free_dummy_policy(&fsc->dummy_enc_policy);
-}
-
-static const union fscrypt_policy *ceph_get_dummy_policy(struct super_block *sb)
-{
-	return ceph_sb_to_client(sb)->dummy_enc_policy.policy;
+	return true;
 }
 
 static struct fscrypt_operations ceph_fscrypt_ops = {
@@ -82,6 +82,7 @@ static struct fscrypt_operations ceph_fscrypt_ops = {
 	.set_context		= ceph_crypt_set_context,
 	.get_dummy_policy	= ceph_get_dummy_policy,
 	.empty_dir		= ceph_crypt_empty_dir,
+	.has_stable_inodes	= ceph_crypt_has_stable_inodes,
 };
 
 void ceph_fscrypt_set_ops(struct super_block *sb)
@@ -89,6 +90,11 @@ void ceph_fscrypt_set_ops(struct super_block *sb)
 	fscrypt_set_ops(sb, &ceph_fscrypt_ops);
 }
 
+void ceph_fscrypt_free_dummy_policy(struct ceph_fs_client *fsc)
+{
+	fscrypt_free_dummy_policy(&fsc->dummy_enc_policy);
+}
+
 int ceph_fscrypt_prepare_context(struct inode *dir, struct inode *inode,
 				 struct ceph_acl_sec_ctx *as)
 {
Signature · 1 line
2.35.1