The PCS_IREQ_TRUNCATE request type is not used in the kio module,
remove the associated dead code.

Related to: #VSTOR-116825
https://virtuozzo.atlassian.net/browse/VSTOR-116825

Signed-off-by: Liu Kui <[email protected]>
---
 fs/fuse/kio/pcs/pcs_cluster.c |   3 -
 fs/fuse/kio/pcs/pcs_map.c     | 100 ----------------------------------
 fs/fuse/kio/pcs/pcs_map.h     |   1 -
 fs/fuse/kio/pcs/pcs_req.c     |  14 -----
 4 files changed, 118 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_cluster.c b/fs/fuse/kio/pcs/pcs_cluster.c
index 710087c83fe6..7e878d7befc3 100644
--- a/fs/fuse/kio/pcs/pcs_cluster.c
+++ b/fs/fuse/kio/pcs/pcs_cluster.c
@@ -489,9 +489,6 @@ static void ireq_process_(struct pcs_int_request *ireq)
        case PCS_IREQ_FLUSH:
                process_flush_req(ireq);
                break;
-       case PCS_IREQ_TRUNCATE:
-               process_ireq_truncate(ireq);
-               break;
        case PCS_IREQ_CUSTOM:
                ireq->custom.action(ireq);
                break;
diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 8baff296aaa7..415d63b6f63f 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -2535,106 +2535,6 @@ void map_submit(struct pcs_map_entry * m, struct 
pcs_int_request *ireq)
        } while (!done);
 }
 
