Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drbd: Make use of PFN_UP helper macro

it's a refactor to make use of PFN_UP helper macro

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Reviewed-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Link: https://lore.kernel.org/r/20220406190715.1938174-5-christoph.boehmwalder@linbit.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Cai Huoqing and committed by
Jens Axboe
ba6bee98 e1838cf0

+4 -4
+1 -1
drivers/block/drbd/drbd_bitmap.c
··· 683 683 } 684 684 } 685 685 686 - want = ALIGN(words*sizeof(long), PAGE_SIZE) >> PAGE_SHIFT; 686 + want = PFN_UP(words*sizeof(long)); 687 687 have = b->bm_number_of_pages; 688 688 if (want == have) { 689 689 D_ASSERT(device, b->bm_pages != NULL);
+2 -2
drivers/block/drbd/drbd_receiver.c
··· 364 364 struct drbd_device *device = peer_device->device; 365 365 struct drbd_peer_request *peer_req; 366 366 struct page *page = NULL; 367 - unsigned nr_pages = (payload_size + PAGE_SIZE -1) >> PAGE_SHIFT; 367 + unsigned nr_pages = PFN_UP(payload_size); 368 368 369 369 if (drbd_insert_fault(device, DRBD_FAULT_AL_EE)) 370 370 return NULL; ··· 1630 1630 sector_t sector = peer_req->i.sector; 1631 1631 unsigned data_size = peer_req->i.size; 1632 1632 unsigned n_bios = 0; 1633 - unsigned nr_pages = (data_size + PAGE_SIZE -1) >> PAGE_SHIFT; 1633 + unsigned nr_pages = PFN_UP(data_size); 1634 1634 1635 1635 /* TRIM/DISCARD: for now, always use the helper function 1636 1636 * blkdev_issue_zeroout(..., discard=true).
+1 -1
drivers/block/drbd/drbd_worker.c
··· 1030 1030 { 1031 1031 if (drbd_peer_req_has_active_page(peer_req)) { 1032 1032 /* This might happen if sendpage() has not finished */ 1033 - int i = (peer_req->i.size + PAGE_SIZE -1) >> PAGE_SHIFT; 1033 + int i = PFN_UP(peer_req->i.size); 1034 1034 atomic_add(i, &device->pp_in_use_by_net); 1035 1035 atomic_sub(i, &device->pp_in_use); 1036 1036 spin_lock_irq(&device->resource->req_lock);