1 --- block/export/fuse.c.orig 2022-04-22 18:57:58 UTC 2 +++ block/export/fuse.c 3 @@ -637,12 +637,6 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t 4 return; 5 } 6 7 -#ifdef CONFIG_FALLOCATE_PUNCH_HOLE 8 - if (mode & FALLOC_FL_KEEP_SIZE) { 9 - length = MIN(length, blk_len - offset); 10 - } 11 -#endif /* CONFIG_FALLOCATE_PUNCH_HOLE */ 12 - 13 if (!mode) { 14 /* We can only fallocate at the EOF with a truncate */ 15 if (offset < blk_len) { 16 @@ -662,44 +656,6 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t 17 ret = fuse_do_truncate(exp, offset + length, true, 18 PREALLOC_MODE_FALLOC); 19 } 20 -#ifdef CONFIG_FALLOCATE_PUNCH_HOLE 21 - else if (mode & FALLOC_FL_PUNCH_HOLE) { 22 - if (!(mode & FALLOC_FL_KEEP_SIZE)) { 23 - fuse_reply_err(req, EINVAL); 24 - return; 25 - } 26 - 27 - do { 28 - int size = MIN(length, BDRV_REQUEST_MAX_BYTES); 29 - 30 - ret = blk_pdiscard(exp->common.blk, offset, size); 31 - offset += size; 32 - length -= size; 33 - } while (ret == 0 && length > 0); 34 - } 35 -#endif /* CONFIG_FALLOCATE_PUNCH_HOLE */ 36 -#ifdef CONFIG_FALLOCATE_ZERO_RANGE 37 - else if (mode & FALLOC_FL_ZERO_RANGE) { 38 - if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + length > blk_len) { 39 - /* No need for zeroes, we are going to write them ourselves */ 40 - ret = fuse_do_truncate(exp, offset + length, false, 41 - PREALLOC_MODE_OFF); 42 - if (ret < 0) { 43 - fuse_reply_err(req, -ret); 44 - return; 45 - } 46 - } 47 - 48 - do { 49 - int size = MIN(length, BDRV_REQUEST_MAX_BYTES); 50 - 51 - ret = blk_pwrite_zeroes(exp->common.blk, 52 - offset, size, 0); 53 - offset += size; 54 - length -= size; 55 - } while (ret == 0 && length > 0); 56 - } 57 -#endif /* CONFIG_FALLOCATE_ZERO_RANGE */ 58 else { 59 ret = -EOPNOTSUPP; 60 } 61