linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Quinn Tran <quinn.tran@qlogic.com>
To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org
Cc: giridhar.malavali@qlogic.com, saurav.kashyap@qlogic.com,
	andrew.vasquez@qlogic.com
Subject: [PATCH 4/4] target/rd: T10-Dif: RAM disk is allocating more space than required.
Date: Fri, 28 Mar 2014 19:05:27 -0400	[thread overview]
Message-ID: <1396047927-14189-5-git-send-email-quinn.tran@qlogic.com> (raw)
In-Reply-To: <1396047927-14189-1-git-send-email-quinn.tran@qlogic.com>

Ram disk is allocating 8x more space than required for diff data.
For large RAM disk test, there is small potential for memory
starvation.

Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
---
 drivers/target/target_core_rd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index 01dda0b..6df177a 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -253,7 +253,11 @@ static int rd_build_prot_space(struct rd_dev *rd_dev, int prot_length)
 	if (rd_dev->rd_flags & RDF_NULLIO)
 		return 0;
 
-	total_sg_needed = rd_dev->rd_page_count / prot_length;
+	/* prot_length=8byte dif data
+	 * tot sg needed = rd_page_count * (PGSZ/512) * (prot_length/PGSZ) + pad
+	 * PGSZ canceled each other.
+	 */
+	total_sg_needed = (rd_dev->rd_page_count * prot_length / 512) +1;
 
 	sg_tables = (total_sg_needed / max_sg_per_table) + 1;
 
-- 
1.8.4.GIT


  parent reply	other threads:[~2014-03-28 23:42 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28 23:05 [PATCH RFC 0/4] add T10-Dif registration for tcm_qla2xxx Quinn Tran
2014-03-28 23:05 ` [PATCH 1/4] target/core: T10-Dif: check HW support capabilities Quinn Tran
2014-03-29  0:05   ` sagi grimberg
2014-03-29  0:53     ` Quinn Tran
2014-03-29  1:24       ` sagi grimberg
2014-03-31 17:53         ` Quinn Tran
2014-04-01  1:19           ` Nicholas A. Bellinger
2014-04-01  7:59             ` Sagi Grimberg
2014-04-01 17:09               ` Martin K. Petersen
2014-04-01 17:27                 ` sagi grimberg
2014-04-01 17:45                   ` Nicholas A. Bellinger
2014-04-02  6:51                     ` Sagi Grimberg
2014-04-02 18:20                       ` Nicholas A. Bellinger
2014-04-03  1:18                         ` Quinn Tran
2014-04-02 11:43                     ` sagi grimberg
2014-04-02 18:47                       ` Nicholas A. Bellinger
2014-04-01  1:03         ` Nicholas A. Bellinger
2014-03-28 23:05 ` [PATCH 2/4] tcm_qla2xxx: T10-Dif set harware capability Quinn Tran
2014-03-29  0:12   ` sagi grimberg
2014-03-31 15:38     ` Quinn Tran
2014-04-01  1:11       ` Nicholas A. Bellinger
2014-04-01  8:04         ` Sagi Grimberg
2014-04-01 17:40           ` Nicholas A. Bellinger
2014-04-02 10:26             ` sagi grimberg
2014-03-28 23:05 ` [PATCH 3/4] target/rd: T10-Dif: Add init/format support Quinn Tran
2014-03-29  0:16   ` sagi grimberg
2014-03-31 16:14     ` Quinn Tran
2014-03-28 23:05 ` Quinn Tran [this message]
2014-03-29  0:22   ` [PATCH 4/4] target/rd: T10-Dif: RAM disk is allocating more space than required sagi grimberg
2014-03-31 16:15     ` Quinn Tran
2014-04-01  0:41       ` Nicholas A. Bellinger
2014-03-28 23:48 ` [PATCH RFC 0/4] add T10-Dif registration for tcm_qla2xxx Quinn Tran
2014-03-29  0:23   ` sagi grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396047927-14189-5-git-send-email-quinn.tran@qlogic.com \
    --to=quinn.tran@qlogic.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=giridhar.malavali@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=saurav.kashyap@qlogic.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).