[Devel] [PATCH RHEL7 COMMIT] ploop: Remove dead "pcss"-related code
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Feb 18 12:10:26 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-957.1.3.vz7.83.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.1.3.vz7.83.12
------>
commit 39b0dec06fe90a05365101471bb2868f87dceae4
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Mon Feb 18 12:10:24 2019 +0300
ploop: Remove dead "pcss"-related code
We don't have "pcss" filesystem anymore.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/block/ploop/io_direct.c | 67 +++++-----------------------
drivers/block/ploop/io_direct_map.c | 88 ++-----------------------------------
drivers/block/ploop/io_direct_map.h | 7 ---
include/linux/ploop/ploop_if.h | 16 -------
4 files changed, 14 insertions(+), 164 deletions(-)
diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 6a43a8e5cba8..c1cb70feb253 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -694,20 +694,6 @@ dio_submit_pad(struct ploop_io *io, struct ploop_request * preq,
PLOOP_FAIL_REQUEST(preq, err);
}
-static struct extent_map * dio_fallocate(struct ploop_io *io, u32 iblk, int nr)
-{
- struct extent_map * em;
- mutex_lock(&io->files.inode->i_mutex);
- em = map_extent_get_block(io,
- io->files.mapping,
- (sector_t)iblk << io->plo->cluster_log,
- 1 << io->plo->cluster_log,
- 1, mapping_gfp_mask(io->files.mapping));
- mutex_unlock(&io->files.inode->i_mutex);
- return em;
-}
-
-
static void
dio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
struct bio_list * sbl, unsigned int size)
@@ -722,37 +708,6 @@ dio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
return;
}
- /* io->fallocate is not a "posix" fallocate()!
- *
- * We require backing fs gave us _uninitialized_ blocks,
- * otherwise it does not make sense to go that way.
- *
- * IMPORTANT: file _grows_ and dio_submit_alloc() cannot
- * complete requests until i_size is commited to disk.
- * Read this as: no hope to do this in a non-suboptimal way,
- * linux updates i_size synchronously even when O_DIRECT AIO
- * is requested. Even in PCSS we have to update i_size synchronously.
- * Obviously, we will expand file by larger pieces
- * and take some measures to avoid initialization of the blocks
- * and the same time leakage of uninitizlized data
- * to user of our device.
- */
- if (io->files.em_tree->_get_extent) {
- struct extent_map * em;
-
- em = dio_fallocate(io, iblk, 1);
- if (unlikely(IS_ERR(em))) {
- PLOOP_FAIL_REQUEST(preq, PTR_ERR(em));
- return;
- }
-
- preq->iblock = iblk;
- preq->eng_state = PLOOP_E_DATA_WBI;
-
- dio_submit_pad(io, preq, sbl, size, em);
- return;
- }
-
err = cached_submit(io, iblk, preq, sbl, size, true);
if (err) {
if (err == -ENOSPC)
@@ -1005,7 +960,7 @@ static int dio_open(struct ploop_io * io)
goto out;
}
- if (!(delta->flags & PLOOP_FMT_RDONLY) && !io->files.em_tree->_get_extent) {
+ if (!(delta->flags & PLOOP_FMT_RDONLY)) {
io->fsync_thread = kthread_create(dio_fsync_thread,
io, "ploop_fsync%d",
delta->plo->index);
@@ -1734,18 +1689,16 @@ static int dio_prepare_merge(struct ploop_io * io, struct ploop_snapdata *sd)
}
mutex_unlock(&io->files.inode->i_mutex);
- if (!io->files.em_tree->_get_extent) {
- io->fsync_thread = kthread_create(dio_fsync_thread,
- io, "ploop_fsync%d",
- io->plo->index);
- if (IS_ERR(io->fsync_thread)) {
- err = PTR_ERR(io->fsync_thread);
- io->fsync_thread = NULL;
- fput(file);
- return err;
- }
- wake_up_process(io->fsync_thread);
+ io->fsync_thread = kthread_create(dio_fsync_thread,
+ io, "ploop_fsync%d",
+ io->plo->index);
+ if (IS_ERR(io->fsync_thread)) {
+ err = PTR_ERR(io->fsync_thread);
+ io->fsync_thread = NULL;
+ fput(file);
+ return err;
}
+ wake_up_process(io->fsync_thread);
sd->file = file;
return 0;
diff --git a/drivers/block/ploop/io_direct_map.c b/drivers/block/ploop/io_direct_map.c
index 99fdf6f080e6..3a1c32a183fb 100644
--- a/drivers/block/ploop/io_direct_map.c
+++ b/drivers/block/ploop/io_direct_map.c
@@ -11,7 +11,6 @@
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/version.h>
-#include <linux/fs.h>
#include <linux/buffer_head.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
@@ -121,19 +120,6 @@ ploop_dio_open(struct ploop_io * io, int rdonly)
spin_unlock(&ploop_mappings_lock);
- if (strcmp(mapping->host->i_sb->s_type->name, "pcss") == 0) {
- struct ploop_xops xops;
- if (file->f_op->unlocked_ioctl) {
- mm_segment_t fs = get_fs();
-
- set_fs(KERNEL_DS);
- xops.magic = 0;
- err = file->f_op->unlocked_ioctl(file, PLOOP_IOC_INTERNAL, (long)&xops);
- set_fs(fs);
- if (err == 0 && xops.magic == PLOOP_INTERNAL_MAGIC)
- pm->extent_root._get_extent = xops.get_extent;
- }
- }
return &pm->extent_root;
}
@@ -584,67 +570,6 @@ static int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map
return ret;
}
-static struct extent_map *__map_extent_get_extent(struct extent_map_tree *tree,
- struct address_space *mapping,
- sector_t start, sector_t len, int create,
- gfp_t gfp_mask)
-{
- struct inode *inode = mapping->host;
- struct extent_map *em;
- sector_t nstart, result;
- int ret;
-
-again:
- em = lookup_extent_mapping(tree, start, len);
- if (em) {
- if (em->start <= start && em->end >= start + len)
- return em;
-
- /*
- * we may have found an extent that starts after the
- * requested range. Double check and alter the length
- * appropriately
- */
- if (em->start > start) {
- len = em->start - start;
- } else if (!create) {
- return em;
- }
- ploop_extent_put(em);
- }
- BUG_ON(gfp_mask & GFP_ATOMIC);
-
- em = ploop_alloc_extent_map(gfp_mask);
- if (!em)
- return ERR_PTR(-ENOMEM);
-
- /*
- * FIXME if there are errors later on, we end up exposing stale
- * data on disk while filling holes.
- *
- * _XXX_ Danger! len is reduced above, therefore _get_extent
- * does not allocate all that we need. It works only with pcss
- * and only when cluster size <= pcss block size and allocation
- * is aligned. If we relax those conditions, the code must be fixed.
- */
- ret = tree->_get_extent(inode, start, len, &nstart, &result, create);
- if (ret < 0) {
- ploop_extent_put(em);
- return ERR_PTR(ret);
- }
-
- em->start = nstart;
- em->end = nstart + ret;
- em->block_start = result;
-
- ret = add_extent_mapping(tree, em);
- if (ret == -EEXIST) {
- ploop_extent_put(em);
- goto again;
- }
- return em;
-}
-
static struct extent_map *__map_extent_bmap(struct ploop_io *io,
struct address_space *mapping,
sector_t start, sector_t len, gfp_t gfp_mask)
@@ -749,11 +674,6 @@ static struct extent_map *__map_extent(struct ploop_io *io,
sector_t start, sector_t len, int create,
gfp_t gfp_mask)
{
- struct extent_map_tree *tree = io->files.em_tree;
-
- if (tree->_get_extent)
- return __map_extent_get_extent(tree, mapping, start, len, create,
- gfp_mask);
if (create)
/* create flag not supported by bmap implementation */
return ERR_PTR(-EINVAL);
@@ -761,10 +681,10 @@ static struct extent_map *__map_extent(struct ploop_io *io,
return __map_extent_bmap(io, mapping, start,len, gfp_mask);
}
-struct extent_map *map_extent_get_block(struct ploop_io *io,
- struct address_space *mapping,
- sector_t start, sector_t len, int create,
- gfp_t gfp_mask)
+static struct extent_map *map_extent_get_block(struct ploop_io *io,
+ struct address_space *mapping,
+ sector_t start, sector_t len,
+ int create, gfp_t gfp_mask)
{
struct extent_map *em;
sector_t last;
diff --git a/drivers/block/ploop/io_direct_map.h b/drivers/block/ploop/io_direct_map.h
index 17ab6668be48..d043d87e22f4 100644
--- a/drivers/block/ploop/io_direct_map.h
+++ b/drivers/block/ploop/io_direct_map.h
@@ -17,9 +17,6 @@ struct extent_map_tree
unsigned int map_size; /* # entries in map */
rwlock_t lock;
struct address_space * mapping;
- int (*_get_extent)(struct inode *inode, sector_t isec,
- unsigned int nr, sector_t *start,
- sector_t *psec, int creat);
};
struct extent_map
@@ -51,10 +48,6 @@ struct extent_map *extent_lookup(struct extent_map_tree *tree,
sector_t start);
void ploop_extent_put(struct extent_map *em);
-struct extent_map *map_extent_get_block(struct ploop_io *io,
- struct address_space *mapping,
- sector_t start, sector_t len, int create,
- gfp_t gfp_mask);
void trim_extent_mappings(struct ploop_device *plo,
struct extent_map_tree *tree, sector_t start);
diff --git a/include/linux/ploop/ploop_if.h b/include/linux/ploop/ploop_if.h
index 9c116ce5b74e..3b5928cfb69e 100644
--- a/include/linux/ploop/ploop_if.h
+++ b/include/linux/ploop/ploop_if.h
@@ -368,20 +368,4 @@ struct ploop_track_extent
#define PLOOP_EVENT_STOPPED 2
#define PLOOP_EVENT_ENOSPC 3
-#ifdef __KERNEL__
-
-#define PLOOP_INTERNAL_MAGIC 0x284cd32c
-struct ploop_xops
-{
- __u32 magic;
-
- int (*get_extent)(struct inode *inode, sector_t isec,
- unsigned int nr, sector_t *start,
- sector_t *psec, int creat);
-};
-
-#define PLOOP_IOC_INTERNAL _IOR(PLOOPCTLTYPE, 15, struct ploop_xops)
-
-#endif
-
#endif /* __PLOOP_IF_H__ */
More information about the Devel
mailing list