diff mbox series

xen/blkback: use kmap_local_page()

Message ID 20240306051548.90954-1-flyingpeng@tencent.com (mailing list archive)
State Superseded
Headers show
Series xen/blkback: use kmap_local_page() | expand

Commit Message

Hao Peng March 6, 2024, 5:15 a.m. UTC
From: Peng Hao <flyingpeng@tencent.com>

From: Peng Hao <flyingpeng@tencent.com>

Use kmap_local_page() instead of kmap_atomic() which has been
deprecated.

Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
 drivers/block/xen-blkback/blkback.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Roger Pau Monné March 6, 2024, 8:41 a.m. UTC | #1
On Wed, Mar 06, 2024 at 01:15:48PM +0800, flyingpenghao@gmail.com wrote:
> From: Peng Hao <flyingpeng@tencent.com>
> 
> From: Peng Hao <flyingpeng@tencent.com>
> 
> Use kmap_local_page() instead of kmap_atomic() which has been
> deprecated.
> 
> Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> ---
>  drivers/block/xen-blkback/blkback.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
> index 4defd7f387c7..cce534f43292 100644
> --- a/drivers/block/xen-blkback/blkback.c
> +++ b/drivers/block/xen-blkback/blkback.c
> @@ -937,8 +937,8 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req,
>  		if ((n % SEGS_PER_INDIRECT_FRAME) == 0) {
>  			/* Map indirect segments */
>  			if (segments)
> -				kunmap_atomic(segments);
> -			segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]->page);
> +				kunmap_local(segments);
> +			segments = kmap_local_page(pages[n/SEGS_PER_INDIRECT_FRAME]->page);

Don't you need to also switch to kunmap_local() then instead of
kunmap_atomic()?

Thanks, Roger.
Hao Peng March 14, 2024, 1:28 p.m. UTC | #2
On Wed, Mar 6, 2024 at 4:41 PM Roger Pau Monné <roger.pau@citrix.com> wrote:
>
> On Wed, Mar 06, 2024 at 01:15:48PM +0800, flyingpenghao@gmail.com wrote:
> > From: Peng Hao <flyingpeng@tencent.com>
> >
> > From: Peng Hao <flyingpeng@tencent.com>
> >
> > Use kmap_local_page() instead of kmap_atomic() which has been
> > deprecated.
> >
> > Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> > ---
> >  drivers/block/xen-blkback/blkback.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
> > index 4defd7f387c7..cce534f43292 100644
> > --- a/drivers/block/xen-blkback/blkback.c
> > +++ b/drivers/block/xen-blkback/blkback.c
> > @@ -937,8 +937,8 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req,
> >               if ((n % SEGS_PER_INDIRECT_FRAME) == 0) {
> >                       /* Map indirect segments */
> >                       if (segments)
> > -                             kunmap_atomic(segments);
> > -                     segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]->page);
> > +                             kunmap_local(segments);
> > +                     segments = kmap_local_page(pages[n/SEGS_PER_INDIRECT_FRAME]->page);
>
> Don't you need to also switch to kunmap_local() then instead of
> kunmap_atomic()?
 kmap_local() and  kunmap_local() are paired.
 I found that I missed a modification, I will re-issue patch v2
 Thanks.
>
> Thanks, Roger.
diff mbox series

Patch

diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 4defd7f387c7..cce534f43292 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -937,8 +937,8 @@  static int xen_blkbk_parse_indirect(struct blkif_request *req,
 		if ((n % SEGS_PER_INDIRECT_FRAME) == 0) {
 			/* Map indirect segments */
 			if (segments)
-				kunmap_atomic(segments);
-			segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]->page);
+				kunmap_local(segments);
+			segments = kmap_local_page(pages[n/SEGS_PER_INDIRECT_FRAME]->page);
 		}
 		i = n % SEGS_PER_INDIRECT_FRAME;