linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, hch@lst.de
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Subject: [PATCH 3/6] block: Make max_discard_sectors sector_t
Date: Thu, 19 Aug 2010 11:48:58 -0400	[thread overview]
Message-ID: <1282232941-9910-4-git-send-email-martin.petersen@oracle.com> (raw)
In-Reply-To: <1282232941-9910-1-git-send-email-martin.petersen@oracle.com>

With 4KB ATA TRIM payloads we can express ranges above the 32 bits
allowed by SCSI.  Convert max_discard_sectors to sector_t.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 block/blk-lib.c        |    5 +++--
 block/blk-settings.c   |    2 +-
 include/linux/blkdev.h |    4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/block/blk-lib.c b/block/blk-lib.c
index d0216b9..dbed1e9 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -54,8 +54,9 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
 
 	while (nr_sects && !ret) {
 		unsigned int sector_size = q->limits.logical_block_size;
-		unsigned int max_discard_sectors =
-			min(q->limits.max_discard_sectors, UINT_MAX >> 9);
+		sector_t max_discard_sectors =
+			min(q->limits.max_discard_sectors,
+			    (sector_t)UINT_MAX >> 9);
 
 		bio = bio_alloc(gfp_mask, 1);
 		if (!bio)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index f5ed5a1..a4a2f42 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -246,7 +246,7 @@ EXPORT_SYMBOL(blk_queue_max_hw_sectors);
  * @max_discard_sectors: maximum number of sectors to discard
  **/
 void blk_queue_max_discard_sectors(struct request_queue *q,
-		unsigned int max_discard_sectors)
+		sector_t max_discard_sectors)
 {
 	q->limits.max_discard_sectors = max_discard_sectors;
 }
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 09a8402..d083146 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -316,7 +316,7 @@ struct queue_limits {
 	unsigned int		alignment_offset;
 	unsigned int		io_min;
 	unsigned int		io_opt;
-	unsigned int		max_discard_sectors;
+	sector_t		max_discard_sectors;
 	unsigned int		discard_granularity;
 	unsigned int		discard_alignment;
 
@@ -934,7 +934,7 @@ extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
 extern void blk_queue_max_segments(struct request_queue *, unsigned short);
 extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
 extern void blk_queue_max_discard_sectors(struct request_queue *q,
-		unsigned int max_discard_sectors);
+		sector_t max_discard_sectors);
 extern void blk_queue_logical_block_size(struct request_queue *, unsigned short);
 extern void blk_queue_physical_block_size(struct request_queue *, unsigned short);
 extern void blk_queue_alignment_offset(struct request_queue *q,
-- 
1.7.2.1


  parent reply	other threads:[~2010-08-19 15:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19 15:48 Discard/trim/thin provisioning update Martin K. Petersen
2010-08-19 15:48 ` [PATCH 1/6] libata: Signal that our SATL supports WRITE SAME(16) with UNMAP Martin K. Petersen
2010-08-19 16:15   ` James Bottomley
2010-08-19 16:20     ` Martin K. Petersen
2010-08-23  8:32   ` Tejun Heo
2010-08-23 18:22     ` Douglas Gilbert
2010-08-23 18:29       ` Douglas Gilbert
2010-08-23 19:11         ` Martin K. Petersen
2010-08-19 15:48 ` [PATCH 2/6] libata: Report supported TRIM payload size Martin K. Petersen
2010-08-19 17:27   ` Greg Freemyer
2010-08-19 18:05     ` Martin K. Petersen
2010-08-19 21:08       ` Greg Freemyer
2010-08-19 21:50       ` Mark Lord
2010-08-20  8:58         ` Christoph Hellwig
2010-08-20 13:53           ` Mark Lord
2010-08-20 17:13             ` Greg Freemyer
2010-08-20 18:28               ` Mark Lord
2010-08-23 13:50   ` Christoph Hellwig
2010-08-23 18:56     ` Martin K. Petersen
2010-08-19 15:48 ` Martin K. Petersen [this message]
2010-08-20  8:59   ` [PATCH 3/6] block: Make max_discard_sectors sector_t Christoph Hellwig
2010-08-19 15:48 ` [PATCH 4/6] scsi: Fix VPD page wrapper Martin K. Petersen
2010-08-19 15:49 ` [PATCH 5/6] scsi_debug: Update thin provisioning support Martin K. Petersen
2010-08-23 16:37   ` Douglas Gilbert
2010-08-19 15:49 ` [PATCH 6/6] sd: " Martin K. Petersen
2010-08-20  9:00   ` Christoph Hellwig
2010-08-23 19:06     ` Martin K. Petersen

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=1282232941-9910-4-git-send-email-martin.petersen@oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=hch@lst.de \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@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).