[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio_pcs: simplify pcs_mapping_truncate()

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 31 16:02:51 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.15
------>
commit 51fbe7348c88b9afd3b46b0f28e91217d9035bd6
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Wed Oct 31 16:02:50 2018 +0300

    fs/fuse kio_pcs: simplify pcs_mapping_truncate()
    
    This cosmetic patch is aimed to simplify the code in pcs_mapping_truncate().
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    FUSE KIO: Mapping truncate fixes
    
    https://jira.sw.ru/browse/PSBM-89539
---
 fs/fuse/kio/pcs/pcs_map.c | 36 +++++++++---------------------------
 1 file changed, 9 insertions(+), 27 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 01cbf95f7ab7..c4628b0a65a5 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -2462,7 +2462,6 @@ noinline void pcs_mapping_truncate(struct pcs_int_request *ireq, u64 old_size)
 	u64 new_size = DENTRY_SIZE(di);
 	u64 offset;
 	struct pcs_map_entry * m = NULL;
-	int queue = 0;
 
 	di->local_mtime = get_real_time_ms();
 
@@ -2487,38 +2486,21 @@ noinline void pcs_mapping_truncate(struct pcs_int_request *ireq, u64 old_size)
 
 	m = pcs_find_get_map(di, offset - 1);
 
-	if (m) {
-		FUSE_KTRACE(ireq->cc->fc, "mapping truncate %llu->%llu " DENTRY_FMT " %x", (unsigned long long)old_size,
-		      (unsigned long long)new_size, DENTRY_ARGS(ireq->dentry), m ? m->state : -1);
-	}
-	if (m && map_chunk_end(m) == offset) {
-		map_truncate_tail(&di->mapping, offset);
-		ireq_complete(ireq);
-		pcs_map_put(m);
-		return;
-	}
-
+	FUSE_KTRACE(ireq->cc->fc, "mapping truncate %llu->%llu " DENTRY_FMT " %x", (unsigned long long)old_size,
+	      (unsigned long long)new_size, DENTRY_ARGS(ireq->dentry), m ? m->state : -1);
 
-	if (m == NULL)
-		queue = 1;
-	else {
-		if (!valid_for_truncate(m, ireq))
-			queue = 1;
+	if (m == NULL) {
+		map_queue_on_limit(ireq);
+		return;
 	}
 
-	if (queue) {
-		if (m) {
-			pcs_map_queue_resolve(m, ireq, 1);
-		} else {
-			map_queue_on_limit(ireq);
-		}
-	} else {
+	if (map_chunk_end(m) == offset || valid_for_truncate(m, ireq)) {
 		map_truncate_tail(&di->mapping, map_chunk_end(m));
 		ireq_complete(ireq);
-	}
+	} else
+		pcs_map_queue_resolve(m, ireq, 1);
 
-	if (m)
-		pcs_map_put(m);
+	pcs_map_put(m);
 }
 
 static int commit_cs_record(struct pcs_map_entry * m, struct pcs_cs_record * rec,



More information about the Devel mailing list