All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org
Subject: [PATCH 1/7] block: remove the alignment_offset field from struct hd_struct
Date: Mon, 31 Aug 2020 20:02:33 +0200	[thread overview]
Message-ID: <20200831180239.2372776-2-hch@lst.de> (raw)
In-Reply-To: <20200831180239.2372776-1-hch@lst.de>

The alignment offset is only used in slow path callers, so just calculate
it on the fly.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/partitions/core.c | 7 ++++---
 include/linux/blkdev.h  | 5 ++---
 include/linux/genhd.h   | 1 -
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/block/partitions/core.c b/block/partitions/core.c
index 328a2cb7875ba1..4baa065eef7864 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -199,7 +199,10 @@ static ssize_t part_alignment_offset_show(struct device *dev,
 					  struct device_attribute *attr, char *buf)
 {
 	struct hd_struct *p = dev_to_part(dev);
-	return sprintf(buf, "%llu\n", (unsigned long long)p->alignment_offset);
+
+	return sprintf(buf, "%u\n",
+		queue_limit_alignment_offset(&part_to_disk(p)->queue->limits,
+				p->start_sect));
 }
 
 static ssize_t part_discard_alignment_show(struct device *dev,
@@ -397,8 +400,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
 	pdev = part_to_dev(p);
 
 	p->start_sect = start;
-	p->alignment_offset =
-		queue_limit_alignment_offset(&disk->queue->limits, start);
 	p->discard_alignment =
 		queue_limit_discard_alignment(&disk->queue->limits, start);
 	p->nr_sects = len;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0a1730b30ad210..ba1f5f5e11c647 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1456,10 +1456,9 @@ static inline int bdev_alignment_offset(struct block_device *bdev)
 
 	if (q->limits.misaligned)
 		return -1;
-
 	if (bdev != bdev->bd_contains)
-		return bdev->bd_part->alignment_offset;
-
+		return queue_limit_alignment_offset(&q->limits,
+				bdev->bd_part->start_sect);
 	return q->limits.alignment_offset;
 }
 
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 39025dc0397c04..bfa411c80dbbf8 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -65,7 +65,6 @@ struct hd_struct {
 	struct disk_stats __percpu *dkstats;
 	struct percpu_ref ref;
 
-	sector_t alignment_offset;
 	unsigned int discard_alignment;
 	struct device __dev;
 	struct kobject *holder_dir;
-- 
2.28.0


  reply	other threads:[~2020-08-31 18:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 18:02 misc cleanups Christoph Hellwig
2020-08-31 18:02 ` Christoph Hellwig [this message]
2020-08-31 18:02 ` [PATCH 2/7] block: remove the discard_alignment field from struct hd_struct Christoph Hellwig
2020-08-31 18:02 ` [PATCH 3/7] block: remove an outdated comment on the bd_dev field Christoph Hellwig
2020-08-31 18:02 ` [PATCH 4/7] block: move the devcgroup_inode_permission call to blkdev_get Christoph Hellwig
2020-08-31 18:02 ` [PATCH 5/7] block: cleanup __alloc_disk_node Christoph Hellwig
2020-08-31 18:02 ` [PATCH 6/7] block: remove the disk argument to delete_partition Christoph Hellwig
2020-08-31 18:02 ` [PATCH 7/7] block: remove the unused q argument to part_in_flight and part_in_flight_rw Christoph Hellwig
2020-09-01 15:12 ` misc cleanups Jens Axboe

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=20200831180239.2372776-2-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.