[RHEL7,COMMIT] fs/fuse kio_pcs: make map_truncate_tail() working as the original from libpcs_client

Submitted by Konstantin Khorenko on Oct. 31, 2018, 1:02 p.m.

Details

Message ID 201810311302.w9VD2m5k023148@finist-ce7.sw.ru
State New
Series "fs/fuse kio_pcs: make map_truncate_tail() working as the original from libpcs_client"
Headers show

Commit Message

Konstantin Khorenko Oct. 31, 2018, 1:02 p.m.
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 0f4af7f650f75ebb341ab4948704ef2b3ff5f428
Author: Pavel Butsykin <pbutsykin@virtuozzo.com>
Date:   Wed Oct 31 16:02:48 2018 +0300

    fs/fuse kio_pcs: make map_truncate_tail() working as the original from libpcs_client
    
    The offset from the argument usually belong to chunk that will still be used,
    we can't drop map describing this chunk. But we can drop all subsequent maps.
    
    In the original, map_truncate_tail() works exactly this way, but when code was
    transferred to the kernel it suddenly changed the logic. Let's fix it.
    
    Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
    
    =====================
    Patchset description:
    
    FUSE KIO: Mapping truncate fixes
    
    https://jira.sw.ru/browse/PSBM-89539
---
 fs/fuse/kio/pcs/pcs_map.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 25c0281d5278..2990e8e2a3e9 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -237,8 +237,7 @@  void pcs_mapping_dump(struct pcs_mapping * mapping)
 
 void map_truncate_tail(struct pcs_mapping * mapping, u64 offset)
 {
-
-	unsigned long pos = offset >> mapping->chunk_size_bits;
+	unsigned long pos = DIV_ROUND_UP(offset, 1 << mapping->chunk_size_bits);
 	struct pcs_map_entry *maps[MAP_BATCH];
 	int nr_maps;
 	LIST_HEAD(dispose);