Skip to contentSkip to conversation

ceph: remove unless check for the folio

PATCH New [email protected] 1 participant 1 message Jul 5, 2022 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: remove unless check for the folio

From: Xiubo Li <[email protected]>

The netfs_write_begin() won't set the folio if the return value is non-zero.

---
 fs/ceph/addr.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
fs/ceph/addr.c +7 -10
index e44a3eefb344..8095fc47230e 100644
@@ -1318,16 +1318,13 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping,
 	int r;
 
 	r = netfs_write_begin(&ci->netfs, file, inode->i_mapping, pos, len, &folio, NULL);
-	if (r == 0)
-		folio_wait_fscache(folio);
-	if (r < 0) {
-		if (folio)
-			folio_put(folio);
-	} else {
-		WARN_ON_ONCE(!folio_test_locked(folio));
-		*pagep = &folio->page;
-	}
-	return r;
+	if (r < 0)
+		return r;
+
+	folio_wait_fscache(folio);
+	WARN_ON_ONCE(!folio_test_locked(folio));
+	*pagep = &folio->page;
+	return 0;
 }
 
 /*
Signature · 1 line
2.36.0.rc1