[Devel] [PATCH RHEL7 COMMIT] ploop: Make submit_alloc() return int value

Konstantin Khorenko khorenko at virtuozzo.com
Thu Mar 28 12:37:40 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.10.1.vz7.85.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.10.1.vz7.85.5
------>
commit 7af5c9d73f557ea162b26b54d1b9ee99eb0452df
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Mar 28 12:37:37 2019 +0300

    ploop: Make submit_alloc() return int value
    
    -1 is error;
    0 means this service preq is skipped;
    1 is block was allocated
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    ploop: Discard with zeroing of ploop1 indexes support
    
    https://jira.sw.ru/browse/PSBM-92367
    https://pmc.acronis.com/browse/VSTOR-19972
    
    Kirill Tkhai (10):
          ploop: Export map defines to separate header file
          ploop: Make submit_alloc() return int value
          ploop: Introduce ploop_submit_alloc() helper
          ploop: Prohibit discard ioctls
          ploop: Prohibit PLOOP_IOC_UPDATE_INDEX on singular list
          ploop: Introduce data_off_in_clusters() helper
          ploop: Add .complete_merge method
          ploop: Zero indexes on discard
          ploop: Fallocate cluster in cached_submit() during hole reuse
          ploop: Populate and maintain holes bitmap
---
 drivers/block/ploop/io_direct.c |  6 ++++--
 drivers/block/ploop/io_kaio.c   | 11 ++++++-----
 include/linux/ploop/ploop.h     |  2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 21cfdeb7441b..b1955d339de5 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -730,7 +730,7 @@ dio_submit_pad(struct ploop_io *io, struct ploop_request * preq,
 	PLOOP_FAIL_REQUEST(preq, err);
 }
 
-static void
+static int
 dio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
 		 struct bio_list * sbl, unsigned int size)
 {
@@ -741,7 +741,7 @@ dio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
 
 	if (!(io->files.file->f_mode & FMODE_WRITE)) {
 		PLOOP_FAIL_REQUEST(preq, -EBADF);
-		return;
+		return -1;
 	}
 
 	err = cached_submit(io, iblk, preq, sbl, size, true);
@@ -749,8 +749,10 @@ dio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
 		if (err == -ENOSPC)
 			io->alloc_head--;
 		PLOOP_FAIL_REQUEST(preq, err);
+		return -1;
 	}
 	preq->eng_state = PLOOP_E_DATA_WBI;
+	return 1;
 }
 
 /* When backing fs does not export any method to allocate new blocks
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 84da1cec5643..1e4ae6efbe70 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -546,7 +546,7 @@ static int kaio_fsync_thread(void * data)
 	return 0;
 }
 
-static void
+static int
 kaio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
 		 struct bio_list * sbl, unsigned int size)
 {
@@ -558,7 +558,7 @@ kaio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
 
 	if (delta->flags & PLOOP_FMT_RDONLY) {
 		PLOOP_FAIL_REQUEST(preq, -EBADF);
-		return;
+		return -1;
 	}
 
 	iblk = io->alloc_head;
@@ -568,7 +568,7 @@ kaio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
 		kaio_queue_fsync_req(preq);
 		io->plo->st.bio_syncwait++;
 		spin_unlock_irq(&io->plo->lock);
-		return;
+		return 0;
 	}
 
 	BUG_ON(preq->prealloc_size);
@@ -586,11 +586,11 @@ kaio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
 			kaio_queue_trunc_req(preq);
 			io->plo->st.bio_syncwait++;
 			spin_unlock_irq(&io->plo->lock);
-			return;
+			return 0;
 		} else { /* we're not first */
 			list_add_tail(&preq->list,
 				      &io->prealloc_preq->delay_list);
-			return;
+			return 0;
 		}
 	}
 
@@ -600,6 +600,7 @@ kaio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
 	preq->eng_state = PLOOP_E_DATA_WBI;
 
 	kaio_sbl_submit(io->files.file, preq, REQ_WRITE, sbl, iblk, size);
+	return 1;
 }
 
 static int kaio_release_prealloced(struct ploop_io * io)
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index b209c9f096a8..599f7dbff7f2 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -159,7 +159,7 @@ struct ploop_io_ops
 	void	(*submit)(struct ploop_io *, struct ploop_request *,
 			  unsigned long rw,
 			  struct bio_list *sbl, iblock_t iblk, unsigned int size);
-	void	(*submit_alloc)(struct ploop_io *, struct ploop_request *,
+	int	(*submit_alloc)(struct ploop_io *, struct ploop_request *,
 				struct bio_list *sbl, unsigned int size);
 	void	(*post_submit)(struct ploop_io *, struct ploop_request *);
 



More information about the Devel mailing list