All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Josef Bacik <josef@toxicpanda.com>,
	Minchan Kim <minchan@kernel.org>,
	Stefan Haberland <sth@linux.ibm.com>,
	Jan Hoeppner <hoeppner@linux.ibm.com>,
	Joseph Qi <joseph.qi@linux.alibaba.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	nbd@other.debian.org,
	"open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)" 
	<linux-ide@vger.kernel.org>,
	linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	ocfs2-devel@oss.oracle.com, Linux PM <linux-pm@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	linux-block@vger.kernel.org
Subject: Re: [PATCH 11/14] PM: rewrite is_hibernate_resume_dev to not require an inode
Date: Thu, 17 Sep 2020 19:26:43 +0200	[thread overview]
Message-ID: <CAJZ5v0gF1_JLP6B6Ecnax1w72GxRUUhPxs0q7ciT=Q2U=LQD9Q@mail.gmail.com> (raw)
In-Reply-To: <20200917165720.3285256-12-hch@lst.de>

On Thu, Sep 17, 2020 at 7:24 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Just check the dev_t to help simplifying the code.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  fs/block_dev.c          |  2 +-
>  include/linux/suspend.h |  4 ++--
>  kernel/power/user.c     | 12 ++++++------
>  3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 1a9325f4315769..2898d69be6b3e4 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -1885,7 +1885,7 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
>         if (bdev_read_only(I_BDEV(bd_inode)))
>                 return -EPERM;
>
> -       if (IS_SWAPFILE(bd_inode) && !is_hibernate_resume_dev(bd_inode))
> +       if (IS_SWAPFILE(bd_inode) && !is_hibernate_resume_dev(bd_inode->i_rdev))
>                 return -ETXTBSY;
>
>         if (!iov_iter_count(from))
> diff --git a/include/linux/suspend.h b/include/linux/suspend.h
> index cb9afad82a90c8..8af13ba60c7e45 100644
> --- a/include/linux/suspend.h
> +++ b/include/linux/suspend.h
> @@ -473,9 +473,9 @@ static inline int hibernate_quiet_exec(int (*func)(void *data), void *data) {
>  #endif /* CONFIG_HIBERNATION */
>
>  #ifdef CONFIG_HIBERNATION_SNAPSHOT_DEV
> -int is_hibernate_resume_dev(const struct inode *);
> +int is_hibernate_resume_dev(dev_t dev);
>  #else
> -static inline int is_hibernate_resume_dev(const struct inode *i) { return 0; }
> +static inline int is_hibernate_resume_dev(dev_t dev) { return 0; }
>  #endif
>
>  /* Hibernation and suspend events */
> diff --git a/kernel/power/user.c b/kernel/power/user.c
> index d5eedc2baa2a10..b5815685b944fe 100644
> --- a/kernel/power/user.c
> +++ b/kernel/power/user.c
> @@ -35,12 +35,12 @@ static struct snapshot_data {
>         bool ready;
>         bool platform_support;
>         bool free_bitmaps;
> -       struct inode *bd_inode;
> +       dev_t dev;
>  } snapshot_state;
>
> -int is_hibernate_resume_dev(const struct inode *bd_inode)
> +int is_hibernate_resume_dev(dev_t dev)
>  {
> -       return hibernation_available() && snapshot_state.bd_inode == bd_inode;
> +       return hibernation_available() && snapshot_state.dev == dev;
>  }
>
>  static int snapshot_open(struct inode *inode, struct file *filp)
> @@ -101,7 +101,7 @@ static int snapshot_open(struct inode *inode, struct file *filp)
>         data->frozen = false;
>         data->ready = false;
>         data->platform_support = false;
> -       data->bd_inode = NULL;
> +       data->dev = 0;
>
>   Unlock:
>         unlock_system_sleep();
> @@ -117,7 +117,7 @@ static int snapshot_release(struct inode *inode, struct file *filp)
>
>         swsusp_free();
>         data = filp->private_data;
> -       data->bd_inode = NULL;
> +       data->dev = 0;
>         free_all_swap_pages(data->swap);
>         if (data->frozen) {
>                 pm_restore_gfp_mask();
> @@ -245,7 +245,7 @@ static int snapshot_set_swap_area(struct snapshot_data *data,
>         if (data->swap < 0)
>                 return -ENODEV;
>
> -       data->bd_inode = bdev->bd_inode;
> +       data->dev = bdev->bd_dev;
>         bdput(bdev);
>         return 0;
>  }
> --
> 2.28.0
>

WARNING: multiple messages have this Message-ID (diff)
From: Rafael J. Wysocki <rafael@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Josef Bacik <josef@toxicpanda.com>,
	Minchan Kim <minchan@kernel.org>,
	Stefan Haberland <sth@linux.ibm.com>,
	Jan Hoeppner <hoeppner@linux.ibm.com>,
	Joseph Qi <joseph.qi@linux.alibaba.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	nbd@other.debian.org,
	"open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)"
	<linux-ide@vger.kernel.org>,
	linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	ocfs2-devel@oss.oracle.com, Linux PM <linux-pm@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	linux-block@vger.kernel.org
Subject: [Ocfs2-devel] [PATCH 11/14] PM: rewrite is_hibernate_resume_dev to not require an inode
Date: Thu, 17 Sep 2020 19:26:43 +0200	[thread overview]
Message-ID: <CAJZ5v0gF1_JLP6B6Ecnax1w72GxRUUhPxs0q7ciT=Q2U=LQD9Q@mail.gmail.com> (raw)
In-Reply-To: <20200917165720.3285256-12-hch@lst.de>

On Thu, Sep 17, 2020 at 7:24 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Just check the dev_t to help simplifying the code.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  fs/block_dev.c          |  2 +-
>  include/linux/suspend.h |  4 ++--
>  kernel/power/user.c     | 12 ++++++------
>  3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 1a9325f4315769..2898d69be6b3e4 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -1885,7 +1885,7 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
>         if (bdev_read_only(I_BDEV(bd_inode)))
>                 return -EPERM;
>
> -       if (IS_SWAPFILE(bd_inode) && !is_hibernate_resume_dev(bd_inode))
> +       if (IS_SWAPFILE(bd_inode) && !is_hibernate_resume_dev(bd_inode->i_rdev))
>                 return -ETXTBSY;
>
>         if (!iov_iter_count(from))
> diff --git a/include/linux/suspend.h b/include/linux/suspend.h
> index cb9afad82a90c8..8af13ba60c7e45 100644
> --- a/include/linux/suspend.h
> +++ b/include/linux/suspend.h
> @@ -473,9 +473,9 @@ static inline int hibernate_quiet_exec(int (*func)(void *data), void *data) {
>  #endif /* CONFIG_HIBERNATION */
>
>  #ifdef CONFIG_HIBERNATION_SNAPSHOT_DEV
> -int is_hibernate_resume_dev(const struct inode *);
> +int is_hibernate_resume_dev(dev_t dev);
>  #else
> -static inline int is_hibernate_resume_dev(const struct inode *i) { return 0; }
> +static inline int is_hibernate_resume_dev(dev_t dev) { return 0; }
>  #endif
>
>  /* Hibernation and suspend events */
> diff --git a/kernel/power/user.c b/kernel/power/user.c
> index d5eedc2baa2a10..b5815685b944fe 100644
> --- a/kernel/power/user.c
> +++ b/kernel/power/user.c
> @@ -35,12 +35,12 @@ static struct snapshot_data {
>         bool ready;
>         bool platform_support;
>         bool free_bitmaps;
> -       struct inode *bd_inode;
> +       dev_t dev;
>  } snapshot_state;
>
> -int is_hibernate_resume_dev(const struct inode *bd_inode)
> +int is_hibernate_resume_dev(dev_t dev)
>  {
> -       return hibernation_available() && snapshot_state.bd_inode == bd_inode;
> +       return hibernation_available() && snapshot_state.dev == dev;
>  }
>
>  static int snapshot_open(struct inode *inode, struct file *filp)
> @@ -101,7 +101,7 @@ static int snapshot_open(struct inode *inode, struct file *filp)
>         data->frozen = false;
>         data->ready = false;
>         data->platform_support = false;
> -       data->bd_inode = NULL;
> +       data->dev = 0;
>
>   Unlock:
>         unlock_system_sleep();
> @@ -117,7 +117,7 @@ static int snapshot_release(struct inode *inode, struct file *filp)
>
>         swsusp_free();
>         data = filp->private_data;
> -       data->bd_inode = NULL;
> +       data->dev = 0;
>         free_all_swap_pages(data->swap);
>         if (data->frozen) {
>                 pm_restore_gfp_mask();
> @@ -245,7 +245,7 @@ static int snapshot_set_swap_area(struct snapshot_data *data,
>         if (data->swap < 0)
>                 return -ENODEV;
>
> -       data->bd_inode = bdev->bd_inode;
> +       data->dev = bdev->bd_dev;
>         bdput(bdev);
>         return 0;
>  }
> --
> 2.28.0
>

  reply	other threads:[~2020-09-17 18:31 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 16:57 remove blkdev_get as a public API Christoph Hellwig
2020-09-17 16:57 ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 16:57 ` [PATCH 01/14] block: move the NEED_PART_SCAN flag to struct gendisk Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-24  8:56   ` Jan Kara
2020-09-24  8:56     ` [Ocfs2-devel] " Jan Kara
2020-09-17 16:57 ` [PATCH 02/14] block: switch register_disk to use blkdev_get_by_dev Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-18  8:52   ` Sergei Shtylyov
2020-09-18  8:52     ` [Ocfs2-devel] " Sergei Shtylyov
2020-09-19  5:15     ` Christoph Hellwig
2020-09-19  5:15       ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 16:57 ` [PATCH 03/14] block: cleanup blkdev_bszset Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 16:57 ` [PATCH 04/14] pktcdvd: remove the if 0'ed pkt_start_recovery function Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 16:57 ` [PATCH 05/14] pktcdvd: use blkdev_get_by_dev instead of open coding it Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 16:57 ` [PATCH 06/14] zram: cleanup backing_dev_store Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 16:57 ` [PATCH 07/14] raw: don't keep unopened block device around Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 16:57 ` [PATCH 08/14] dasd: cleanup dasd_scan_partitions Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 16:57 ` [PATCH 09/14] ocfs2: cleanup o2hb_region_dev_store Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-18  2:11   ` Joseph Qi
2020-09-18  2:11     ` [Ocfs2-devel] " Joseph Qi
2020-09-17 16:57 ` [PATCH 10/14] mm: cleanup claim_swapfile Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 16:57 ` [PATCH 11/14] PM: rewrite is_hibernate_resume_dev to not require an inode Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 17:26   ` Rafael J. Wysocki [this message]
2020-09-17 17:26     ` Rafael J. Wysocki
2020-09-17 17:26     ` [Ocfs2-devel] " Rafael J. Wysocki
2020-09-17 17:26     ` Rafael J. Wysocki
2020-09-19  9:06   ` Pavel Machek
2020-09-19  9:06     ` [Ocfs2-devel] " Pavel Machek
2020-09-17 16:57 ` [PATCH 12/14] mm: split swap_type_of Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-17 16:57 ` [PATCH 13/14] PM: mm: cleanup swsusp_swap_check Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-18 16:01   ` Rafael J. Wysocki
2020-09-18 16:01     ` Rafael J. Wysocki
2020-09-18 16:01     ` [Ocfs2-devel] " Rafael J. Wysocki
2020-09-18 16:01     ` Rafael J. Wysocki
2020-09-19  9:06   ` Pavel Machek
2020-09-19  9:06     ` [Ocfs2-devel] " Pavel Machek
2020-09-17 16:57 ` [PATCH 14/14] block: mark blkdev_get static Christoph Hellwig
2020-09-17 16:57   ` [Ocfs2-devel] " Christoph Hellwig
2020-09-21  7:19 remove blkdev_get as a public API v2 Christoph Hellwig
2020-09-21  7:19 ` [PATCH 11/14] PM: rewrite is_hibernate_resume_dev to not require an inode Christoph Hellwig
2020-09-21 21:46   ` Pavel Machek

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='CAJZ5v0gF1_JLP6B6Ecnax1w72GxRUUhPxs0q7ciT=Q2U=LQD9Q@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=hoeppner@linux.ibm.com \
    --cc=josef@toxicpanda.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=len.brown@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=nbd@other.debian.org \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=sth@linux.ibm.com \
    /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.