-static int valid_for_truncate(struct pcs_map_entry * m, struct pcs_int_request 
*ireq)
-{
-       spin_lock(&m->lock);
-
-       /* This weird test means that map is valid, but points to a hole. In 
this case
-        * truncate is noop.
-        */
-       if ((m->state & 
(PCS_MAP_ERROR|PCS_MAP_RESOLVING|PCS_MAP_NEW|PCS_MAP_READABLE)) ==
-           (PCS_MAP_NEW|PCS_MAP_READABLE)) {
-               spin_unlock(&m->lock);
-               return 1;
-       }
-
-       /* If we already have valid map, remember its version
-        * and switch to the next phase: invalidation and requesting
-        * new map.
-        */
-       if (!(m->state & (PCS_MAP_ERROR|PCS_MAP_RESOLVING|PCS_MAP_NEW))) {
-               map_remote_error_nolock(m, PCS_ERR_CSD_STALE_MAP, m->cs_list ? 
m->cs_list->cs[0].info.id.val : 0);
-               ireq->truncreq.phase = 1;
-               ireq->truncreq.version = m->version;
-       }
-       /* Otherwise lookup valid map first. */
-       spin_unlock(&m->lock);
-
-       return 0;
-}
-
-
-//// TODO: truncate should probably synhroniously truncate local mapping.
-void process_ireq_truncate(struct pcs_int_request *ireq)
-{
-       struct pcs_dentry_info *di = ireq->dentry;
-       struct pcs_map_entry * m;
-       u64 end;
-
-       /* Special case: full truncate */
-       if (ireq->truncreq.offset == 0) {
-               map_truncate_tail(&di->mapping, 0);
-               ireq_complete(ireq);
-               return;
-       }
-
-       m = pcs_find_get_map(di, ireq->truncreq.offset - 1);
-
-       FUSE_KTRACE(ireq->cc->fc, "process TRUNCATE %llu@" DENTRY_FMT " %x",
-             (unsigned long long)ireq->truncreq.offset, DENTRY_ARGS(di), m ? 
m->state : -1);
-
-       if (m == NULL) {
-               map_queue_on_limit(ireq);
-               return;
-       }
-       end = map_chunk_end(m);
-       if (end <= ireq->truncreq.offset)
-               goto truncate_tail;
-
-       if (ireq->truncreq.phase == 0) {
-               if (valid_for_truncate(m, ireq))
-                       goto truncate_tail;
-       } else {
-               /* We already had some valid map. Must get new one. */
-               spin_lock(&m->lock);
-               if ((m->state & 
(PCS_MAP_ERROR|PCS_MAP_RESOLVING|PCS_MAP_NEW|PCS_MAP_READABLE)) ==
-                   (PCS_MAP_NEW|PCS_MAP_READABLE)) {
-
-                       spin_unlock(&m->lock);
-                       FUSE_KLOG(cc_from_maps(m->maps)->fc, LOG_INFO, "map " 
MAP_FMT " unexpectedly converted to hole", MAP_ARGS(m));
-                       goto truncate_tail;
-               }
-
-               if (m->state & PCS_MAP_RESOLVING) {
-                       list_add_tail(&ireq->list, &m->queue);
-                       spin_unlock(&m->lock);
-                       pcs_map_put(m);
-                       return;
-               }
-
-               if (!(m->state & (PCS_MAP_ERROR|PCS_MAP_NEW))) {
-                       if (map_version_compare(&m->version, 
&ireq->truncreq.version) > 0) {
-                               spin_unlock(&m->lock);
-                               goto truncate_tail;
-                       }
-
-                       FUSE_KTRACE(ireq->cc->fc, "map " MAP_FMT " is not 
updated yet", MAP_ARGS(m));
-                       map_remote_error_nolock(m, PCS_ERR_CSD_STALE_MAP, 
m->cs_list ? m->cs_list->cs[0].info.id.val : 0);
-
-               }
-               spin_unlock(&m->lock);
-       }
-       pcs_map_queue_resolve(m, ireq, 1);
-       pcs_map_put(m);
-       return;
-
-truncate_tail:
-       map_truncate_tail(&di->mapping, end);
-       ireq_complete(ireq);
-       pcs_map_put(m);
-       return;
-}
-
 /*
  * Taking into account that user-client does proper map invalidation at resize,
  * we don't need to completely copy the functionality of 
pcs_mapping_truncate().
diff --git a/fs/fuse/kio/pcs/pcs_map.h b/fs/fuse/kio/pcs/pcs_map.h
index c35ef0a8ddf1..c31b13f05af8 100644
--- a/fs/fuse/kio/pcs/pcs_map.h
+++ b/fs/fuse/kio/pcs/pcs_map.h
@@ -199,7 +199,6 @@ void pcs_mapping_open(struct pcs_mapping * mapping);
 void pcs_mapping_invalidate(struct pcs_mapping * mapping);
 void pcs_mapping_deinit(struct pcs_mapping * mapping);
 void pcs_mapping_truncate(struct pcs_dentry_info *di, u64 new_size);
-void process_ireq_truncate(struct pcs_int_request *ireq);
 
 struct pcs_map_entry * pcs_find_get_map(struct pcs_dentry_info * de, u64 
chunk);
 void map_submit(struct pcs_map_entry * m, struct pcs_int_request *ireq);
diff --git a/fs/fuse/kio/pcs/pcs_req.c b/fs/fuse/kio/pcs/pcs_req.c
index 66b535dd7d0b..67b2daf509d2 100644
--- a/fs/fuse/kio/pcs/pcs_req.c
+++ b/fs/fuse/kio/pcs/pcs_req.c
@@ -134,20 +134,6 @@ noinline void pcs_ireq_queue_fail(struct list_head *queue, 
int error)
 
                pcs_set_local_error(&ireq->error, error);
 
-               if (ireq->type == PCS_IREQ_TRUNCATE) {
-                       ireq_on_error(ireq);
-
-                       if (!(ireq->flags & IREQ_F_FATAL)) {
-                               ireq_retry_inc(ireq);
-                               pcs_clear_error(&ireq->error);
-
-                               FUSE_KTRACE(ireq->cc->fc, "requeue truncate(%d) 
%llu@" DENTRY_FMT, ireq->type,
-                                     (unsigned long 
long)ireq->truncreq.offset, DENTRY_ARGS(ireq->dentry));
-
-                               ireq_delay(ireq);
-                               continue;
-                       }
-               }
                ireq_complete(ireq);
        }
 }
-- 
2.39.5 (Apple Git-154)

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to