From: Mikulas Patocka <mpatocka@redhat.com> To: Jens Axboe <axboe@kernel.dk>, Zdenek Kabelac <zkabelac@redhat.com> Cc: linux-block@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 1/4] brd: make brd_insert_page return bool Date: Fri, 16 Sep 2022 04:59:19 -0400 (EDT) [thread overview] Message-ID: <alpine.LRH.2.02.2209160458590.543@file01.intranet.prod.int.rdu2.redhat.com> (raw) In-Reply-To: <alpine.LRH.2.02.2209151604410.13231@file01.intranet.prod.int.rdu2.redhat.com> brd_insert_page returns a pointer to struct page, however the pointer is never used (it is only compared against NULL), so to clean-up the code, we make it return bool. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> --- drivers/block/brd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) Index: linux-2.6/drivers/block/brd.c =================================================================== --- linux-2.6.orig/drivers/block/brd.c +++ linux-2.6/drivers/block/brd.c @@ -78,11 +78,11 @@ static struct page *brd_lookup_page(stru } /* - * Look up and return a brd's page for a given sector. - * If one does not exist, allocate an empty page, and insert that. Then - * return it. + * If the page exists, return true. + * If it does not exist, allocate an empty page, and insert that. Return true + * if the allocation was successful. */ -static struct page *brd_insert_page(struct brd_device *brd, sector_t sector) +static bool brd_insert_page(struct brd_device *brd, sector_t sector) { pgoff_t idx; struct page *page; @@ -90,7 +90,7 @@ static struct page *brd_insert_page(stru page = brd_lookup_page(brd, sector); if (page) - return page; + return true; /* * Must use NOIO because we don't want to recurse back into the @@ -99,11 +99,11 @@ static struct page *brd_insert_page(stru gfp_flags = GFP_NOIO | __GFP_ZERO | __GFP_HIGHMEM; page = alloc_page(gfp_flags); if (!page) - return NULL; + return false; if (radix_tree_preload(GFP_NOIO)) { __free_page(page); - return NULL; + return false; } spin_lock(&brd->brd_lock); @@ -121,7 +121,7 @@ static struct page *brd_insert_page(stru radix_tree_preload_end(); - return page; + return true; } /*
WARNING: multiple messages have this Message-ID (diff)
From: Mikulas Patocka <mpatocka@redhat.com> To: Jens Axboe <axboe@kernel.dk>, Zdenek Kabelac <zkabelac@redhat.com> Cc: linux-block@vger.kernel.org, dm-devel@redhat.com Subject: [dm-devel] [PATCH 1/4] brd: make brd_insert_page return bool Date: Fri, 16 Sep 2022 04:59:19 -0400 (EDT) [thread overview] Message-ID: <alpine.LRH.2.02.2209160458590.543@file01.intranet.prod.int.rdu2.redhat.com> (raw) In-Reply-To: <alpine.LRH.2.02.2209151604410.13231@file01.intranet.prod.int.rdu2.redhat.com> brd_insert_page returns a pointer to struct page, however the pointer is never used (it is only compared against NULL), so to clean-up the code, we make it return bool. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> --- drivers/block/brd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) Index: linux-2.6/drivers/block/brd.c =================================================================== --- linux-2.6.orig/drivers/block/brd.c +++ linux-2.6/drivers/block/brd.c @@ -78,11 +78,11 @@ static struct page *brd_lookup_page(stru } /* - * Look up and return a brd's page for a given sector. - * If one does not exist, allocate an empty page, and insert that. Then - * return it. + * If the page exists, return true. + * If it does not exist, allocate an empty page, and insert that. Return true + * if the allocation was successful. */ -static struct page *brd_insert_page(struct brd_device *brd, sector_t sector) +static bool brd_insert_page(struct brd_device *brd, sector_t sector) { pgoff_t idx; struct page *page; @@ -90,7 +90,7 @@ static struct page *brd_insert_page(stru page = brd_lookup_page(brd, sector); if (page) - return page; + return true; /* * Must use NOIO because we don't want to recurse back into the @@ -99,11 +99,11 @@ static struct page *brd_insert_page(stru gfp_flags = GFP_NOIO | __GFP_ZERO | __GFP_HIGHMEM; page = alloc_page(gfp_flags); if (!page) - return NULL; + return false; if (radix_tree_preload(GFP_NOIO)) { __free_page(page); - return NULL; + return false; } spin_lock(&brd->brd_lock); @@ -121,7 +121,7 @@ static struct page *brd_insert_page(stru radix_tree_preload_end(); - return page; + return true; } /* -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2022-09-16 8:59 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-16 8:58 [PATCH 0/4] brd: implement discard Mikulas Patocka 2022-09-16 8:58 ` [dm-devel] " Mikulas Patocka 2022-09-16 8:59 ` Mikulas Patocka [this message] 2022-09-16 8:59 ` [dm-devel] [PATCH 1/4] brd: make brd_insert_page return bool Mikulas Patocka 2022-09-20 7:28 ` Christoph Hellwig 2022-09-20 7:28 ` [dm-devel] " Christoph Hellwig 2022-09-16 8:59 ` [PATCH 2/4] brd: extend the rcu regions to cover read and write Mikulas Patocka 2022-09-16 8:59 ` [dm-devel] " Mikulas Patocka 2022-09-20 7:38 ` Christoph Hellwig 2022-09-20 7:38 ` [dm-devel] " Christoph Hellwig 2022-09-16 9:00 ` [dm-devel] [PATCH 3/4] brd: enable discard Mikulas Patocka 2022-09-16 9:00 ` Mikulas Patocka 2022-09-20 7:39 ` [dm-devel] " Christoph Hellwig 2022-09-20 7:39 ` Christoph Hellwig 2022-09-20 17:47 ` [dm-devel] " Mikulas Patocka 2022-09-20 17:47 ` Mikulas Patocka 2022-09-16 9:00 ` [dm-devel] [PATCH 4/4] brd: implement secure erase and write zeroes Mikulas Patocka 2022-09-16 9:00 ` Mikulas Patocka 2022-09-20 7:29 ` Christoph Hellwig 2022-09-20 7:29 ` [dm-devel] " Christoph Hellwig 2022-09-20 17:46 ` Mikulas Patocka 2022-09-20 17:46 ` Mikulas Patocka
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=alpine.LRH.2.02.2209160458590.543@file01.intranet.prod.int.rdu2.redhat.com \ --to=mpatocka@redhat.com \ --cc=axboe@kernel.dk \ --cc=dm-devel@redhat.com \ --cc=linux-block@vger.kernel.org \ --cc=zkabelac@redhat.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: linkBe 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.