[rh7,2/5] ploop: Kill unused sync vec functions

Submitted by Kirill Tkhai on July 3, 2019, 4:52 p.m.

Details

Message ID 156217277313.24056.5321612504649888292.stgit@localhost.localdomain
State New
Series "ploop: Remove duplicated and unused functions"
Headers show

Commit Message

Kirill Tkhai July 3, 2019, 4:52 p.m.
Nobody uses these callbacks.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/block/ploop/io_direct.c |  125 ---------------------------------------
 drivers/block/ploop/io_kaio.c   |   16 -----
 include/linux/ploop/ploop.h     |    6 --
 3 files changed, 147 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 92a328c21b4f..754f35923950 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -1183,129 +1183,6 @@  dio_sync_write(struct ploop_io * io, struct page * page, unsigned int len,
 	return err;
 }
 
-static int
-dio_sync_iovec(struct ploop_io * io, int rw, struct page ** pvec,
-	       unsigned int nr, sector_t sec)
-{
-	struct bio_list bl = BIO_EMPTY_LIST;
-	struct bio * bio;
-	struct dio_comp comp;
-	unsigned int len = PAGE_SIZE * nr;
-	unsigned int off;
-	struct extent_map * em;
-	int err;
-	sector_t nsec;
-
-	bio = NULL;
-	em = NULL;
-	off = 0;
-
-	init_completion(&comp.comp);
-	atomic_set(&comp.count, 1);
-	comp.error = 0;
-
-	while (len > 0) {
-		int copy;
-
-		if (!em || sec >= em->end) {
-			if (em)
-				ploop_extent_put(em);
-			em = extent_lookup_create(io, sec, len>>9);
-			if (IS_ERR(em))
-				goto out_em_err;
-		}
-
-		nsec = dio_isec_to_phys(em, sec);
-
-		if (bio == NULL ||
-		    bio->bi_sector + (bio->bi_size>>9) != nsec) {
-flush_bio:
-			bio = bio_alloc(GFP_NOFS, 32);
-			if (bio == NULL)
-				goto enomem;
-			bio_list_add(&bl, bio);
-			bio->bi_bdev = io->files.bdev;
-			bio->bi_sector = nsec;
-		}
-
-		copy = len;
-		if (copy > ((em->end - sec) << 9))
-			copy = (em->end - sec) << 9;
-		if (off/PAGE_SIZE != (off + copy + 1)/PAGE_SIZE)
-			copy = PAGE_SIZE - (off & (PAGE_SIZE-1));
-		if (bio_add_page(bio, pvec[off/PAGE_SIZE], copy,
-				 off & (PAGE_SIZE-1) ) != copy) {
-			/* Oops. */
-			goto flush_bio;
-		}
-
-		off += copy;
-		len -= copy;
-		sec += copy >> 9;
-	}
-
-	if (em)
-		ploop_extent_put(em);
-
-	while (bl.head) {
-		struct bio * b = bl.head;
-		bl.head = b->bi_next;
-
-		b->bi_next = NULL;
-		b->bi_end_io = dio_endio_sync;
-		b->bi_private = &comp;
-		atomic_inc(&comp.count);
-		submit_bio(rw, b);
-	}
-
-	if (atomic_dec_and_test(&comp.count))
-		complete(&comp.comp);
-
-	wait_for_completion(&comp.comp);
-
-	return comp.error;
-
-
-enomem:
-	err = -ENOMEM;
-	goto out;
-
-out_em_err:
-	err = PTR_ERR(em);
-out:
-	while (bl.head) {
-		struct bio * b = bl.head;
-		bl.head = b->bi_next;
-		b->bi_next = NULL;
-		bio_put(b);
-	}
-	return err;
-}
-
-static int
-dio_sync_readvec(struct ploop_io * io, struct page ** pvec, unsigned int nr,
-		 sector_t sec)
-{
-	return dio_sync_iovec(io, READ_SYNC, pvec, nr, sec);
-}
-
-static int
-dio_sync_writevec(struct ploop_io * io, struct page ** pvec, unsigned int nr,
-		  sector_t sec)
-{
-	int err;
-
-	if (!(io->files.file->f_mode & FMODE_WRITE))
-		return -EBADF;
-
-	err = dio_sync_iovec(io, WRITE_SYNC, pvec, nr, sec);
-
-	if (sec < io->plo->track_end)
-		ploop_tracker_notify(io->plo, sec);
-
-	return err;
-}
-
 /*
  * Allocate and zero new block in file. Do it through page cache.
  * It is assumed there is no point to optimize this, it is used
@@ -1914,8 +1791,6 @@  static struct ploop_io_ops ploop_io_ops_direct =
 	.write_page	=	dio_write_page,
 	.sync_read	=	dio_sync_read,
 	.sync_write	=	dio_sync_write,
-	.sync_readvec	=	dio_sync_readvec,
-	.sync_writevec	=	dio_sync_writevec,
 
 	.init		=	dio_init,
 	.destroy	=	dio_destroy,
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index e0464e3a074d..1e68727a3f87 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -749,20 +749,6 @@  kaio_write_page(struct ploop_io * io, struct ploop_request * preq,
 	kaio_io_page(io, IOCB_CMD_WRITE_ITER, preq, page, sec);
 }
 
-static int
-kaio_sync_readvec(struct ploop_io * io, struct page ** pvec, unsigned int nr,
-		   sector_t sec)
-{
-	return -EINVAL;
-}
-
-static int
-kaio_sync_writevec(struct ploop_io * io, struct page ** pvec, unsigned int nr,
-		    sector_t sec)
-{
-	return -EINVAL;
-}
-
 struct kaio_comp {
 	struct completion comp;
 	atomic_t count;
@@ -1147,8 +1133,6 @@  static struct ploop_io_ops ploop_io_ops_kaio =
 	.write_page	=	kaio_write_page,
 	.sync_read	=	kaio_sync_read,
 	.sync_write	=	kaio_sync_write,
-	.sync_readvec	=	kaio_sync_readvec,
-	.sync_writevec	=	kaio_sync_writevec,
 
 	.init		=	kaio_init,
 	.destroy	=	kaio_destroy,
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index 91fc8b47d079..5a71d602d486 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -179,12 +179,6 @@  struct ploop_io_ops
 	int	(*sync_write)(struct ploop_io * io, struct page * page,
 			      unsigned int len, unsigned int off, sector_t sec);
 
-
-	int	(*sync_readvec)(struct ploop_io * io, struct page ** pvec,
-				unsigned int nr, sector_t sec);
-	int	(*sync_writevec)(struct ploop_io * io, struct page ** pvec,
-				unsigned int nr, sector_t sec);
-
 	int	(*init)(struct ploop_io * io);
 	void	(*destroy)(struct ploop_io * io);
 	int	(*open)(struct ploop_io * io);