From patchwork Thu Jun 23 18:04:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 010E0C43334 for ; Thu, 23 Jun 2022 19:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbiFWTAf (ORCPT ); Thu, 23 Jun 2022 15:00:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbiFWTAE (ORCPT ); Thu, 23 Jun 2022 15:00:04 -0400 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F01EB85A1 for ; Thu, 23 Jun 2022 11:05:36 -0700 (PDT) Received: by mail-pf1-f177.google.com with SMTP id 65so281161pfw.11 for ; Thu, 23 Jun 2022 11:05:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yqARkEw9LIlffka8uPaHCa9c4W+z7XxI3qZTHzHSjwg=; b=KxB1NZkbNhuRj+/NJJR4B3p3pciNeRcd1GZaXXNUuJ85cXaMaug3k9J38W6rq/CDtO 8bMI68Qlu39tjcGYgrXuLshUm/IupakD10bRnvYeIYMJbG+LBK1SeJd2v6HzUN1Gw495 PMpKYvdJ5GIj2pbvzMxR+1nqe8ZY6C99zPAZ/S4R8yhHrfAafiIxezwPZ3CO9F6RtzVQ 27FYBM1OVFV+kMNQbqfTTR+wkSb47562Q9MGMvrkJ2nVyYU9EqyRI1Gf6C0VkKtyLCGA Zy2nQJAtiLXeYnT24XmCewbSoAfpgtVkU6IVkei7gaUlKb1nqdM6GvkrucgRGrb0jHv5 JKvQ== X-Gm-Message-State: AJIora/Gmax/lyLq77bZaehQTpoBZVcGoonxpt+Hz79Mw31EMJAdwix/ +1wrw3q4TC0sLvlcg/GMXT0= X-Google-Smtp-Source: AGRyM1tOf+OiA5GlCjxSHraw+EN3YQ7ZVefIbnr+/iRLrrPLsOszDJaJrsV8FuCeflFOzDoukTzXwg== X-Received: by 2002:a63:5b42:0:b0:408:8710:13b0 with SMTP id l2-20020a635b42000000b00408871013b0mr8528930pgm.584.1656007535695; Thu, 23 Jun 2022 11:05:35 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:34 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei Subject: [PATCH 01/51] treewide: Rename enum req_opf into enum req_op Date: Thu, 23 Jun 2022 11:04:38 -0700 Message-Id: <20220623180528.3595304-2-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The type name enum req_opf is misleading since it suggests that values of this type include both an operation type and flags. Since values of this type represent an operation only, change the type name into enum req_op. Convert the enum req_op documentation into kernel-doc format. Move a few definitions such that the enum req_op documentation occurs just above the enum req_op definition. The name "req_opf" was introduced by commit ef295ecf090d ("block: better op and flags encoding"). Cc: Christoph Hellwig Cc: Ming Lei Signed-off-by: Bart Van Assche --- block/blk-zoned.c | 7 +++---- drivers/block/null_blk/main.c | 9 ++++----- drivers/block/null_blk/null_blk.h | 12 +++++------- drivers/block/null_blk/trace.h | 2 +- drivers/block/null_blk/zoned.c | 4 ++-- drivers/md/dm-integrity.c | 2 +- drivers/nvme/target/zns.c | 4 ++-- drivers/scsi/sd_zbc.c | 2 +- drivers/ufs/core/ufshpb.c | 5 ++--- fs/zonefs/super.c | 5 ++--- fs/zonefs/trace.h | 2 +- include/linux/blk_types.h | 16 ++++++++-------- include/linux/blkdev.h | 2 +- 13 files changed, 33 insertions(+), 39 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 38cd840d8838..ac0b9dfd2321 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -257,9 +257,8 @@ static int blkdev_zone_reset_all(struct block_device *bdev, gfp_t gfp_mask) * The operation to execute on each zone can be a zone reset, open, close * or finish request. */ -int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op, - sector_t sector, sector_t nr_sectors, - gfp_t gfp_mask) +int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op, + sector_t sector, sector_t nr_sectors, gfp_t gfp_mask) { struct request_queue *q = bdev_get_queue(bdev); sector_t zone_sectors = blk_queue_zone_sectors(q); @@ -398,7 +397,7 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, void __user *argp = (void __user *)arg; struct request_queue *q; struct blk_zone_range zrange; - enum req_opf op; + enum req_op op; int ret; if (!argp) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 6b67088f4ea7..d5b0412830e0 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -1310,7 +1310,7 @@ static inline blk_status_t null_handle_badblocks(struct nullb_cmd *cmd, } static inline blk_status_t null_handle_memory_backed(struct nullb_cmd *cmd, - enum req_opf op, + enum req_op op, sector_t sector, sector_t nr_sectors) { @@ -1381,9 +1381,8 @@ static inline void nullb_complete_cmd(struct nullb_cmd *cmd) } } -blk_status_t null_process_cmd(struct nullb_cmd *cmd, - enum req_opf op, sector_t sector, - unsigned int nr_sectors) +blk_status_t null_process_cmd(struct nullb_cmd *cmd, enum req_op op, + sector_t sector, unsigned int nr_sectors) { struct nullb_device *dev = cmd->nq->dev; blk_status_t ret; @@ -1401,7 +1400,7 @@ blk_status_t null_process_cmd(struct nullb_cmd *cmd, } static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector, - sector_t nr_sectors, enum req_opf op) + sector_t nr_sectors, enum req_op op) { struct nullb_device *dev = cmd->nq->dev; struct nullb *nullb = dev->nullb; diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h index 8359b43842f2..6fbf0a1b2622 100644 --- a/drivers/block/null_blk/null_blk.h +++ b/drivers/block/null_blk/null_blk.h @@ -136,9 +136,8 @@ struct nullb { blk_status_t null_handle_discard(struct nullb_device *dev, sector_t sector, sector_t nr_sectors); -blk_status_t null_process_cmd(struct nullb_cmd *cmd, - enum req_opf op, sector_t sector, - unsigned int nr_sectors); +blk_status_t null_process_cmd(struct nullb_cmd *cmd, enum req_op op, + sector_t sector, unsigned int nr_sectors); #ifdef CONFIG_BLK_DEV_ZONED int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q); @@ -146,9 +145,8 @@ int null_register_zoned_dev(struct nullb *nullb); void null_free_zoned_dev(struct nullb_device *dev); int null_report_zones(struct gendisk *disk, sector_t sector, unsigned int nr_zones, report_zones_cb cb, void *data); -blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, - enum req_opf op, sector_t sector, - sector_t nr_sectors); +blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, enum req_op op, + sector_t sector, sector_t nr_sectors); size_t null_zone_valid_read_len(struct nullb *nullb, sector_t sector, unsigned int len); #else @@ -164,7 +162,7 @@ static inline int null_register_zoned_dev(struct nullb *nullb) } static inline void null_free_zoned_dev(struct nullb_device *dev) {} static inline blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, - enum req_opf op, sector_t sector, sector_t nr_sectors) + enum req_op op, sector_t sector, sector_t nr_sectors) { return BLK_STS_NOTSUPP; } diff --git a/drivers/block/null_blk/trace.h b/drivers/block/null_blk/trace.h index 86d6c12c603c..6b2b370e786f 100644 --- a/drivers/block/null_blk/trace.h +++ b/drivers/block/null_blk/trace.h @@ -36,7 +36,7 @@ TRACE_EVENT(nullb_zone_op, TP_ARGS(cmd, zone_no, zone_cond), TP_STRUCT__entry( __array(char, disk, DISK_NAME_LEN) - __field(enum req_opf, op) + __field(enum req_op, op) __field(unsigned int, zone_no) __field(unsigned int, zone_cond) ), diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c index 2fdd7b20c224..99f45bb85080 100644 --- a/drivers/block/null_blk/zoned.c +++ b/drivers/block/null_blk/zoned.c @@ -600,7 +600,7 @@ static blk_status_t null_reset_zone(struct nullb_device *dev, return BLK_STS_OK; } -static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, +static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_op op, sector_t sector) { struct nullb_device *dev = cmd->nq->dev; @@ -653,7 +653,7 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, return ret; } -blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, enum req_opf op, +blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, enum req_op op, sector_t sector, sector_t nr_sectors) { struct nullb_device *dev; diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index 3d5a0ce123c9..148978ad03a8 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -298,7 +298,7 @@ struct dm_integrity_io { struct work_struct work; struct dm_integrity_c *ic; - enum req_opf op; + enum req_op op; bool fua; struct dm_integrity_range range; diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c index 82b61acf7a72..62afb7936132 100644 --- a/drivers/nvme/target/zns.c +++ b/drivers/nvme/target/zns.c @@ -308,7 +308,7 @@ void nvmet_bdev_execute_zone_mgmt_recv(struct nvmet_req *req) queue_work(zbd_wq, &req->z.zmgmt_work); } -static inline enum req_opf zsa_req_op(u8 zsa) +static inline enum req_op zsa_req_op(u8 zsa) { switch (zsa) { case NVME_ZONE_OPEN: @@ -465,7 +465,7 @@ static void nvmet_bdev_zmgmt_send_work(struct work_struct *w) { struct nvmet_req *req = container_of(w, struct nvmet_req, z.zmgmt_work); sector_t sect = nvmet_lba_to_sect(req->ns, req->cmd->zms.slba); - enum req_opf op = zsa_req_op(req->cmd->zms.zsa); + enum req_op op = zsa_req_op(req->cmd->zms.zsa); struct block_device *bdev = req->ns->bdev; sector_t zone_sectors = bdev_zone_sectors(bdev); u16 status = NVME_SC_SUCCESS; diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 6acc4f406eb8..6d3658e36c84 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -529,7 +529,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd, struct request *rq = scsi_cmd_to_rq(cmd); struct scsi_disk *sdkp = scsi_disk(rq->q->disk); unsigned int zno = blk_rq_zone_no(rq); - enum req_opf op = req_op(rq); + enum req_op op = req_op(rq); unsigned long flags; /* diff --git a/drivers/ufs/core/ufshpb.c b/drivers/ufs/core/ufshpb.c index de2bb8401bc4..24f1ee82c215 100644 --- a/drivers/ufs/core/ufshpb.c +++ b/drivers/ufs/core/ufshpb.c @@ -433,9 +433,8 @@ int ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) return 0; } -static struct ufshpb_req *ufshpb_get_req(struct ufshpb_lu *hpb, - int rgn_idx, enum req_opf dir, - bool atomic) +static struct ufshpb_req *ufshpb_get_req(struct ufshpb_lu *hpb, int rgn_idx, + enum req_op dir, bool atomic) { struct ufshpb_req *rq; struct request *req; diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 053299758deb..59e77992443c 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -60,8 +60,7 @@ static void zonefs_account_active(struct inode *inode) } } -static inline int zonefs_zone_mgmt(struct inode *inode, - enum req_opf op) +static inline int zonefs_zone_mgmt(struct inode *inode, enum req_op op) { struct zonefs_inode_info *zi = ZONEFS_I(inode); int ret; @@ -525,7 +524,7 @@ static int zonefs_file_truncate(struct inode *inode, loff_t isize) { struct zonefs_inode_info *zi = ZONEFS_I(inode); loff_t old_isize; - enum req_opf op; + enum req_op op; int ret = 0; /* diff --git a/fs/zonefs/trace.h b/fs/zonefs/trace.h index f369d7d50303..21501da764bd 100644 --- a/fs/zonefs/trace.h +++ b/fs/zonefs/trace.h @@ -20,7 +20,7 @@ #define show_dev(dev) MAJOR(dev), MINOR(dev) TRACE_EVENT(zonefs_zone_mgmt, - TP_PROTO(struct inode *inode, enum req_opf op), + TP_PROTO(struct inode *inode, enum req_op op), TP_ARGS(inode, op), TP_STRUCT__entry( __field(dev_t, dev) diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index a24d4078fb21..0e6a2af7ed3d 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -337,8 +337,12 @@ enum { typedef __u32 __bitwise blk_mq_req_flags_t; -/* - * Operations and flags common to the bio and request structures. +#define REQ_OP_BITS 8 +#define REQ_OP_MASK ((1 << REQ_OP_BITS) - 1) +#define REQ_FLAG_BITS 24 + +/** + * enum req_op - Operations common to the bio and request structures. * We use 8 bits for encoding the operation, and the remaining 24 for flags. * * The least significant bit of the operation number indicates the data @@ -350,11 +354,7 @@ typedef __u32 __bitwise blk_mq_req_flags_t; * If a operation does not transfer data the least significant bit has no * meaning. */ -#define REQ_OP_BITS 8 -#define REQ_OP_MASK ((1 << REQ_OP_BITS) - 1) -#define REQ_FLAG_BITS 24 - -enum req_opf { +enum req_op { /* read sectors from the device */ REQ_OP_READ = 0, /* write sectors to the device */ @@ -509,7 +509,7 @@ static inline bool op_is_discard(unsigned int op) * due to its different handling in the block layer and device response in * case of command failure. */ -static inline bool op_is_zone_mgmt(enum req_opf op) +static inline bool op_is_zone_mgmt(enum req_op op) { switch (op & REQ_OP_MASK) { case REQ_OP_ZONE_RESET: diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 92b3bffad328..94ceed805e76 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -292,7 +292,7 @@ void blk_queue_set_zoned(struct gendisk *disk, enum blk_zoned_model model); int blkdev_report_zones(struct block_device *bdev, sector_t sector, unsigned int nr_zones, report_zones_cb cb, void *data); unsigned int blkdev_nr_zones(struct gendisk *disk); -extern int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op, +extern int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op, sector_t sectors, sector_t nr_sectors, gfp_t gfp_mask); int blk_revalidate_disk_zones(struct gendisk *disk, From patchwork Thu Jun 23 18:04:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893046 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A00DDC433EF for ; Thu, 23 Jun 2022 19:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbiFWTAh (ORCPT ); Thu, 23 Jun 2022 15:00:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230235AbiFWTAH (ORCPT ); Thu, 23 Jun 2022 15:00:07 -0400 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0CCBB85A5 for ; Thu, 23 Jun 2022 11:05:37 -0700 (PDT) Received: by mail-pj1-f49.google.com with SMTP id w19-20020a17090a8a1300b001ec79064d8dso3381546pjn.2 for ; Thu, 23 Jun 2022 11:05:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QHWu52XVuAXLu6chRMhy7VHcbAW75xRVM1TfZ9/AmXE=; b=LrElEyF1lbaUu0br/YgfkSpEBsX925fM/1ScQsMfuwn0VvDRyorAbQvr/8GFcUDRjY P+S/i43HPS5XUezU2fSDCeo9EP/0dbDc6sp6DD+Fxqvf90zNBM1rdo2Sty9PzOFpDyi9 zxZzfy6IIkEU5n6W6q4Dyq/+ndLRcRARyBVllYB9MsJ1Zrfua/OReneu0SvhxDwwNYQh dbCu7zRJ67kJp9DtmVVF9+t50x0xPTNWPmlbYD4GUVrMxMbBSYZA9AwgGZB/e1IiMcDp uD0ymm9KE+pycjV1iYmHgbik3wNDNCOJAQ/WBP3fdiquYsNFV53Y8R3JFqXYfU7kesh7 PyBQ== X-Gm-Message-State: AJIora8+E57dUrnzU1DR/FaZP8Bp3iDLnNKlRsRDAjFNgUBynS1+RNks kJ+2pRA0Gyf4Tkw9MlaYFx4= X-Google-Smtp-Source: AGRyM1ulqVjbkg2BvkhJvPLdhzIklBQJZLzEmUyQqefHu3+A0QgU5tyhPEeU21uyzZTkixzIWMgtkw== X-Received: by 2002:a17:90a:1485:b0:1ec:788e:a053 with SMTP id k5-20020a17090a148500b001ec788ea053mr5261841pja.16.1656007537193; Thu, 23 Jun 2022 11:05:37 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:36 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei Subject: [PATCH 02/51] block: Use enum req_op where appropriate Date: Thu, 23 Jun 2022 11:04:39 -0700 Message-Id: <20220623180528.3595304-3-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Change the type of the arguments that are used to pass a REQ_OP_* value from int or unsigned int into enum req_op to improve static type checking. Note: the type of the blk_mq_alloc_request() 'op' argument is not modified by this patch since at least once caller passes an operation and flags in this argument. Cc: Christoph Hellwig Cc: Ming Lei Signed-off-by: Bart Van Assche --- block/blk-core.c | 6 +++--- block/blk-mq-debugfs.c | 2 +- block/blk-mq.c | 2 +- block/blk-wbt.c | 2 +- block/blk.h | 2 +- include/linux/blk-mq.h | 2 +- include/linux/blk_types.h | 2 +- include/linux/blkdev.h | 6 +++--- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index eb86c756a7fd..9d420dff90f6 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -136,7 +136,7 @@ static const char *const blk_op_name[] = { * string format. Useful in the debugging and tracing bio or request. For * invalid REQ_OP_XXX it returns string "UNKNOWN". */ -inline const char *blk_op_str(unsigned int op) +inline const char *blk_op_str(enum req_op op) { const char *op_str = "UNKNOWN"; @@ -1010,7 +1010,7 @@ void update_io_ticks(struct block_device *part, unsigned long now, bool end) } unsigned long bdev_start_io_acct(struct block_device *bdev, - unsigned int sectors, unsigned int op, + unsigned int sectors, enum req_op op, unsigned long start_time) { const int sgrp = op_stat_group(op); @@ -1051,7 +1051,7 @@ unsigned long bio_start_io_acct(struct bio *bio) } EXPORT_SYMBOL_GPL(bio_start_io_acct); -void bdev_end_io_acct(struct block_device *bdev, unsigned int op, +void bdev_end_io_acct(struct block_device *bdev, enum req_op op, unsigned long start_time) { const int sgrp = op_stat_group(op); diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 7e4136a60e1c..df0b9a458f34 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -306,7 +306,7 @@ static const char *blk_mq_rq_state_name(enum mq_rq_state rq_state) int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq) { const struct blk_mq_ops *const mq_ops = rq->q->mq_ops; - const unsigned int op = req_op(rq); + const enum req_op op = req_op(rq); const char *op_str = blk_op_str(op); seq_printf(m, "%p {.op=", rq); diff --git a/block/blk-mq.c b/block/blk-mq.c index f5cce377f1a8..50fc1194ebc0 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -538,7 +538,7 @@ struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op, EXPORT_SYMBOL(blk_mq_alloc_request); struct request *blk_mq_alloc_request_hctx(struct request_queue *q, - unsigned int op, blk_mq_req_flags_t flags, unsigned int hctx_idx) + enum req_op op, blk_mq_req_flags_t flags, unsigned int hctx_idx) { struct blk_mq_alloc_data data = { .q = q, diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 0c119be0e813..7bf09ae06577 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -670,7 +670,7 @@ u64 wbt_default_latency_nsec(struct request_queue *q) static int wbt_data_dir(const struct request *rq) { - const int op = req_op(rq); + const enum req_op op = req_op(rq); if (op == REQ_OP_READ) return READ; diff --git a/block/blk.h b/block/blk.h index 8e79296ee97a..13b43fb28b9f 100644 --- a/block/blk.h +++ b/block/blk.h @@ -160,7 +160,7 @@ static inline bool blk_discard_mergable(struct request *req) } static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, - int op) + enum req_op op) { if (unlikely(op == REQ_OP_DISCARD || op == REQ_OP_SECURE_ERASE)) return min(q->limits.max_discard_sectors, diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index e2d9daf7e8dd..45d69cc46dc7 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -713,7 +713,7 @@ enum { struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op, blk_mq_req_flags_t flags); struct request *blk_mq_alloc_request_hctx(struct request_queue *q, - unsigned int op, blk_mq_req_flags_t flags, + enum req_op op, blk_mq_req_flags_t flags, unsigned int hctx_idx); /* diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 0e6a2af7ed3d..cce8768bc00b 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -522,7 +522,7 @@ static inline bool op_is_zone_mgmt(enum req_op op) } } -static inline int op_stat_group(unsigned int op) +static inline int op_stat_group(enum req_op op) { if (op_is_discard(op)) return STAT_DISCARD; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 94ceed805e76..3f8ee0608d60 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -886,7 +886,7 @@ extern void blk_queue_exit(struct request_queue *q); extern void blk_sync_queue(struct request_queue *q); /* Helper to convert REQ_OP_XXX to its string format XXX */ -extern const char *blk_op_str(unsigned int op); +extern const char *blk_op_str(enum req_op op); int blk_status_to_errno(blk_status_t status); blk_status_t errno_to_blk_status(int errno); @@ -1472,9 +1472,9 @@ static inline void blk_wake_io_task(struct task_struct *waiter) } unsigned long bdev_start_io_acct(struct block_device *bdev, - unsigned int sectors, unsigned int op, + unsigned int sectors, enum req_op op, unsigned long start_time); -void bdev_end_io_acct(struct block_device *bdev, unsigned int op, +void bdev_end_io_acct(struct block_device *bdev, enum req_op op, unsigned long start_time); void bio_start_io_acct_time(struct bio *bio, unsigned long start_time); From patchwork Thu Jun 23 18:04:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50579CCA480 for ; Thu, 23 Jun 2022 19:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230157AbiFWTAj (ORCPT ); Thu, 23 Jun 2022 15:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230170AbiFWTAF (ORCPT ); Thu, 23 Jun 2022 15:00:05 -0400 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B70D6B85AE for ; Thu, 23 Jun 2022 11:05:39 -0700 (PDT) Received: by mail-pf1-f170.google.com with SMTP id p14so305261pfh.6 for ; Thu, 23 Jun 2022 11:05:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ej0cRhNsqJVFJXnmr+lazOG+2qvmjZlrhkoNKwPcCRY=; b=g2NpiKX8vxFyPry9wU+7vYamnzQrAHQNMbhgRxzaTQpXKS1qnCVLVEQ0s1IBF4gwKV ag2qK2xKtuGHEmGIE1MlDvMRy7mHRxgHdtLjGGfM0lhb1T+eRvNIM8T0efYrtHpl98ne BzAd3GAA5fdGV99kYr5AYGzibDhg3TXEAU3bPaenxADhzgtQNdJsFDoOl6S28Ce3tI75 phkkXg3lZ+gSmrdp1kdydsowmuw4pHOTPlB3w9bQUJgWAnxugBfdpdxjM5fqz9DJTCUJ mGuE44ui0aOI+FLQjG7kmTa2Oo9Zmz1OUs9Q+UQNPtt50k0bbUzh46caXlBmR3ECM9cB +DWQ== X-Gm-Message-State: AJIora8mUvuq41CoayjmWqGCAMGVwT+QNqjC4kaJEA+JJuI8aSZDSjoP dm8EK3XQ6gS59qzTK3+aUy0= X-Google-Smtp-Source: AGRyM1uUsOy/UYan1g8pOTD2uuPgkC/e6R/yWLmECNTg/DKwfhI11Mu+x3dSgn62bb8HbrP9kQ13Vg== X-Received: by 2002:a63:4b20:0:b0:401:ae11:2593 with SMTP id y32-20020a634b20000000b00401ae112593mr8363995pga.375.1656007538825; Thu, 23 Jun 2022 11:05:38 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:38 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Tejun Heo , Minchan Kim , Dan Williams Subject: [PATCH 03/51] block: Change the type of the last .rw_page() argument Date: Thu, 23 Jun 2022 11:04:40 -0700 Message-Id: <20220623180528.3595304-4-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org All .rw_page() callers pass an enum req_op value as last argument. Make this explicit by changing the type of the last argument into enum req_op. See also commit 3f289dcb4b26 ("block: make bdev_ops->rw_page() take a REQ_OP instead of bool"). Cc: Tejun Heo Cc: Minchan Kim Cc: Dan Williams Signed-off-by: Bart Van Assche --- drivers/block/brd.c | 2 +- drivers/block/zram/zram_drv.c | 2 +- drivers/nvdimm/btt.c | 2 +- drivers/nvdimm/pmem.c | 2 +- include/linux/blkdev.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/block/brd.c b/drivers/block/brd.c index 6e3f2f0d2352..c3d772bdd89f 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c @@ -310,7 +310,7 @@ static void brd_submit_bio(struct bio *bio) } static int brd_rw_page(struct block_device *bdev, sector_t sector, - struct page *page, unsigned int op) + struct page *page, enum req_op op) { struct brd_device *brd = bdev->bd_disk->private_data; int err; diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index b8549c61ff2c..481b06a50ab1 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1631,7 +1631,7 @@ static void zram_slot_free_notify(struct block_device *bdev, } static int zram_rw_page(struct block_device *bdev, sector_t sector, - struct page *page, unsigned int op) + struct page *page, enum req_op op) { int offset, ret; u32 index; diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 9613e54c7a67..143b98e39c38 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -1483,7 +1483,7 @@ static void btt_submit_bio(struct bio *bio) } static int btt_rw_page(struct block_device *bdev, sector_t sector, - struct page *page, unsigned int op) + struct page *page, enum req_op op) { struct btt *btt = bdev->bd_disk->private_data; int rc; diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 629d10fcf53b..ed58cbe9550f 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -239,7 +239,7 @@ static void pmem_submit_bio(struct bio *bio) } static int pmem_rw_page(struct block_device *bdev, sector_t sector, - struct page *page, unsigned int op) + struct page *page, enum req_op op) { struct pmem_device *pmem = bdev->bd_disk->private_data; blk_status_t rc; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 3f8ee0608d60..de47b0e0e18f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1419,7 +1419,7 @@ struct block_device_operations { unsigned int flags); int (*open) (struct block_device *, fmode_t); void (*release) (struct gendisk *, fmode_t); - int (*rw_page)(struct block_device *, sector_t, struct page *, unsigned int); + int (*rw_page)(struct block_device *, sector_t, struct page *, enum req_op); int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); unsigned int (*check_events) (struct gendisk *disk, From patchwork Thu Jun 23 18:04:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41482CCA47C for ; Thu, 23 Jun 2022 19:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230208AbiFWTAj (ORCPT ); Thu, 23 Jun 2022 15:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230181AbiFWTAG (ORCPT ); Thu, 23 Jun 2022 15:00:06 -0400 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C79D1B85B7 for ; Thu, 23 Jun 2022 11:05:40 -0700 (PDT) Received: by mail-pg1-f173.google.com with SMTP id q140so164215pgq.6 for ; Thu, 23 Jun 2022 11:05:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iW10J4r9MKGhlA5RnPdc1iFrQ28tpX2vruzg3An4r7o=; b=dKk2c+nLIvqlcPyPdtA822/4I6ZOZi+c5Pj8yFF6e9k6fsxnVa/P6odMYzc2t/tlEd wDARO/qfpnjQxVrLgdTe1o/TfWaQ4nl8Bo1nI6oXlzD1ydhJR3lAI/HVAaHllGH45ZDW AZciC9GX2n+/1TxdA6IHHaht/T/QeSP+6zVMVGAAs9ZA891pj7USmhhv8Pnec0KuXhCe 2f7JVnVk1CDBI6Clr4ApUt1SaSdCJ+nk85IHrhydqvODavXL+VmJGTr/Iv3X9jJQwnZQ nVBNaMoqWugHSFSBMEdX2RxBTDfaifRO4D5U3KnRWaywOR6X5usxN48BTQ/TTXVv0Unk 791A== X-Gm-Message-State: AJIora/fPd2LY3MN9Wa2odPEmPyjR1KGot7lm3RfM6GK30C0TTCVy1Ye tfee0+TK5gzMssvNgu7y9lM= X-Google-Smtp-Source: AGRyM1vg01Z+OcrDxoBcBNy2EQm4TDGdbaxlO32jzW61PWfBbYJ8bsy92T9PRscBaRFvXw5qwEvYcg== X-Received: by 2002:a63:3851:0:b0:40d:622:1b7b with SMTP id h17-20020a633851000000b0040d06221b7bmr8613137pgn.431.1656007540158; Thu, 23 Jun 2022 11:05:40 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:39 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei Subject: [PATCH 04/51] block: Change the type of req_op() and bio_op() into enum req_op Date: Thu, 23 Jun 2022 11:04:41 -0700 Message-Id: <20220623180528.3595304-5-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by changing the type of the value returned by req_op() and bio_op() from unsigned int into enum req_op. Insert 'default: break;' in switch statements on the enum req_op type to prevent that the compiler warns about these switch statements. Cc: Christoph Hellwig Cc: Ming Lei Signed-off-by: Bart Van Assche --- block/blk-merge.c | 2 ++ drivers/block/paride/pd.c | 2 ++ drivers/md/dm.c | 2 ++ include/linux/blk-mq.h | 6 ++++-- include/linux/blk_types.h | 6 ++++-- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 0f5f42ebd0bb..9d96c9239219 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -405,6 +405,8 @@ unsigned int blk_recalc_rq_segments(struct request *rq) return 1; case REQ_OP_WRITE_ZEROES: return 0; + default: + break; } rq_for_each_bvec(bv, rq, iter) diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 3637c38c72f9..a186f5bf235e 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -501,6 +501,8 @@ static enum action do_pd_io_start(void) return do_pd_read_start(); else return do_pd_write_start(); + default: + break; } return Fail; } diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 789f48e1a0e5..bed7ad573f79 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1539,6 +1539,8 @@ static blk_status_t __process_abnormal_io(struct clone_info *ci, case REQ_OP_WRITE_ZEROES: num_bios = ti->num_write_zeroes_bios; break; + default: + break; } /* diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 45d69cc46dc7..9a1838bbed02 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -197,8 +197,10 @@ struct request { void *end_io_data; }; -#define req_op(req) \ - ((req)->cmd_flags & REQ_OP_MASK) +static inline enum req_op req_op(const struct request *req) +{ + return req->cmd_flags & REQ_OP_MASK; +} static inline bool blk_rq_is_passthrough(struct request *rq) { diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index cce8768bc00b..e66cbe377ae8 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -463,8 +463,10 @@ enum stat_group { NR_STAT_GROUPS }; -#define bio_op(bio) \ - ((bio)->bi_opf & REQ_OP_MASK) +static inline enum req_op bio_op(const struct bio *bio) +{ + return bio->bi_opf & REQ_OP_MASK; +} /* obsolete, don't use in new code */ static inline void bio_set_op_attrs(struct bio *bio, unsigned op, From patchwork Thu Jun 23 18:04:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C190C43334 for ; Thu, 23 Jun 2022 19:00:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230433AbiFWTAn (ORCPT ); Thu, 23 Jun 2022 15:00:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230340AbiFWTAI (ORCPT ); Thu, 23 Jun 2022 15:00:08 -0400 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6733BB8AA0 for ; Thu, 23 Jun 2022 11:05:42 -0700 (PDT) Received: by mail-pj1-f50.google.com with SMTP id go6so388777pjb.0 for ; Thu, 23 Jun 2022 11:05:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G0k5s1OB0jWMepPDTZgjEAlQ+/wiw3ndQL4bovoi1TQ=; b=dcAs7GIIDmqaxTowQGZW0WuO7hxf+FoKK/xoz0HIkzFSUZjBBEK7UU8g+gOz1Hw/MJ Q1DmaX9xQnU0aeK/pLuljVmY9rC0VtB6STwxh2HC8S5Wt3YDR/7UVQLQaOC0ID3CWt95 IICcIEvBNsCo5veVYjb5xDECsNw3amMx4Gfh8qDLXaHvFHtWwTDgUA10qwK/uhdma8iD YsJ3Xo6AlP8raxfUny8WON0gOLxUbwM5eK8mbexuIVZWk67SnyJ2O9FsJ3MVTVl9wnlB wSkEbTCc3DYSx8H2XkXRhXpTEgo93UdmQGaACQkM2+D7xhUXTE68oQ1oWk3dCP3EKhy3 i8vw== X-Gm-Message-State: AJIora+jKSkcf3hkfKHovT7aGdz5GMbAhcqTgtYfo66C0iRd6R0iqFo4 27beBQfTRsZOWvrclnIqcy2w+OHkOVE= X-Google-Smtp-Source: AGRyM1vbkrt70BSEkLMRcFAGfmMp6uZhpltyegz4f6HdUZtA6kXkGZ9444JVTiSbzaM2TBtbXr9Biw== X-Received: by 2002:a17:902:8d98:b0:168:a310:3ea6 with SMTP id v24-20020a1709028d9800b00168a3103ea6mr39799716plo.9.1656007541636; Thu, 23 Jun 2022 11:05:41 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:40 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei Subject: [PATCH 05/51] block: Introduce the type blk_opf_t Date: Thu, 23 Jun 2022 11:04:42 -0700 Message-Id: <20220623180528.3595304-6-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Introduce the type blk_opf_t for the request operation and flags (REQ_OP_* and REQ_*). This type will be used to improve documentation of the block layer code and also to allow sparse to verify whether request flags are used correctly. Cc: Christoph Hellwig Cc: Ming Lei Signed-off-by: Bart Van Assche --- include/linux/blk_types.h | 97 ++++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index e66cbe377ae8..1ef99790f6ed 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -240,6 +240,8 @@ static inline void bio_issue_init(struct bio_issue *issue, ((u64)size << BIO_ISSUE_SIZE_SHIFT)); } +typedef __u32 __bitwise blk_opf_t; + typedef unsigned int blk_qc_t; #define BLK_QC_T_NONE -1U @@ -250,7 +252,7 @@ typedef unsigned int blk_qc_t; struct bio { struct bio *bi_next; /* request queue link */ struct block_device *bi_bdev; - unsigned int bi_opf; /* bottom bits REQ_OP, top bits + blk_opf_t bi_opf; /* bottom bits REQ_OP, top bits * req_flags. */ unsigned short bi_flags; /* BIO_* below */ @@ -338,7 +340,7 @@ enum { typedef __u32 __bitwise blk_mq_req_flags_t; #define REQ_OP_BITS 8 -#define REQ_OP_MASK ((1 << REQ_OP_BITS) - 1) +#define REQ_OP_MASK (__force blk_opf_t)((1 << REQ_OP_BITS) - 1) #define REQ_FLAG_BITS 24 /** @@ -356,35 +358,35 @@ typedef __u32 __bitwise blk_mq_req_flags_t; */ enum req_op { /* read sectors from the device */ - REQ_OP_READ = 0, + REQ_OP_READ = (__force blk_opf_t)0, /* write sectors to the device */ - REQ_OP_WRITE = 1, + REQ_OP_WRITE = (__force blk_opf_t)1, /* flush the volatile write cache */ - REQ_OP_FLUSH = 2, + REQ_OP_FLUSH = (__force blk_opf_t)2, /* discard sectors */ - REQ_OP_DISCARD = 3, + REQ_OP_DISCARD = (__force blk_opf_t)3, /* securely erase sectors */ - REQ_OP_SECURE_ERASE = 5, + REQ_OP_SECURE_ERASE = (__force blk_opf_t)5, /* write the zero filled sector many times */ - REQ_OP_WRITE_ZEROES = 9, + REQ_OP_WRITE_ZEROES = (__force blk_opf_t)9, /* Open a zone */ - REQ_OP_ZONE_OPEN = 10, + REQ_OP_ZONE_OPEN = (__force blk_opf_t)10, /* Close a zone */ - REQ_OP_ZONE_CLOSE = 11, + REQ_OP_ZONE_CLOSE = (__force blk_opf_t)11, /* Transition a zone to full */ - REQ_OP_ZONE_FINISH = 12, + REQ_OP_ZONE_FINISH = (__force blk_opf_t)12, /* write data at the current zone write pointer */ - REQ_OP_ZONE_APPEND = 13, + REQ_OP_ZONE_APPEND = (__force blk_opf_t)13, /* reset a zone write pointer */ - REQ_OP_ZONE_RESET = 15, + REQ_OP_ZONE_RESET = (__force blk_opf_t)15, /* reset all the zone present on the device */ - REQ_OP_ZONE_RESET_ALL = 17, + REQ_OP_ZONE_RESET_ALL = (__force blk_opf_t)17, /* Driver private requests */ - REQ_OP_DRV_IN = 34, - REQ_OP_DRV_OUT = 35, + REQ_OP_DRV_IN = (__force blk_opf_t)34, + REQ_OP_DRV_OUT = (__force blk_opf_t)35, - REQ_OP_LAST, + REQ_OP_LAST = (__force blk_opf_t)36, }; enum req_flag_bits { @@ -425,28 +427,31 @@ enum req_flag_bits { __REQ_NR_BITS, /* stops here */ }; -#define REQ_FAILFAST_DEV (1ULL << __REQ_FAILFAST_DEV) -#define REQ_FAILFAST_TRANSPORT (1ULL << __REQ_FAILFAST_TRANSPORT) -#define REQ_FAILFAST_DRIVER (1ULL << __REQ_FAILFAST_DRIVER) -#define REQ_SYNC (1ULL << __REQ_SYNC) -#define REQ_META (1ULL << __REQ_META) -#define REQ_PRIO (1ULL << __REQ_PRIO) -#define REQ_NOMERGE (1ULL << __REQ_NOMERGE) -#define REQ_IDLE (1ULL << __REQ_IDLE) -#define REQ_INTEGRITY (1ULL << __REQ_INTEGRITY) -#define REQ_FUA (1ULL << __REQ_FUA) -#define REQ_PREFLUSH (1ULL << __REQ_PREFLUSH) -#define REQ_RAHEAD (1ULL << __REQ_RAHEAD) -#define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) -#define REQ_NOWAIT (1ULL << __REQ_NOWAIT) -#define REQ_CGROUP_PUNT (1ULL << __REQ_CGROUP_PUNT) - -#define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) -#define REQ_POLLED (1ULL << __REQ_POLLED) -#define REQ_ALLOC_CACHE (1ULL << __REQ_ALLOC_CACHE) - -#define REQ_DRV (1ULL << __REQ_DRV) -#define REQ_SWAP (1ULL << __REQ_SWAP) +#define REQ_FAILFAST_DEV \ + (__force blk_opf_t)(1ULL << __REQ_FAILFAST_DEV) +#define REQ_FAILFAST_TRANSPORT \ + (__force blk_opf_t)(1ULL << __REQ_FAILFAST_TRANSPORT) +#define REQ_FAILFAST_DRIVER \ + (__force blk_opf_t)(1ULL << __REQ_FAILFAST_DRIVER) +#define REQ_SYNC (__force blk_opf_t)(1ULL << __REQ_SYNC) +#define REQ_META (__force blk_opf_t)(1ULL << __REQ_META) +#define REQ_PRIO (__force blk_opf_t)(1ULL << __REQ_PRIO) +#define REQ_NOMERGE (__force blk_opf_t)(1ULL << __REQ_NOMERGE) +#define REQ_IDLE (__force blk_opf_t)(1ULL << __REQ_IDLE) +#define REQ_INTEGRITY (__force blk_opf_t)(1ULL << __REQ_INTEGRITY) +#define REQ_FUA (__force blk_opf_t)(1ULL << __REQ_FUA) +#define REQ_PREFLUSH (__force blk_opf_t)(1ULL << __REQ_PREFLUSH) +#define REQ_RAHEAD (__force blk_opf_t)(1ULL << __REQ_RAHEAD) +#define REQ_BACKGROUND (__force blk_opf_t)(1ULL << __REQ_BACKGROUND) +#define REQ_NOWAIT (__force blk_opf_t)(1ULL << __REQ_NOWAIT) +#define REQ_CGROUP_PUNT (__force blk_opf_t)(1ULL << __REQ_CGROUP_PUNT) + +#define REQ_NOUNMAP (__force blk_opf_t)(1ULL << __REQ_NOUNMAP) +#define REQ_POLLED (__force blk_opf_t)(1ULL << __REQ_POLLED) +#define REQ_ALLOC_CACHE (__force blk_opf_t)(1ULL << __REQ_ALLOC_CACHE) + +#define REQ_DRV (__force blk_opf_t)(1ULL << __REQ_DRV) +#define REQ_SWAP (__force blk_opf_t)(1ULL << __REQ_SWAP) #define REQ_FAILFAST_MASK \ (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) @@ -469,22 +474,22 @@ static inline enum req_op bio_op(const struct bio *bio) } /* obsolete, don't use in new code */ -static inline void bio_set_op_attrs(struct bio *bio, unsigned op, - unsigned op_flags) +static inline void bio_set_op_attrs(struct bio *bio, enum req_op op, + blk_opf_t op_flags) { bio->bi_opf = op | op_flags; } -static inline bool op_is_write(unsigned int op) +static inline bool op_is_write(blk_opf_t op) { - return (op & 1); + return !!(op & (__force blk_opf_t)1); } /* * Check if the bio or request is one that needs special treatment in the * flush state machine. */ -static inline bool op_is_flush(unsigned int op) +static inline bool op_is_flush(blk_opf_t op) { return op & (REQ_FUA | REQ_PREFLUSH); } @@ -494,13 +499,13 @@ static inline bool op_is_flush(unsigned int op) * PREFLUSH flag. Other operations may be marked as synchronous using the * REQ_SYNC flag. */ -static inline bool op_is_sync(unsigned int op) +static inline bool op_is_sync(blk_opf_t op) { return (op & REQ_OP_MASK) == REQ_OP_READ || (op & (REQ_SYNC | REQ_FUA | REQ_PREFLUSH)); } -static inline bool op_is_discard(unsigned int op) +static inline bool op_is_discard(blk_opf_t op) { return (op & REQ_OP_MASK) == REQ_OP_DISCARD; } From patchwork Thu Jun 23 18:04:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB234C433EF for ; Thu, 23 Jun 2022 19:00:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230443AbiFWTAp (ORCPT ); Thu, 23 Jun 2022 15:00:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231315AbiFWTAR (ORCPT ); Thu, 23 Jun 2022 15:00:17 -0400 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C619FB8F81 for ; Thu, 23 Jun 2022 11:05:43 -0700 (PDT) Received: by mail-pg1-f173.google.com with SMTP id 184so135816pga.12 for ; Thu, 23 Jun 2022 11:05:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=15ZE93zixLMD1noiBiQWX0qOw0r4Zq62PS4ZUPNXYhk=; b=PNriHCshPU6olkhkx4sIGQsNJPDucxZ4TW6xS0NKWLK1GtSzNO9kgNbP9mIRJvzGG/ rmJQkvXLVXp/fIDYSzRMx/K9Ac5m2kD9Wm1u+BsU3khBB4KQCZ4bdQWxT/m/JlRNqnYv QsP6/uV+b90/c/qiGm0F2XKfSeNWma7zBH8tJALK9B3PXaWmRAmKAfWvFtqLiSIwqie1 D4XcmdftxUsNeyGHLF+rKS+a+2BNq4hvncCEYmrnEKJhyhaL2rjUJvDY8OgkBq2LxbTr XFHq/f0/0ALMxFhyiYMWWI8iySEHO0mS96NcOdxOvFDKdt38Wige2wx17Lizaploc1oy zSrg== X-Gm-Message-State: AJIora/vefhgawHFdZxs7sN3aAAtBMPe5kI4cUp80Dzuf+0G5hY91C9W h0s2RCe2RWBCQ8EwR69DGEc= X-Google-Smtp-Source: AGRyM1sVP/1wslUjm6J+7ewCS1qbbRsLACNB567Xx1i2zp6IffCaV9PPzIQwp0n0+P/bN/MGbxP1Zg== X-Received: by 2002:a05:6a00:190e:b0:4f7:8813:b2cb with SMTP id y14-20020a056a00190e00b004f78813b2cbmr41969520pfi.54.1656007543069; Thu, 23 Jun 2022 11:05:43 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:42 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei Subject: [PATCH 06/51] block: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:04:43 -0700 Message-Id: <20220623180528.3595304-7-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Use the new blk_opf_t type for arguments and variables that represent request flags or a bitwise combination of a request operation and request flags. Rename the function arguments and also a structure member that hold a request operation and flags from 'rw' into 'opf'. This patch does not change any functionality. Cc: Christoph Hellwig Cc: Ming Lei Signed-off-by: Bart Van Assche --- block/bfq-cgroup.c | 16 ++++++++-------- block/bfq-iosched.c | 8 ++++---- block/bfq-iosched.h | 8 ++++---- block/bio.c | 10 +++++----- block/blk-cgroup-rwstat.h | 2 +- block/blk-core.c | 2 +- block/blk-flush.c | 6 +++--- block/blk-merge.c | 6 +++--- block/blk-mq-debugfs.c | 4 ++-- block/blk-mq.c | 11 ++++++----- block/blk-mq.h | 6 +++--- block/blk-wbt.c | 16 ++++++++-------- block/elevator.h | 2 +- block/fops.c | 8 ++++---- block/kyber-iosched.c | 6 +++--- block/mq-deadline.c | 2 +- include/linux/bio.h | 10 +++++----- include/linux/blk-mq.h | 4 ++-- include/linux/blkdev.h | 5 +++-- 19 files changed, 67 insertions(+), 65 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index 9fc605791b1e..af79028627a5 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -220,7 +220,7 @@ void bfqg_stats_update_avg_queue_size(struct bfq_group *bfqg) } void bfqg_stats_update_io_add(struct bfq_group *bfqg, struct bfq_queue *bfqq, - unsigned int op) + blk_opf_t op) { blkg_rwstat_add(&bfqg->stats.queued, op, 1); bfqg_stats_end_empty_time(&bfqg->stats); @@ -228,18 +228,18 @@ void bfqg_stats_update_io_add(struct bfq_group *bfqg, struct bfq_queue *bfqq, bfqg_stats_set_start_group_wait_time(bfqg, bfqq_group(bfqq)); } -void bfqg_stats_update_io_remove(struct bfq_group *bfqg, unsigned int op) +void bfqg_stats_update_io_remove(struct bfq_group *bfqg, blk_opf_t op) { blkg_rwstat_add(&bfqg->stats.queued, op, -1); } -void bfqg_stats_update_io_merged(struct bfq_group *bfqg, unsigned int op) +void bfqg_stats_update_io_merged(struct bfq_group *bfqg, blk_opf_t op) { blkg_rwstat_add(&bfqg->stats.merged, op, 1); } void bfqg_stats_update_completion(struct bfq_group *bfqg, u64 start_time_ns, - u64 io_start_time_ns, unsigned int op) + u64 io_start_time_ns, blk_opf_t op) { struct bfqg_stats *stats = &bfqg->stats; u64 now = ktime_get_ns(); @@ -255,11 +255,11 @@ void bfqg_stats_update_completion(struct bfq_group *bfqg, u64 start_time_ns, #else /* CONFIG_BFQ_CGROUP_DEBUG */ void bfqg_stats_update_io_add(struct bfq_group *bfqg, struct bfq_queue *bfqq, - unsigned int op) { } -void bfqg_stats_update_io_remove(struct bfq_group *bfqg, unsigned int op) { } -void bfqg_stats_update_io_merged(struct bfq_group *bfqg, unsigned int op) { } + blk_opf_t op) { } +void bfqg_stats_update_io_remove(struct bfq_group *bfqg, blk_opf_t op) { } +void bfqg_stats_update_io_merged(struct bfq_group *bfqg, blk_opf_t op) { } void bfqg_stats_update_completion(struct bfq_group *bfqg, u64 start_time_ns, - u64 io_start_time_ns, unsigned int op) { } + u64 io_start_time_ns, blk_opf_t op) { } void bfqg_stats_update_dequeue(struct bfq_group *bfqg) { } void bfqg_stats_set_start_empty_time(struct bfq_group *bfqg) { } void bfqg_stats_update_idle_time(struct bfq_group *bfqg) { } diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index e6d7e6b01a05..a724fc882158 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -668,7 +668,7 @@ static bool bfqq_request_over_limit(struct bfq_queue *bfqq, int limit) * significantly affect service guarantees coming from the BFQ scheduling * algorithm. */ -static void bfq_limit_depth(unsigned int op, struct blk_mq_alloc_data *data) +static void bfq_limit_depth(blk_opf_t op, struct blk_mq_alloc_data *data) { struct bfq_data *bfqd = data->q->elevator->elevator_data; struct bfq_io_cq *bic = bfq_bic_lookup(data->q); @@ -6104,7 +6104,7 @@ static bool __bfq_insert_request(struct bfq_data *bfqd, struct request *rq) static void bfq_update_insert_stats(struct request_queue *q, struct bfq_queue *bfqq, bool idle_timer_disabled, - unsigned int cmd_flags) + blk_opf_t cmd_flags) { if (!bfqq) return; @@ -6129,7 +6129,7 @@ static void bfq_update_insert_stats(struct request_queue *q, static inline void bfq_update_insert_stats(struct request_queue *q, struct bfq_queue *bfqq, bool idle_timer_disabled, - unsigned int cmd_flags) {} + blk_opf_t cmd_flags) {} #endif /* CONFIG_BFQ_CGROUP_DEBUG */ static struct bfq_queue *bfq_init_rq(struct request *rq); @@ -6141,7 +6141,7 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, struct bfq_data *bfqd = q->elevator->elevator_data; struct bfq_queue *bfqq; bool idle_timer_disabled = false; - unsigned int cmd_flags; + blk_opf_t cmd_flags; LIST_HEAD(free); #ifdef CONFIG_BFQ_GROUP_IOSCHED diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index ca8177d7bf7c..6bde1f4ecc50 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h @@ -994,11 +994,11 @@ void bfq_put_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg); void bfqg_stats_update_legacy_io(struct request_queue *q, struct request *rq); void bfqg_stats_update_io_add(struct bfq_group *bfqg, struct bfq_queue *bfqq, - unsigned int op); -void bfqg_stats_update_io_remove(struct bfq_group *bfqg, unsigned int op); -void bfqg_stats_update_io_merged(struct bfq_group *bfqg, unsigned int op); + blk_opf_t op); +void bfqg_stats_update_io_remove(struct bfq_group *bfqg, blk_opf_t op); +void bfqg_stats_update_io_merged(struct bfq_group *bfqg, blk_opf_t op); void bfqg_stats_update_completion(struct bfq_group *bfqg, u64 start_time_ns, - u64 io_start_time_ns, unsigned int op); + u64 io_start_time_ns, blk_opf_t op); void bfqg_stats_update_dequeue(struct bfq_group *bfqg); void bfqg_stats_set_start_empty_time(struct bfq_group *bfqg); void bfqg_stats_update_idle_time(struct bfq_group *bfqg); diff --git a/block/bio.c b/block/bio.c index 933ea3210954..8978f7d3ae48 100644 --- a/block/bio.c +++ b/block/bio.c @@ -239,7 +239,7 @@ static void bio_free(struct bio *bio) * when IO has completed, or when the bio is released. */ void bio_init(struct bio *bio, struct block_device *bdev, struct bio_vec *table, - unsigned short max_vecs, unsigned int opf) + unsigned short max_vecs, blk_opf_t opf) { bio->bi_next = NULL; bio->bi_bdev = bdev; @@ -292,7 +292,7 @@ EXPORT_SYMBOL(bio_init); * preserved are the ones that are initialized by bio_alloc_bioset(). See * comment in struct bio. */ -void bio_reset(struct bio *bio, struct block_device *bdev, unsigned int opf) +void bio_reset(struct bio *bio, struct block_device *bdev, blk_opf_t opf) { bio_uninit(bio); memset(bio, 0, BIO_RESET_BYTES); @@ -341,7 +341,7 @@ void bio_chain(struct bio *bio, struct bio *parent) EXPORT_SYMBOL(bio_chain); struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev, - unsigned int nr_pages, unsigned int opf, gfp_t gfp) + unsigned int nr_pages, blk_opf_t opf, gfp_t gfp) { struct bio *new = bio_alloc(bdev, nr_pages, opf, gfp); @@ -409,7 +409,7 @@ static void punt_bios_to_rescuer(struct bio_set *bs) } static struct bio *bio_alloc_percpu_cache(struct block_device *bdev, - unsigned short nr_vecs, unsigned int opf, gfp_t gfp, + unsigned short nr_vecs, blk_opf_t opf, gfp_t gfp, struct bio_set *bs) { struct bio_alloc_cache *cache; @@ -468,7 +468,7 @@ static struct bio *bio_alloc_percpu_cache(struct block_device *bdev, * Returns: Pointer to new bio on success, NULL on failure. */ struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs, - unsigned int opf, gfp_t gfp_mask, + blk_opf_t opf, gfp_t gfp_mask, struct bio_set *bs) { gfp_t saved_gfp = gfp_mask; diff --git a/block/blk-cgroup-rwstat.h b/block/blk-cgroup-rwstat.h index 9f2723b34b75..6c0237148c0d 100644 --- a/block/blk-cgroup-rwstat.h +++ b/block/blk-cgroup-rwstat.h @@ -59,7 +59,7 @@ void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol, * caller is responsible for synchronizing calls to this function. */ static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat, - unsigned int op, uint64_t val) + blk_opf_t op, uint64_t val) { struct percpu_counter *cnt; diff --git a/block/blk-core.c b/block/blk-core.c index 9d420dff90f6..ef082aa7b8fb 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1260,7 +1260,7 @@ EXPORT_SYMBOL_GPL(blk_io_schedule); int __init blk_dev_init(void) { - BUILD_BUG_ON(REQ_OP_LAST >= (1 << REQ_OP_BITS)); + BUILD_BUG_ON((__force u32)REQ_OP_LAST >= (1 << REQ_OP_BITS)); BUILD_BUG_ON(REQ_OP_BITS + REQ_FLAG_BITS > 8 * sizeof_field(struct request, cmd_flags)); BUILD_BUG_ON(REQ_OP_BITS + REQ_FLAG_BITS > 8 * diff --git a/block/blk-flush.c b/block/blk-flush.c index c68968724870..d20a0c6b2c66 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -94,7 +94,7 @@ enum { }; static void blk_kick_flush(struct request_queue *q, - struct blk_flush_queue *fq, unsigned int flags); + struct blk_flush_queue *fq, blk_opf_t flags); static inline struct blk_flush_queue * blk_get_flush_queue(struct request_queue *q, struct blk_mq_ctx *ctx) @@ -173,7 +173,7 @@ static void blk_flush_complete_seq(struct request *rq, { struct request_queue *q = rq->q; struct list_head *pending = &fq->flush_queue[fq->flush_pending_idx]; - unsigned int cmd_flags; + blk_opf_t cmd_flags; BUG_ON(rq->flush.seq & seq); rq->flush.seq |= seq; @@ -290,7 +290,7 @@ bool is_flush_rq(struct request *rq) * */ static void blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq, - unsigned int flags) + blk_opf_t flags) { struct list_head *pending = &fq->flush_queue[fq->flush_pending_idx]; struct request *first_rq = diff --git a/block/blk-merge.c b/block/blk-merge.c index 9d96c9239219..3a928ebb6b5e 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -712,7 +712,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, */ void blk_rq_set_mixed_merge(struct request *rq) { - unsigned int ff = rq->cmd_flags & REQ_FAILFAST_MASK; + blk_opf_t ff = rq->cmd_flags & REQ_FAILFAST_MASK; struct bio *bio; if (rq->rq_flags & RQF_MIXED_MERGE) @@ -928,7 +928,7 @@ enum bio_merge_status { static enum bio_merge_status bio_attempt_back_merge(struct request *req, struct bio *bio, unsigned int nr_segs) { - const int ff = bio->bi_opf & REQ_FAILFAST_MASK; + const blk_opf_t ff = bio->bi_opf & REQ_FAILFAST_MASK; if (!ll_back_merge_fn(req, bio, nr_segs)) return BIO_MERGE_FAILED; @@ -952,7 +952,7 @@ static enum bio_merge_status bio_attempt_back_merge(struct request *req, static enum bio_merge_status bio_attempt_front_merge(struct request *req, struct bio *bio, unsigned int nr_segs) { - const int ff = bio->bi_opf & REQ_FAILFAST_MASK; + const blk_opf_t ff = bio->bi_opf & REQ_FAILFAST_MASK; if (!ll_front_merge_fn(req, bio, nr_segs)) return BIO_MERGE_FAILED; diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index df0b9a458f34..e30ef69dfa39 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -315,8 +315,8 @@ int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq) else seq_printf(m, "%s", op_str); seq_puts(m, ", .cmd_flags="); - blk_flags_show(m, rq->cmd_flags & ~REQ_OP_MASK, cmd_flag_name, - ARRAY_SIZE(cmd_flag_name)); + blk_flags_show(m, (__force unsigned int)(rq->cmd_flags & ~REQ_OP_MASK), + cmd_flag_name, ARRAY_SIZE(cmd_flag_name)); seq_puts(m, ", .rq_flags="); blk_flags_show(m, (__force unsigned int)rq->rq_flags, rqf_name, ARRAY_SIZE(rqf_name)); diff --git a/block/blk-mq.c b/block/blk-mq.c index 50fc1194ebc0..24548dc536cc 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -508,13 +508,13 @@ static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) alloc_time_ns); } -struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op, +struct request *blk_mq_alloc_request(struct request_queue *q, blk_opf_t opf, blk_mq_req_flags_t flags) { struct blk_mq_alloc_data data = { .q = q, .flags = flags, - .cmd_flags = op, + .cmd_flags = opf, .nr_tags = 1, }; struct request *rq; @@ -655,7 +655,7 @@ void blk_dump_rq_flags(struct request *rq, char *msg) { printk(KERN_INFO "%s: dev %s: flags=%llx\n", msg, rq->q->disk ? rq->q->disk->disk_name : "?", - (unsigned long long) rq->cmd_flags); + (__force unsigned long long) rq->cmd_flags); printk(KERN_INFO " sector %llu, nr/cnr %u/%u\n", (unsigned long long)blk_rq_pos(rq), @@ -708,8 +708,9 @@ static void blk_print_req_error(struct request *req, blk_status_t status) "phys_seg %u prio class %u\n", blk_status_to_str(status), req->q->disk ? req->q->disk->disk_name : "?", - blk_rq_pos(req), req_op(req), blk_op_str(req_op(req)), - req->cmd_flags & ~REQ_OP_MASK, + blk_rq_pos(req), (__force u32)req_op(req), + blk_op_str(req_op(req)), + (__force u32)(req->cmd_flags & ~REQ_OP_MASK), req->nr_phys_segments, IOPRIO_PRIO_CLASS(req->ioprio)); } diff --git a/block/blk-mq.h b/block/blk-mq.h index e4c6fe2c8ac8..51fc5d6606e4 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -86,7 +86,7 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue_type(struct request_queue * return xa_load(&q->hctx_table, q->tag_set->map[type].mq_map[cpu]); } -static inline enum hctx_type blk_mq_get_hctx_type(unsigned int opf) +static inline enum hctx_type blk_mq_get_hctx_type(blk_opf_t opf) { enum hctx_type type = HCTX_TYPE_DEFAULT; @@ -107,7 +107,7 @@ static inline enum hctx_type blk_mq_get_hctx_type(unsigned int opf) * @ctx: software queue cpu ctx */ static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q, - unsigned int opf, + blk_opf_t opf, struct blk_mq_ctx *ctx) { return ctx->hctxs[blk_mq_get_hctx_type(opf)]; @@ -151,7 +151,7 @@ struct blk_mq_alloc_data { struct request_queue *q; blk_mq_req_flags_t flags; unsigned int shallow_depth; - unsigned int cmd_flags; + blk_opf_t cmd_flags; req_flags_t rq_flags; /* allocate multiple requests/tags in one go */ diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 7bf09ae06577..f2e4bf1dca47 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -451,7 +451,7 @@ static bool close_io(struct rq_wb *rwb) #define REQ_HIPRIO (REQ_SYNC | REQ_META | REQ_PRIO) -static inline unsigned int get_limit(struct rq_wb *rwb, unsigned long rw) +static inline unsigned int get_limit(struct rq_wb *rwb, blk_opf_t opf) { unsigned int limit; @@ -462,7 +462,7 @@ static inline unsigned int get_limit(struct rq_wb *rwb, unsigned long rw) if (!rwb_enabled(rwb)) return UINT_MAX; - if ((rw & REQ_OP_MASK) == REQ_OP_DISCARD) + if ((opf & REQ_OP_MASK) == REQ_OP_DISCARD) return rwb->wb_background; /* @@ -473,9 +473,9 @@ static inline unsigned int get_limit(struct rq_wb *rwb, unsigned long rw) * the idle limit, or go to normal if we haven't had competing * IO for a bit. */ - if ((rw & REQ_HIPRIO) || wb_recent_wait(rwb) || current_is_kswapd()) + if ((opf & REQ_HIPRIO) || wb_recent_wait(rwb) || current_is_kswapd()) limit = rwb->rq_depth.max_depth; - else if ((rw & REQ_BACKGROUND) || close_io(rwb)) { + else if ((opf & REQ_BACKGROUND) || close_io(rwb)) { /* * If less than 100ms since we completed unrelated IO, * limit us to half the depth for background writeback. @@ -490,13 +490,13 @@ static inline unsigned int get_limit(struct rq_wb *rwb, unsigned long rw) struct wbt_wait_data { struct rq_wb *rwb; enum wbt_flags wb_acct; - unsigned long rw; + blk_opf_t opf; }; static bool wbt_inflight_cb(struct rq_wait *rqw, void *private_data) { struct wbt_wait_data *data = private_data; - return rq_wait_inc_below(rqw, get_limit(data->rwb, data->rw)); + return rq_wait_inc_below(rqw, get_limit(data->rwb, data->opf)); } static void wbt_cleanup_cb(struct rq_wait *rqw, void *private_data) @@ -510,13 +510,13 @@ static void wbt_cleanup_cb(struct rq_wait *rqw, void *private_data) * the timer to kick off queuing again. */ static void __wbt_wait(struct rq_wb *rwb, enum wbt_flags wb_acct, - unsigned long rw) + blk_opf_t opf) { struct rq_wait *rqw = get_rq_wait(rwb, wb_acct); struct wbt_wait_data data = { .rwb = rwb, .wb_acct = wb_acct, - .rw = rw, + .opf = opf, }; rq_qos_wait(rqw, &data, wbt_inflight_cb, wbt_cleanup_cb); diff --git a/block/elevator.h b/block/elevator.h index 16cd8bdedb7e..3f0593b3bf9d 100644 --- a/block/elevator.h +++ b/block/elevator.h @@ -34,7 +34,7 @@ struct elevator_mq_ops { int (*request_merge)(struct request_queue *q, struct request **, struct bio *); void (*request_merged)(struct request_queue *, struct request *, enum elv_merge); void (*requests_merged)(struct request_queue *, struct request *, struct request *); - void (*limit_depth)(unsigned int, struct blk_mq_alloc_data *); + void (*limit_depth)(blk_opf_t, struct blk_mq_alloc_data *); void (*prepare_request)(struct request *); void (*finish_request)(struct request *); void (*insert_requests)(struct blk_mq_hw_ctx *, struct list_head *, bool); diff --git a/block/fops.c b/block/fops.c index 86d3cab9bf93..dd22e8c9b76f 100644 --- a/block/fops.c +++ b/block/fops.c @@ -32,9 +32,9 @@ static int blkdev_get_block(struct inode *inode, sector_t iblock, return 0; } -static unsigned int dio_bio_write_op(struct kiocb *iocb) +static blk_opf_t dio_bio_write_op(struct kiocb *iocb) { - unsigned int op = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE; + blk_opf_t op = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE; /* avoid the need for a I/O completion work item */ if (iocb->ki_flags & IOCB_DSYNC) @@ -175,7 +175,7 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, struct blkdev_dio *dio; struct bio *bio; bool is_read = (iov_iter_rw(iter) == READ), is_sync; - unsigned int opf = is_read ? REQ_OP_READ : dio_bio_write_op(iocb); + blk_opf_t opf = is_read ? REQ_OP_READ : dio_bio_write_op(iocb); loff_t pos = iocb->ki_pos; int ret = 0; @@ -297,7 +297,7 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, { struct block_device *bdev = iocb->ki_filp->private_data; bool is_read = iov_iter_rw(iter) == READ; - unsigned int opf = is_read ? REQ_OP_READ : dio_bio_write_op(iocb); + blk_opf_t opf = is_read ? REQ_OP_READ : dio_bio_write_op(iocb); struct blkdev_dio *dio; struct bio *bio; loff_t pos = iocb->ki_pos; diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c index 8f7c745b4a57..102b6a311b5c 100644 --- a/block/kyber-iosched.c +++ b/block/kyber-iosched.c @@ -195,9 +195,9 @@ struct kyber_hctx_data { static int kyber_domain_wake(wait_queue_entry_t *wait, unsigned mode, int flags, void *key); -static unsigned int kyber_sched_domain(unsigned int op) +static unsigned int kyber_sched_domain(blk_opf_t opf) { - switch (op & REQ_OP_MASK) { + switch (opf & REQ_OP_MASK) { case REQ_OP_READ: return KYBER_READ; case REQ_OP_WRITE: @@ -553,7 +553,7 @@ static void rq_clear_domain_token(struct kyber_queue_data *kqd, } } -static void kyber_limit_depth(unsigned int op, struct blk_mq_alloc_data *data) +static void kyber_limit_depth(blk_opf_t op, struct blk_mq_alloc_data *data) { /* * We use the scheduler tags as per-hardware queue queueing tokens. diff --git a/block/mq-deadline.c b/block/mq-deadline.c index 1a9e835e816c..c5589e9155e6 100644 --- a/block/mq-deadline.c +++ b/block/mq-deadline.c @@ -543,7 +543,7 @@ static struct request *dd_dispatch_request(struct blk_mq_hw_ctx *hctx) * Called by __blk_mq_alloc_request(). The shallow_depth value set by this * function is used by __blk_mq_get_tag(). */ -static void dd_limit_depth(unsigned int op, struct blk_mq_alloc_data *data) +static void dd_limit_depth(blk_opf_t op, struct blk_mq_alloc_data *data) { struct deadline_data *dd = data->q->elevator->elevator_data; diff --git a/include/linux/bio.h b/include/linux/bio.h index 992ee987f273..ca22b06700a9 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -405,7 +405,7 @@ extern void bioset_exit(struct bio_set *); extern int biovec_init_pool(mempool_t *pool, int pool_entries); struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs, - unsigned int opf, gfp_t gfp_mask, + blk_opf_t opf, gfp_t gfp_mask, struct bio_set *bs); struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask); extern void bio_put(struct bio *); @@ -418,7 +418,7 @@ int bio_init_clone(struct block_device *bdev, struct bio *bio, extern struct bio_set fs_bio_set; static inline struct bio *bio_alloc(struct block_device *bdev, - unsigned short nr_vecs, unsigned int opf, gfp_t gfp_mask) + unsigned short nr_vecs, blk_opf_t opf, gfp_t gfp_mask) { return bio_alloc_bioset(bdev, nr_vecs, opf, gfp_mask, &fs_bio_set); } @@ -456,9 +456,9 @@ struct request_queue; extern int submit_bio_wait(struct bio *bio); void bio_init(struct bio *bio, struct block_device *bdev, struct bio_vec *table, - unsigned short max_vecs, unsigned int opf); + unsigned short max_vecs, blk_opf_t opf); extern void bio_uninit(struct bio *); -void bio_reset(struct bio *bio, struct block_device *bdev, unsigned int opf); +void bio_reset(struct bio *bio, struct block_device *bdev, blk_opf_t opf); void bio_chain(struct bio *, struct bio *); int bio_add_page(struct bio *, struct page *, unsigned len, unsigned off); @@ -789,6 +789,6 @@ static inline void bio_clear_polled(struct bio *bio) } struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev, - unsigned int nr_pages, unsigned int opf, gfp_t gfp); + unsigned int nr_pages, blk_opf_t opf, gfp_t gfp); #endif /* __LINUX_BIO_H */ diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 9a1838bbed02..fbaacd4607a0 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -79,7 +79,7 @@ struct request { struct blk_mq_ctx *mq_ctx; struct blk_mq_hw_ctx *mq_hctx; - unsigned int cmd_flags; /* op and common flags */ + blk_opf_t cmd_flags; /* op and common flags */ req_flags_t rq_flags; int tag; @@ -712,7 +712,7 @@ enum { BLK_MQ_REQ_PM = (__force blk_mq_req_flags_t)(1 << 2), }; -struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op, +struct request *blk_mq_alloc_request(struct request_queue *q, blk_opf_t opf, blk_mq_req_flags_t flags); struct request *blk_mq_alloc_request_hctx(struct request_queue *q, enum req_op op, blk_mq_req_flags_t flags, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index de47b0e0e18f..9751f164d2f0 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -220,9 +220,10 @@ static inline int blk_validate_block_size(unsigned long bsize) return 0; } -static inline bool blk_op_is_passthrough(unsigned int op) +static inline bool blk_op_is_passthrough(blk_opf_t opf) { - op &= REQ_OP_MASK; + enum req_op op = opf & REQ_OP_MASK; + return op == REQ_OP_DRV_IN || op == REQ_OP_DRV_OUT; } From patchwork Thu Jun 23 18:04:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75E1BC43334 for ; Thu, 23 Jun 2022 19:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231354AbiFWTAq (ORCPT ); Thu, 23 Jun 2022 15:00:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbiFWTAR (ORCPT ); Thu, 23 Jun 2022 15:00:17 -0400 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49BF6B8F89 for ; Thu, 23 Jun 2022 11:05:45 -0700 (PDT) Received: by mail-pg1-f180.google.com with SMTP id 9so161235pgd.7 for ; Thu, 23 Jun 2022 11:05:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+dTxO9J04Elz45/3vEyCUSSDzClsVp9+z6jqAAoby5c=; b=G6D6mtqUpHbd1hiyHjapeyGjKN3ty9dKpO34BbUADtwmxAzI5xJ8fUm0vNuCJ7RuQl jmDVULdOO1HFuiqmdu28thE9idkNJul2RfiRK51K4h1M7qVFFogetZk2yD1gSkNn9kAR v7F3CE3aifwC8CtMJa8xPuU5UZrAKVC7PAMq7saP2ICHtdmHVNN2l9j8R7FOz7WlzYxo 8ea7/cHFJ3RelpuqE9UIC9RwPWgScNQku3rEZ5w3rQPUVyEM6IDRXwfJV0d7QzS9RD6N prtTAP6bWmhZTtdP+ByZH9tsXjRUgO0sljY82UmGpLvyqj6gOZgeTsjMWXS9+PieiAiY pqDA== X-Gm-Message-State: AJIora9vBtoAcxhlG/jRgV0BpvM7d3Xb4LZdm8BQZvdxvrq8QhQcwW+0 jWuUvyjilqDd/Fb63UgCkxk= X-Google-Smtp-Source: AGRyM1u+ceztbV8BqMSu1bl0YS9khoj1JzbMJbT/HvmMv7jSyts0nRPwbhIRlLTQM6t8G0XTcS8sFw== X-Received: by 2002:a63:3fcb:0:b0:40c:4da1:555a with SMTP id m194-20020a633fcb000000b0040c4da1555amr8574581pga.3.1656007544566; Thu, 23 Jun 2022 11:05:44 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:43 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Li Zefan , Steven Rostedt Subject: [PATCH 07/51] blktrace: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:04:44 -0700 Message-Id: <20220623180528.3595304-8-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the new blk_opf_t type for a function argument that represents a combination of a request operation and request flags. Rename that argument from 'op' into 'opf' to make its role more clear. Cc: Li Zefan Cc: Christoph Hellwig Cc: Steven Rostedt Signed-off-by: Bart Van Assche --- include/linux/blktrace_api.h | 3 ++- kernel/trace/blktrace.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 623e22492afa..de9ef5bb57a7 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h @@ -7,6 +7,7 @@ #include #include #include +#include #if defined(CONFIG_BLK_DEV_IO_TRACE) @@ -115,7 +116,7 @@ struct compat_blk_user_trace_setup { #endif -void blk_fill_rwbs(char *rwbs, unsigned int op); +void blk_fill_rwbs(char *rwbs, blk_opf_t opf); static inline sector_t blk_rq_trace_sector(struct request *rq) { diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 10a32b0f2deb..f24c7351071c 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -205,7 +205,7 @@ static const u32 ddir_act[2] = { BLK_TC_ACT(BLK_TC_READ), #define BLK_TC_PREFLUSH BLK_TC_FLUSH /* The ilog2() calls fall out because they're constant */ -#define MASK_TC_BIT(rw, __name) ((rw & REQ_ ## __name) << \ +#define MASK_TC_BIT(rw, __name) ((__force u32)(rw & REQ_ ## __name) << \ (ilog2(BLK_TC_ ## __name) + BLK_TC_SHIFT - __REQ_ ## __name)) /* @@ -213,8 +213,8 @@ static const u32 ddir_act[2] = { BLK_TC_ACT(BLK_TC_READ), * blk_io_trace structure and places it in a per-cpu subbuffer. */ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, - int op, int op_flags, u32 what, int error, int pdu_len, - void *pdu_data, u64 cgid) + enum req_op op, blk_opf_t op_flags, u32 what, int error, + int pdu_len, void *pdu_data, u64 cgid) { struct task_struct *tsk = current; struct ring_buffer_event *event = NULL; @@ -1895,14 +1895,14 @@ void blk_trace_remove_sysfs(struct device *dev) * caller with resulting string. * **/ -void blk_fill_rwbs(char *rwbs, unsigned int op) +void blk_fill_rwbs(char *rwbs, blk_opf_t opf) { int i = 0; - if (op & REQ_PREFLUSH) + if (opf & REQ_PREFLUSH) rwbs[i++] = 'F'; - switch (op & REQ_OP_MASK) { + switch (opf & REQ_OP_MASK) { case REQ_OP_WRITE: rwbs[i++] = 'W'; break; @@ -1923,13 +1923,13 @@ void blk_fill_rwbs(char *rwbs, unsigned int op) rwbs[i++] = 'N'; } - if (op & REQ_FUA) + if (opf & REQ_FUA) rwbs[i++] = 'F'; - if (op & REQ_RAHEAD) + if (opf & REQ_RAHEAD) rwbs[i++] = 'A'; - if (op & REQ_SYNC) + if (opf & REQ_SYNC) rwbs[i++] = 'S'; - if (op & REQ_META) + if (opf & REQ_META) rwbs[i++] = 'M'; rwbs[i] = '\0'; From patchwork Thu Jun 23 18:04:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893052 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B301CCA47F for ; Thu, 23 Jun 2022 19:00:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229492AbiFWTAq (ORCPT ); Thu, 23 Jun 2022 15:00:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231510AbiFWTAS (ORCPT ); Thu, 23 Jun 2022 15:00:18 -0400 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E5710CD20 for ; Thu, 23 Jun 2022 11:05:46 -0700 (PDT) Received: by mail-pj1-f41.google.com with SMTP id x1-20020a17090abc8100b001ec7f8a51f5so3412525pjr.0 for ; Thu, 23 Jun 2022 11:05:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CB1xiHV0NGk+yjyEhzG5/AEKBrtijo9o4tlzumPY0/0=; b=2nljDR3D1AFa6/4Et825dvofiHJQrOaFPMx5nzRXvR7kB0HmWOSMTIEXPv5Oqodw/Q nqnY2Yp6LDONvKMMnxzDT+w5WatbIK/5xJ5+4QJtglkTwCeQK90wOCuESCDPtE4jKSGp OJwhZACYP1nhCbRQjp3G6NT0cOTypkIADs+DMqdF7YcPmARxKaIGE9k0yBSgocGlcaIp VMpJOHDGr/Esd1pAyRGpZMbvxNcxNNhLFJBhWwNODYYmKchDfTau1dh4x1MTWn2TuDZl Fq5LDYx4I+Is4fyv5HL3HQi2OePShdU5GG+9KRvNIwcv7YVFn06bQlSxu4fDHr3/5nov KLjQ== X-Gm-Message-State: AJIora8DxLAkGkmKdeKXWhT9bEsgV0zm7n+wrxliAb8898pkh0svZfvv JACU42IjRgwl7znmo9cVLWw= X-Google-Smtp-Source: AGRyM1vqIkBzc5KiTUa59m1N7Ox6JzaMxg+Jr1G4JSiZfvsWiDPpUZbCjSz6xJ41/v4r/b3BqdsDGA== X-Received: by 2002:a17:902:d2d1:b0:16a:1dd9:4d3d with SMTP id n17-20020a170902d2d100b0016a1dd94d3dmr23746961plc.18.1656007546261; Thu, 23 Jun 2022 11:05:46 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:45 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Mike Snitzer , Jun'ichi Nomura Subject: [PATCH 08/51] blktrace: Trace remap operations correctly Date: Thu, 23 Jun 2022 11:04:45 -0700 Message-Id: <20220623180528.3595304-9-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Trace the remapped operation instead of only the data direction of remapped operations. This issue was detected by analyzing the warnings reported by sparse related to the new blk_opf_t type. Cc: Mike Snitzer Cc: Jun'ichi Nomura Fixes: b0da3f0dada7 ("Add a tracepoint for block request remapping") Signed-off-by: Bart Van Assche --- kernel/trace/blktrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index f24c7351071c..d9e0530080e2 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1061,7 +1061,7 @@ static void blk_add_trace_rq_remap(void *ignore, struct request *rq, dev_t dev, r.sector_from = cpu_to_be64(from); __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq), - rq_data_dir(rq), 0, BLK_TA_REMAP, 0, + req_op(rq), 0, BLK_TA_REMAP, 0, sizeof(r), &r, blk_trace_request_get_cgid(rq)); rcu_read_unlock(); } From patchwork Thu Jun 23 18:04:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E547BC433EF for ; Thu, 23 Jun 2022 19:00:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231953AbiFWTAs (ORCPT ); Thu, 23 Jun 2022 15:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231860AbiFWTAU (ORCPT ); Thu, 23 Jun 2022 15:00:20 -0400 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80B3410CD2A for ; Thu, 23 Jun 2022 11:05:48 -0700 (PDT) Received: by mail-pg1-f173.google.com with SMTP id 184so135997pga.12 for ; Thu, 23 Jun 2022 11:05:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bA0iTvq/w0HBQiKA8Q/w3tykLbU2EYtwh4o0dlv+mIk=; b=ntAMPuRq9VScMBhMYIm83CQKQ/cBEpNkM4OYst3FDXKxxo7ciz1zjOB0l6aC0Bs1z9 +SpJ2/mjwYPLQPTTvCPo4rrrHNLBfGY0qdZwihYfW6kVuNx61jQwczp7OYpX2ThWLOs1 Op9DrHGvcxs8+lMFDeB2AdV6wNZxXHnJN6JDgdJQb0Bw67pI6XAfaMD6hkLKKJ9vUiQz APg3aMbG4ZYUH+N9ZSaMVme+5OBJ1LHuwWeFD6d8DgYbJGckH9ujdJbgSmqaSa1Wh0jN dxat/jxJ0C+wIBkJx+ro7tOQNAXnMb9lMx83kWlWQSDMwQF5fomwXHfPSluGoyEbU217 JsFw== X-Gm-Message-State: AJIora9Jl4MVccQ0WCNYnA5iZWaTL4eXhZaumLI4weqw/1tK+QVy7jyr 9xwvGhtmYMyQB6/Gp8F5hDo= X-Google-Smtp-Source: AGRyM1sYK+jy8Jn1rP8Xe333+F3lqj1pz5muZZZ3yt9+37bw7PpaoSR61vmy0Cg57FFU9UYm7HXQUQ== X-Received: by 2002:a63:7555:0:b0:40c:f8be:af36 with SMTP id f21-20020a637555000000b0040cf8beaf36mr8386766pgn.6.1656007547966; Thu, 23 Jun 2022 11:05:47 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:47 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei Subject: [PATCH 09/51] block/brd: Use the enum req_op type Date: Thu, 23 Jun 2022 11:04:46 -0700 Message-Id: <20220623180528.3595304-10-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for a function argument that represents a request operation. Cc: Christoph Hellwig Cc: Ming Lei Signed-off-by: Bart Van Assche --- drivers/block/brd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/brd.c b/drivers/block/brd.c index c3d772bdd89f..a3dfff0f73f5 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c @@ -256,7 +256,7 @@ static void copy_from_brd(void *dst, struct brd_device *brd, * Process a single bvec of a bio. */ static int brd_do_bvec(struct brd_device *brd, struct page *page, - unsigned int len, unsigned int off, unsigned int op, + unsigned int len, unsigned int off, enum req_op op, sector_t sector) { void *mem; From patchwork Thu Jun 23 18:04:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE7F8C43334 for ; Thu, 23 Jun 2022 19:00:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229704AbiFWTAz (ORCPT ); Thu, 23 Jun 2022 15:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbiFWTA3 (ORCPT ); Thu, 23 Jun 2022 15:00:29 -0400 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89FA210CD2F for ; Thu, 23 Jun 2022 11:05:50 -0700 (PDT) Received: by mail-pf1-f180.google.com with SMTP id u37so324643pfg.3 for ; Thu, 23 Jun 2022 11:05:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w3UvXl/RfnduAkP3mhS5FXVzLYyRvEiflC5jl8OcZ5o=; b=EG/Lo9Knlhu/KC3UQAJrcOP2SuM9VqFUMnAelsh2IlUcgnRkiC5NRJWWSJMNbgiLbL fwHHuJNomslvAYMQvuNAyeoLSKq3IkTauRhSIvW3U0R0J86cjLyGyBiAb9+oIqwIytaj jUw8WDyJSwbuvWHitUqpTI6U/KBKOtrn+QjvR80nst9CV4EfoevKeycacHls6zWULdIf QBbsu++ZIqGTRwIZSTnTLxqG60mJDoCkwH1Eo6PsU3EyYZ+1fXGGx2DcDIPt741GEEVY u6nfPUMn9cwP7zKl8naUUge6DYlZkajzSadYdL94S687y8k9AjSr3w+h1jY6ZjLiRblF MqpA== X-Gm-Message-State: AJIora9nV/WS+mcmJaANAf5fq9fRSltnFBW8XPwAX3GTF6pZGyuqv+ur tkIn9M6dbXceYvhO3Nw7o5E= X-Google-Smtp-Source: AGRyM1vMhhCUNXpLyRgey4C93QnyHKIhhOd/gln1tAt2+FmtcmxQN0K/ezgRd+6SAOiTA1vhTIOk7g== X-Received: by 2002:a63:4f04:0:b0:408:8206:5bcd with SMTP id d4-20020a634f04000000b0040882065bcdmr8560148pgb.105.1656007549584; Thu, 23 Jun 2022 11:05:49 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:48 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Lars Ellenberg , Philipp Reisner , =?utf-8?q?Christoph_B=C3=B6hm?= =?utf-8?q?walder?= Subject: [PATCH 10/51] block/drbd: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:04:47 -0700 Message-Id: <20220623180528.3595304-11-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Lars Ellenberg Cc: Philipp Reisner Cc: Christoph Böhmwalder Signed-off-by: Bart Van Assche Acked-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_actlog.c | 9 +++++---- drivers/block/drbd/drbd_bitmap.c | 3 ++- drivers/block/drbd/drbd_int.h | 6 +++--- drivers/block/drbd/drbd_receiver.c | 11 ++++++----- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c index f5bcded3640d..e27478ae579c 100644 --- a/drivers/block/drbd/drbd_actlog.c +++ b/drivers/block/drbd/drbd_actlog.c @@ -124,12 +124,13 @@ void wait_until_done_or_force_detached(struct drbd_device *device, struct drbd_b static int _drbd_md_sync_page_io(struct drbd_device *device, struct drbd_backing_dev *bdev, - sector_t sector, int op) + sector_t sector, enum req_op op) { struct bio *bio; /* we do all our meta data IO in aligned 4k blocks. */ const int size = 4096; - int err, op_flags = 0; + int err; + blk_opf_t op_flags = 0; device->md_io.done = 0; device->md_io.error = -ENODEV; @@ -174,7 +175,7 @@ static int _drbd_md_sync_page_io(struct drbd_device *device, } int drbd_md_sync_page_io(struct drbd_device *device, struct drbd_backing_dev *bdev, - sector_t sector, int op) + sector_t sector, enum req_op op) { int err; D_ASSERT(device, atomic_read(&device->md_io.in_use) == 1); @@ -385,7 +386,7 @@ static int __al_write_transaction(struct drbd_device *device, struct al_transact write_al_updates = rcu_dereference(device->ldev->disk_conf)->al_updates; rcu_read_unlock(); if (write_al_updates) { - if (drbd_md_sync_page_io(device, device->ldev, sector, WRITE)) { + if (drbd_md_sync_page_io(device, device->ldev, sector, REQ_OP_WRITE)) { err = -EIO; drbd_chk_io_error(device, 1, DRBD_META_IO_ERROR); } else { diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index bd2133ef6e0a..0845f28a48a7 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c @@ -990,7 +990,8 @@ static inline sector_t drbd_md_last_bitmap_sector(struct drbd_backing_dev *bdev) static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_hold(local) { struct drbd_device *device = ctx->device; - unsigned int op = (ctx->flags & BM_AIO_READ) ? REQ_OP_READ : REQ_OP_WRITE; + const enum req_op op = ctx->flags & BM_AIO_READ ? REQ_OP_READ : + REQ_OP_WRITE; struct drbd_bitmap *b = device->bitmap; struct bio *bio; struct page *page; diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 4d3efaa20b7b..ecb2ecd8d67d 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h @@ -1495,7 +1495,7 @@ extern int drbd_resync_finished(struct drbd_device *device); extern void *drbd_md_get_buffer(struct drbd_device *device, const char *intent); extern void drbd_md_put_buffer(struct drbd_device *device); extern int drbd_md_sync_page_io(struct drbd_device *device, - struct drbd_backing_dev *bdev, sector_t sector, int op); + struct drbd_backing_dev *bdev, sector_t sector, enum req_op op); extern void drbd_ov_out_of_sync_found(struct drbd_device *, sector_t, int); extern void wait_until_done_or_force_detached(struct drbd_device *device, struct drbd_backing_dev *bdev, unsigned int *done); @@ -1547,8 +1547,8 @@ extern bool drbd_rs_c_min_rate_throttle(struct drbd_device *device); extern bool drbd_rs_should_slow_down(struct drbd_device *device, sector_t sector, bool throttle_if_app_is_waiting); extern int drbd_submit_peer_request(struct drbd_device *, - struct drbd_peer_request *, const unsigned, - const unsigned, const int); + struct drbd_peer_request *, enum req_op, + blk_opf_t, int); extern int drbd_free_peer_reqs(struct drbd_device *, struct list_head *); extern struct drbd_peer_request *drbd_alloc_peer_req(struct drbd_peer_device *, u64, sector_t, unsigned int, diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 6762be53f409..caf646dd91ba 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -1621,7 +1621,7 @@ static void drbd_issue_peer_discard_or_zero_out(struct drbd_device *device, stru /* TODO allocate from our own bio_set. */ int drbd_submit_peer_request(struct drbd_device *device, struct drbd_peer_request *peer_req, - const unsigned op, const unsigned op_flags, + const enum req_op op, const blk_opf_t op_flags, const int fault_type) { struct bio *bios = NULL; @@ -2383,14 +2383,14 @@ static int wait_for_and_update_peer_seq(struct drbd_peer_device *peer_device, co /* see also bio_flags_to_wire() * DRBD_REQ_*, because we need to semantically map the flags to data packet * flags and back. We may replicate to other kernel versions. */ -static unsigned long wire_flags_to_bio_flags(u32 dpf) +static blk_opf_t wire_flags_to_bio_flags(u32 dpf) { return (dpf & DP_RW_SYNC ? REQ_SYNC : 0) | (dpf & DP_FUA ? REQ_FUA : 0) | (dpf & DP_FLUSH ? REQ_PREFLUSH : 0); } -static unsigned long wire_flags_to_bio_op(u32 dpf) +static enum req_op wire_flags_to_bio_op(u32 dpf) { if (dpf & DP_ZEROES) return REQ_OP_WRITE_ZEROES; @@ -2543,7 +2543,8 @@ static int receive_Data(struct drbd_connection *connection, struct packet_info * struct drbd_peer_request *peer_req; struct p_data *p = pi->data; u32 peer_seq = be32_to_cpu(p->seq_num); - int op, op_flags; + enum req_op op; + blk_opf_t op_flags; u32 dp_flags; int err, tp; @@ -4951,7 +4952,7 @@ static int receive_rs_deallocated(struct drbd_connection *connection, struct pac if (get_ldev(device)) { struct drbd_peer_request *peer_req; - const int op = REQ_OP_WRITE_ZEROES; + const enum req_op op = REQ_OP_WRITE_ZEROES; peer_req = drbd_alloc_peer_req(peer_device, ID_SYNCER, sector, size, 0, GFP_NOIO); From patchwork Thu Jun 23 18:04:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893054 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37919C433EF for ; Thu, 23 Jun 2022 19:00:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229610AbiFWTAv (ORCPT ); Thu, 23 Jun 2022 15:00:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbiFWTAW (ORCPT ); Thu, 23 Jun 2022 15:00:22 -0400 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8720110CD36 for ; Thu, 23 Jun 2022 11:05:51 -0700 (PDT) Received: by mail-pg1-f178.google.com with SMTP id l4so131899pgh.13 for ; Thu, 23 Jun 2022 11:05:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gWBC5ntOBdls9NFQDjTFw6oK42LcURzDPDLiTvSvU8o=; b=rqk3lT8Bsfzgmmpo7nMvb2cpKVgj7X8YiTdkMJc6rq783qpWnrUt/l/HPfVQQpKtb1 2uKDax7Rq6btclBCod9CY7l1JOgE22sh61SCYVSrlCY+148lvgucRYhuRM48pZRekuKp fz8jGGwkFLFdsjL/PfX8HNC+vQeZ8+J9D5AhEi/Can3QTRQpfgDpx+ll5BOZK+lywLxg rCHUkiSwRtkJTV3DBIltk5xA28vaH/Lga+HHFf5zx9vFJD8iKQUN5WdGJCbfClelidXk 7OvmWs7LDhjnhs6z2Y5/xkzhN4L1o0px973rlPjElmtmgSFj+APWQYfq79zcgbhOote3 +I2g== X-Gm-Message-State: AJIora/OHDoiKiAyGT04mTdCJ+RkmVYetI8ZZYQGGy0yLEP9ADTim1uh GnaAkd7oll8QrxJc8cxbSdQVJiyCQL0= X-Google-Smtp-Source: AGRyM1vGz/Zd+z5V1/TslPAaFO+pS8kedo7HQ2sdaX+D11u7ZchisEvKanP2oc44ekyTnjGjM7fOVw== X-Received: by 2002:a63:564f:0:b0:40d:6ea2:6341 with SMTP id g15-20020a63564f000000b0040d6ea26341mr1668752pgm.534.1656007550916; Thu, 23 Jun 2022 11:05:50 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:50 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Denis Efremov Subject: [PATCH 11/51] block/floppy: Fix a sparse warning Date: Thu, 23 Jun 2022 11:04:48 -0700 Message-Id: <20220623180528.3595304-12-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Since the type of request.cmd_flags has been changed from u32 into blk_opf_t, use the __force keyword when casting to an integer type to prevent that sparse warns about this cast. Cc: Denis Efremov Signed-off-by: Bart Van Assche --- drivers/block/floppy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 015841f50f4e..2f24de4eb8da 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -2859,7 +2859,7 @@ static blk_status_t floppy_queue_rq(struct blk_mq_hw_ctx *hctx, if (WARN(atomic_read(&usage_count) == 0, "warning: usage count=0, current_req=%p sect=%ld flags=%llx\n", current_req, (long)blk_rq_pos(current_req), - (unsigned long long) current_req->cmd_flags)) + (__force unsigned long long) current_req->cmd_flags)) return BLK_STS_IOERR; if (test_and_set_bit(0, &fdc_busy)) { From patchwork Thu Jun 23 18:04:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19011C433EF for ; Thu, 23 Jun 2022 19:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229687AbiFWTAx (ORCPT ); Thu, 23 Jun 2022 15:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiFWTAa (ORCPT ); Thu, 23 Jun 2022 15:00:30 -0400 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15D1A10CD3B for ; Thu, 23 Jun 2022 11:05:53 -0700 (PDT) Received: by mail-pg1-f172.google.com with SMTP id d129so151604pgc.9 for ; Thu, 23 Jun 2022 11:05:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vCfdY54E0YpQf9NQo2iEL3i0DfKluI5hrZD6kzUYhhs=; b=iq51Fr0VAxCdxLqMm7RYLumlWLUkDgmkyodgeB0e0GLxIkyO0kEVRBGlIJlJD3eH3v QfSTqGZkmepvy5CUkrJlG/SVnQjvt/E+yCzXbrzT/uP53CW+9wSMY+pcGD2n9i7yCoWt iuWpcicIhS8B614l20x9xg+ssMwlTXYPpGGJiHb+0weyFVg/vHstxi84JY3798CLfRJJ b9uRPKHVt0Dk7RL2vzTxFWyWOvnhwadiHz4+YLhahor2CC7DTggm04IjPzx8uD0/FKhh UYeOErDSX2qhPcuN4gNIZ77enR8KRhQyNc3D7dAjuPuQtWcUcReIBaIhymFaDZaiI/QW UECA== X-Gm-Message-State: AJIora9tu25IH2555a/wVZsurjngznsluokjr6S/WNuqiQG6KhI5Dt0M wNkHcTMfR8w8ZiVP1S6mivo= X-Google-Smtp-Source: AGRyM1szxafbZCYS6RlRWWim5d7G9WmghAD0i9A0W/cBCi+88Nft6nzqbR1DNstmPQ6zz3uOcsOkCQ== X-Received: by 2002:a63:b1e:0:b0:3fd:43d9:5354 with SMTP id 30-20020a630b1e000000b003fd43d95354mr8530167pgl.294.1656007552472; Thu, 23 Jun 2022 11:05:52 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:51 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei Subject: [PATCH 12/51] block/null_blk: Fix sparse warnings in tracing code Date: Thu, 23 Jun 2022 11:04:49 -0700 Message-Id: <20220623180528.3595304-13-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Since the tracing infrastructure does not support bitwise types, store the request operation as an int. This patch does not change any functionality. Cc: Christoph Hellwig Cc: Ming Lei Signed-off-by: Bart Van Assche --- drivers/block/null_blk/trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/block/null_blk/trace.h b/drivers/block/null_blk/trace.h index 6b2b370e786f..f79467e5310f 100644 --- a/drivers/block/null_blk/trace.h +++ b/drivers/block/null_blk/trace.h @@ -36,19 +36,19 @@ TRACE_EVENT(nullb_zone_op, TP_ARGS(cmd, zone_no, zone_cond), TP_STRUCT__entry( __array(char, disk, DISK_NAME_LEN) - __field(enum req_op, op) + __field(int, op) __field(unsigned int, zone_no) __field(unsigned int, zone_cond) ), TP_fast_assign( - __entry->op = req_op(cmd->rq); + __entry->op = (__force int)req_op(cmd->rq); __entry->zone_no = zone_no; __entry->zone_cond = zone_cond; __assign_disk_name(__entry->disk, cmd->rq->q->disk); ), TP_printk("%s req=%-15s zone_no=%u zone_cond=%-10s", __print_disk_name(__entry->disk), - blk_op_str(__entry->op), + blk_op_str((__force enum req_op)__entry->op), __entry->zone_no, blk_zone_cond_str(__entry->zone_cond)) ); From patchwork Thu Jun 23 18:04:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C0C5CCA47C for ; Thu, 23 Jun 2022 19:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230413AbiFWTA7 (ORCPT ); Thu, 23 Jun 2022 15:00:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231714AbiFWTAe (ORCPT ); Thu, 23 Jun 2022 15:00:34 -0400 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AA3DA1E10 for ; Thu, 23 Jun 2022 11:05:55 -0700 (PDT) Received: by mail-pl1-f174.google.com with SMTP id a17so16856228pls.6 for ; Thu, 23 Jun 2022 11:05:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=au1a8taQE5BsDHVNYY/5GNZPJ3Dny1f3djPadh9DsWk=; b=Vg6kvAfGTtPxZLp2gaMxfDjaKqDgB+tVwOxRWMX3/qmtsQMUEzeUuzhmmwCvZYN9EP XV4kqcZ3G0NRqatGtl9QQzlBd5gbcmn+vQSPrMbiORbfAdNeXS9fDM1RI7NAxmzT8Lqe fDdHt4YnKHaUY0PBcD/PQm59RVm8B2ZT5hYEs7Y4WBXxnz8lMXS6g8Qydr2+Qw/EqGMK LerARZYQ2pi1UI0VSvyyUXb1KHh+NW6BkEgf0Em+SldloLQ+SdMDxAwHo6BtUNKvGZ6q tMqa/vkClzlALicqGGHm+Z8Bkuvm3J/g5siCjHrgWO+njG1nYKMvp3hRYuWn9SdAYZ+D sHGA== X-Gm-Message-State: AJIora9gULsqyAo+tiMaGMvdNgw6qVGDx5G6c6bTxBtUtmA4EYKe9d7X lA0rVS6tRYNzyw2euQhwVo8= X-Google-Smtp-Source: AGRyM1tkSvkqZHJohnEfsyxfiPs4oGhb3Jh1qLiH02VWaFUWLkYwyeo0RpNSJ+Tvn2RZ1/edNPX+oQ== X-Received: by 2002:a17:903:183:b0:16a:5c43:9a9c with SMTP id z3-20020a170903018300b0016a5c439a9cmr3593869plg.153.1656007554559; Thu, 23 Jun 2022 11:05:54 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:53 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Richard Weinberger , Anton Ivanov Subject: [PATCH 13/51] um: Use enum req_op where appropriate Date: Thu, 23 Jun 2022 11:04:50 -0700 Message-Id: <20220623180528.3595304-14-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using type enum req_op instead of int where appropriate. Cc: Richard Weinberger Cc: Anton Ivanov Signed-off-by: Bart Van Assche --- arch/um/drivers/ubd_kern.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index c4344b67628d..e2a0ebe4872f 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -1262,7 +1262,7 @@ static void ubd_map_req(struct ubd *dev, struct io_thread_req *io_req, struct req_iterator iter; int i = 0; unsigned long byte_offset = io_req->offset; - int op = req_op(req); + enum req_op op = req_op(req); if (op == REQ_OP_WRITE_ZEROES || op == REQ_OP_DISCARD) { io_req->io_desc[0].buffer = NULL; @@ -1325,7 +1325,7 @@ static int ubd_submit_request(struct ubd *dev, struct request *req) int segs = 0; struct io_thread_req *io_req; int ret; - int op = req_op(req); + enum req_op op = req_op(req); if (op == REQ_OP_FLUSH) segs = 0; From patchwork Thu Jun 23 18:04:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80F37C433EF for ; Thu, 23 Jun 2022 19:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbiFWTA7 (ORCPT ); Thu, 23 Jun 2022 15:00:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231790AbiFWTAe (ORCPT ); Thu, 23 Jun 2022 15:00:34 -0400 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB26FA1E0F for ; Thu, 23 Jun 2022 11:05:56 -0700 (PDT) Received: by mail-pg1-f174.google.com with SMTP id h192so175828pgc.4 for ; Thu, 23 Jun 2022 11:05:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/CYBwJNI0zfXDMBqtEhOK5NW3yhdwcJdPVHIPEW1sS0=; b=pqQ/xENAN6rGgLwdlQeJFjMb8jPrMECM1A8d56BVExYh8tmlauQ3F8nOqwjpv6U2y1 f6gQcnqcfTYFDItbc5HEcGEKX5pqvtVkozJ1BFZrvKORQBFp1nyFzfF+5fyrya/lprNn 8aE2ydth8w9hN71tZZgymNn31z4TmOgA6PTGGkNO8UFQQmBaW2vLZ6CGsXBOmZXqQl0O FnpUz2xrrKozL6GFFSAPy1aITpUOHgo7K8bYhKgH/rthUiI8y87YWFTrM9RX+Jnznatu 3IWNQ0F/GHkeODp14YxYZm/uvWNkIgnqjFlyX0CcA/41ChbeDkOkwLyY7PHfDdPZ2hc5 /JfA== X-Gm-Message-State: AJIora/fTlq+NlZpuDKlIQZpCE0/kMDm57bfrVRojA8cW1X7Z0ceP75d c3jb+27/Af7VLwTcKCy26aVR34ZM+f0= X-Google-Smtp-Source: AGRyM1sT8f3fuBGCkLZRpvuSK/xk+18DP+Q7+JiOKRyidbc4dV4jyzYQZsBL5ZL+l5MsjIDoxJlrzg== X-Received: by 2002:a63:af1c:0:b0:40c:f9d6:9f07 with SMTP id w28-20020a63af1c000000b0040cf9d69f07mr8509371pge.384.1656007556151; Thu, 23 Jun 2022 11:05:56 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:55 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Alasdair Kergon , Mike Snitzer Subject: [PATCH 14/51] dm/core: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:04:51 -0700 Message-Id: <20220623180528.3595304-15-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags all or not combined with a request operation. Cc: Alasdair Kergon Cc: Mike Snitzer Signed-off-by: Bart Van Assche --- drivers/md/dm-io.c | 18 ++++++++++-------- drivers/md/dm.c | 2 +- include/linux/dm-io.h | 5 +++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index e4b95eaeec8c..29ff150634cd 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c @@ -293,7 +293,7 @@ static void km_dp_init(struct dpages *dp, void *data) /*----------------------------------------------------------------- * IO routines that accept a list of pages. *---------------------------------------------------------------*/ -static void do_region(int op, int op_flags, unsigned region, +static void do_region(enum req_op op, blk_opf_t op_flags, unsigned region, struct dm_io_region *where, struct dpages *dp, struct io *io) { @@ -368,9 +368,9 @@ static void do_region(int op, int op_flags, unsigned region, } while (remaining); } -static void dispatch_io(int op, int op_flags, unsigned int num_regions, - struct dm_io_region *where, struct dpages *dp, - struct io *io, int sync) +static void dispatch_io(enum req_op op, blk_opf_t op_flags, + unsigned int num_regions, struct dm_io_region *where, + struct dpages *dp, struct io *io, int sync) { int i; struct dpages old_pages = *dp; @@ -411,8 +411,9 @@ static void sync_io_complete(unsigned long error, void *context) } static int sync_io(struct dm_io_client *client, unsigned int num_regions, - struct dm_io_region *where, int op, int op_flags, - struct dpages *dp, unsigned long *error_bits) + struct dm_io_region *where, enum req_op op, + blk_opf_t op_flags, struct dpages *dp, + unsigned long *error_bits) { struct io *io; struct sync_io sio; @@ -445,8 +446,9 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions, } static int async_io(struct dm_io_client *client, unsigned int num_regions, - struct dm_io_region *where, int op, int op_flags, - struct dpages *dp, io_notify_fn fn, void *context) + struct dm_io_region *where, enum req_op op, + blk_opf_t op_flags, struct dpages *dp, io_notify_fn fn, + void *context) { struct io *io; diff --git a/drivers/md/dm.c b/drivers/md/dm.c index bed7ad573f79..ea0bbbd6837f 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1622,7 +1622,7 @@ static blk_status_t __split_and_process_bio(struct clone_info *ci) * Only support bio polling for normal IO, and the target io is * exactly inside the dm_io instance (verified in dm_poll_dm_io) */ - ci->submit_as_polled = ci->bio->bi_opf & REQ_POLLED; + ci->submit_as_polled = !!(ci->bio->bi_opf & REQ_POLLED); len = min_t(sector_t, max_io_len(ti, ci->sector), ci->sector_count); setup_split_accounting(ci, len); diff --git a/include/linux/dm-io.h b/include/linux/dm-io.h index a52c6580cc9a..811f29ca4971 100644 --- a/include/linux/dm-io.h +++ b/include/linux/dm-io.h @@ -13,6 +13,7 @@ #ifdef __KERNEL__ #include +#include struct dm_io_region { struct block_device *bdev; @@ -57,8 +58,8 @@ struct dm_io_notify { */ struct dm_io_client; struct dm_io_request { - int bi_op; /* REQ_OP */ - int bi_op_flags; /* req_flag_bits */ + enum req_op bi_op; /* REQ_OP */ + blk_opf_t bi_op_flags; /* req_flag_bits */ struct dm_io_memory mem; /* Memory to use for io */ struct dm_io_notify notify; /* Synchronous if notify.fn is NULL */ struct dm_io_client *client; /* Client memory handler */ From patchwork Thu Jun 23 18:04:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74194C43334 for ; Thu, 23 Jun 2022 19:01:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbiFWTBA (ORCPT ); Thu, 23 Jun 2022 15:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231838AbiFWTAe (ORCPT ); Thu, 23 Jun 2022 15:00:34 -0400 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9EB4A1E23 for ; Thu, 23 Jun 2022 11:05:57 -0700 (PDT) Received: by mail-pj1-f41.google.com with SMTP id x1-20020a17090abc8100b001ec7f8a51f5so3412525pjr.0 for ; Thu, 23 Jun 2022 11:05:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pFxKlh69vpKK2GSD0HsDe+6kxHHjfwgM5wsVikqV7XE=; b=NimUElmQjDC1rnTZcbvkpKONNaB8dL9GVCXwGgPmDyZn4gjzFWCnUX4NcYweggFeD9 G4spg4V8o/luGowSNvoCJ7VD4ApJ3VaBsQrahXAHMui3zKrfUD9iN6UZuvtoefXnEa0y nYb0ErSmcsileFhHv6/aFAV3B3CNpZjsbCHegf6NFBl15118Ou6HF1ewwvexiG2HjV7K /M3/iS/FfM1oB924EVRzRii7SOW6LPlyeGvOjBgrEIbF7sBs/Ohifh8s+NK/6paP6Fvp LOFZfo6JxhSpAesN8+kgqPnXvmyP9dkqrpo2ygbqL+lcyBzi9GJpd0KkKxQkCBVx3mM/ 95hQ== X-Gm-Message-State: AJIora/nq+mIlf1z2qWqNkocfO6IQmjnAnQFVPwoBJl6+qlNrsr01soa ADp/rmcoIBVmHZpGQl88YEw= X-Google-Smtp-Source: AGRyM1tbgpua8djrkFV8wAzRSqi58W+WA8yHRMA+GmP7xQ7gY3TvPr7fwak0m1MSlOXAYAOmLu1MPQ== X-Received: by 2002:a17:902:b090:b0:167:7ae5:e13b with SMTP id p16-20020a170902b09000b001677ae5e13bmr40194835plr.170.1656007557398; Thu, 23 Jun 2022 11:05:57 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:56 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Alasdair Kergon , Mike Snitzer Subject: [PATCH 15/51] dm/bufio: Change 'int rw' into 'enum req_op op' Date: Thu, 23 Jun 2022 11:04:52 -0700 Message-Id: <20220623180528.3595304-16-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using type 'enum req_op' instead of 'int'. Make the role of the 'rw' arguments more clear by renaming these into 'op' (operation). This patch does not change any functionality. Cc: Alasdair Kergon Cc: Mike Snitzer Signed-off-by: Bart Van Assche --- drivers/md/dm-bufio.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 5ffa1dcf84cf..666b36d043d4 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -577,12 +577,12 @@ static void dmio_complete(unsigned long error, void *context) b->end_io(b, unlikely(error != 0) ? BLK_STS_IOERR : 0); } -static void use_dmio(struct dm_buffer *b, int rw, sector_t sector, +static void use_dmio(struct dm_buffer *b, enum req_op op, sector_t sector, unsigned n_sectors, unsigned offset) { int r; struct dm_io_request io_req = { - .bi_op = rw, + .bi_op = op, .bi_op_flags = 0, .notify.fn = dmio_complete, .notify.context = b, @@ -616,7 +616,7 @@ static void bio_complete(struct bio *bio) b->end_io(b, status); } -static void use_bio(struct dm_buffer *b, int rw, sector_t sector, +static void use_bio(struct dm_buffer *b, enum req_op op, sector_t sector, unsigned n_sectors, unsigned offset) { struct bio *bio; @@ -630,10 +630,10 @@ static void use_bio(struct dm_buffer *b, int rw, sector_t sector, bio = bio_kmalloc(vec_size, GFP_NOWAIT | __GFP_NORETRY | __GFP_NOWARN); if (!bio) { dmio: - use_dmio(b, rw, sector, n_sectors, offset); + use_dmio(b, op, sector, n_sectors, offset); return; } - bio_init(bio, b->c->bdev, bio->bi_inline_vecs, vec_size, rw); + bio_init(bio, b->c->bdev, bio->bi_inline_vecs, vec_size, op); bio->bi_iter.bi_sector = sector; bio->bi_end_io = bio_complete; bio->bi_private = b; @@ -669,7 +669,8 @@ static inline sector_t block_to_sector(struct dm_bufio_client *c, sector_t block return sector; } -static void submit_io(struct dm_buffer *b, int rw, void (*end_io)(struct dm_buffer *, blk_status_t)) +static void submit_io(struct dm_buffer *b, enum req_op op, + void (*end_io)(struct dm_buffer *, blk_status_t)) { unsigned n_sectors; sector_t sector; @@ -679,7 +680,7 @@ static void submit_io(struct dm_buffer *b, int rw, void (*end_io)(struct dm_buff sector = block_to_sector(b->c, b->block); - if (rw != REQ_OP_WRITE) { + if (op != REQ_OP_WRITE) { n_sectors = b->c->block_size >> SECTOR_SHIFT; offset = 0; } else { @@ -698,9 +699,9 @@ static void submit_io(struct dm_buffer *b, int rw, void (*end_io)(struct dm_buff } if (b->data_mode != DATA_MODE_VMALLOC) - use_bio(b, rw, sector, n_sectors, offset); + use_bio(b, op, sector, n_sectors, offset); else - use_dmio(b, rw, sector, n_sectors, offset); + use_dmio(b, op, sector, n_sectors, offset); } /*---------------------------------------------------------------- From patchwork Thu Jun 23 18:04:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893060 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A8AFCCA47C for ; Thu, 23 Jun 2022 19:01:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231443AbiFWTBA (ORCPT ); Thu, 23 Jun 2022 15:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230228AbiFWTAg (ORCPT ); Thu, 23 Jun 2022 15:00:36 -0400 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6422B8F98 for ; Thu, 23 Jun 2022 11:05:59 -0700 (PDT) Received: by mail-pg1-f173.google.com with SMTP id q140so164215pgq.6 for ; Thu, 23 Jun 2022 11:05:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zDqNnq3ycTkek69rhOHXG+EejSmdPdxwDYQLdTGKsOQ=; b=eA7bJI1+mPmPezv9H+TYLRIqyNhASFG6H2mcw4pHjgebE2g++Fnz5I/dW4zCcJwnUo S1BuXfoP54Flx1YpDUhYoFr+OXz9K/RInBcCJcRmuBXz8a/G2PzOKD/FoSL2UXTVPwtP 7RCgmh5YKuIfQnJu9EG+danjp8w6DEpR+7ptsQA652adIT/4H+J/8NCx5fVwIyaU4z3B 6UjU2e483voxuNS5Mk0JEUM/pssZIpyXprN7yQ1Wc5TPIM3yvU/pj4H6xH+lyLItfAPz h5bKGQjCdwlBq8pANySyScgsWwG7s+wa+7IyiY+UW5lIKBhM4/EcCXbJTRjD7QqGM85q 6gWA== X-Gm-Message-State: AJIora8veInh2XUtPABJW9iBmVZxyoX+evJ5JM1tIOsP7W2rO/V9iYzn wwCdv5Ulg+rQTOsvZp+RkUCUS5Hyt8w= X-Google-Smtp-Source: AGRyM1t9vZ23+yPgmIpqDR8YwUBjLiwOwGAb+CH1IqLMHL30r2AiK172aJsApEw1NkV6hWtfpGUrGw== X-Received: by 2002:a65:6cc8:0:b0:3fe:2b89:cc00 with SMTP id g8-20020a656cc8000000b003fe2b89cc00mr8386592pgw.599.1656007559256; Thu, 23 Jun 2022 11:05:59 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:05:58 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Alasdair Kergon , Mike Snitzer Subject: [PATCH 16/51] dm/kcopyd: Rename kcopyd_job.rw into kcopyd_job.op Date: Thu, 23 Jun 2022 11:04:53 -0700 Message-Id: <20220623180528.3595304-17-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The code that assigns kcopyd_job.rw to the bio.op member shows that it represents a request operation type (REQ_OP_). Rename kcopyd_job.rw into kcopyd_job.op to make this clear and only assign REQ_OP_* constants to that structure member. This patch does not change any functionality since REQ_OP_READ = READ = 0 and REQ_OP_WRITE = WRITE = 1. Cc: Alasdair Kergon Cc: Mike Snitzer Signed-off-by: Bart Van Assche --- drivers/md/dm-kcopyd.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c index 37b03ab7e5c9..a3d0d6ca95af 100644 --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c @@ -350,9 +350,9 @@ struct kcopyd_job { unsigned long write_err; /* - * Either READ or WRITE + * REQ_OP_READ, REQ_OP_WRITE or REQ_OP_WRITE_ZEROES. */ - int rw; + enum req_op op; struct dm_io_region source; /* @@ -418,7 +418,8 @@ static struct kcopyd_job *pop_io_job(struct list_head *jobs, * constraint and sequential writes that are at the right position. */ list_for_each_entry(job, jobs, list) { - if (job->rw == READ || !(job->flags & BIT(DM_KCOPYD_WRITE_SEQ))) { + if (job->op == REQ_OP_READ || + !(job->flags & BIT(DM_KCOPYD_WRITE_SEQ))) { list_del(&job->list); return job; } @@ -518,7 +519,7 @@ static void complete_io(unsigned long error, void *context) io_job_finish(kc->throttle); if (error) { - if (op_is_write(job->rw)) + if (op_is_write(job->op)) job->write_err |= error; else job->read_err = 1; @@ -530,11 +531,11 @@ static void complete_io(unsigned long error, void *context) } } - if (op_is_write(job->rw)) + if (op_is_write(job->op)) push(&kc->complete_jobs, job); else { - job->rw = WRITE; + job->op = REQ_OP_WRITE; push(&kc->io_jobs, job); } @@ -549,7 +550,7 @@ static int run_io_job(struct kcopyd_job *job) { int r; struct dm_io_request io_req = { - .bi_op = job->rw, + .bi_op = job->op, .bi_op_flags = 0, .mem.type = DM_IO_PAGE_LIST, .mem.ptr.pl = job->pages, @@ -571,7 +572,7 @@ static int run_io_job(struct kcopyd_job *job) io_job_start(job->kc->throttle); - if (job->rw == READ) + if (job->op == REQ_OP_READ) r = dm_io(&io_req, 1, &job->source, NULL); else r = dm_io(&io_req, job->num_dests, job->dests, NULL); @@ -614,7 +615,7 @@ static int process_jobs(struct list_head *jobs, struct dm_kcopyd_client *kc, if (r < 0) { /* error this rogue job */ - if (op_is_write(job->rw)) + if (op_is_write(job->op)) job->write_err = (unsigned long) -1L; else job->read_err = 1; @@ -817,7 +818,7 @@ void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from, if (from) { job->source = *from; job->pages = NULL; - job->rw = READ; + job->op = REQ_OP_READ; } else { memset(&job->source, 0, sizeof job->source); job->source.count = job->dests[0].count; @@ -826,10 +827,10 @@ void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from, /* * Use WRITE ZEROES to optimize zeroing if all dests support it. */ - job->rw = REQ_OP_WRITE_ZEROES; + job->op = REQ_OP_WRITE_ZEROES; for (i = 0; i < job->num_dests; i++) if (!bdev_write_zeroes_sectors(job->dests[i].bdev)) { - job->rw = WRITE; + job->op = REQ_OP_WRITE; break; } } From patchwork Thu Jun 23 18:04:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38304C433EF for ; Thu, 23 Jun 2022 19:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230506AbiFWTBE (ORCPT ); Thu, 23 Jun 2022 15:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231217AbiFWTAp (ORCPT ); Thu, 23 Jun 2022 15:00:45 -0400 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B6F7B98CC for ; Thu, 23 Jun 2022 11:06:01 -0700 (PDT) Received: by mail-pj1-f48.google.com with SMTP id 73-20020a17090a0fcf00b001eaee69f600so363117pjz.1 for ; Thu, 23 Jun 2022 11:06:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cQZuS5NSmETy81QNOdGqbEx+IHqMsFuFHyc7HngHx6U=; b=Ds73r0vnJCFHTqVncXfIV5rskGdwNNoyo7cuGvWDjaOmvHlW86eFQwVZAhLghHxBz2 TGL5GsXyd2Shoy+ExnHL7vrOGhkOO8ddnHWK3e9Q1wxOBmP6Ovg1xabYCFJSFyMagTil 30iDacHKaBWb0HyoDwVfnTkFBIbkajcbNZPRSe/b7wj3cv1+r2hTM0bxo86eyfmpJ/Dk Ko3tnpevIUsCO2g96enKkYw+u32WqUfW3rIZdAMeuHaH8lkTWJPdUM808KIVLdSOBdwg 7wzQqEGi3tvkxL1DbdF5sXTxD7q4qGtJso0lHOVLFVcmneVoR9JHk0xDdy3rm1UfFqQ/ zDHw== X-Gm-Message-State: AJIora86NzkI9ABtBJeEjfWc8T5SNwq3YyAUJqDO1Bcck7sRXsdZcIvl 7iUtzr2DE2uCodFeoU7Y8ts= X-Google-Smtp-Source: AGRyM1t6Zn/zSdvI/uR0PafaOwUDXWdlHJHv0q5bLFhrM997jpci68La+w01m+9QStvD5bk/8wcNsw== X-Received: by 2002:a17:902:f7cb:b0:169:c7d1:2a7 with SMTP id h11-20020a170902f7cb00b00169c7d102a7mr36313777plw.141.1656007561009; Thu, 23 Jun 2022 11:06:01 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:00 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Alasdair Kergon , Mike Snitzer , Heinz Mauelshagen Subject: [PATCH 17/51] dm/ebs: Change 'int rw' into 'enum req_op op' Date: Thu, 23 Jun 2022 11:04:54 -0700 Message-Id: <20220623180528.3595304-18-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using type 'enum req_op' instead of 'int'. Make the role of the 'rw' arguments more clear by renaming these into 'op' (operation). This patch does not change any functionality since REQ_OP_READ = READ = 0 and REQ_OP_WRITE = WRITE = 1. Cc: Alasdair Kergon Cc: Mike Snitzer Cc: Heinz Mauelshagen Signed-off-by: Bart Van Assche --- drivers/md/dm-ebs-target.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/md/dm-ebs-target.c b/drivers/md/dm-ebs-target.c index 0221fa63f888..223e8e1a7a13 100644 --- a/drivers/md/dm-ebs-target.c +++ b/drivers/md/dm-ebs-target.c @@ -61,7 +61,8 @@ static inline bool __ebs_check_bs(unsigned int bs) * * copy blocks between bufio blocks and bio vector's (partial/overlapping) pages. */ -static int __ebs_rw_bvec(struct ebs_c *ec, int rw, struct bio_vec *bv, struct bvec_iter *iter) +static int __ebs_rw_bvec(struct ebs_c *ec, enum req_op op, struct bio_vec *bv, + struct bvec_iter *iter) { int r = 0; unsigned char *ba, *pa; @@ -81,7 +82,7 @@ static int __ebs_rw_bvec(struct ebs_c *ec, int rw, struct bio_vec *bv, struct bv cur_len = min(dm_bufio_get_block_size(ec->bufio) - buf_off, bv_len); /* Avoid reading for writes in case bio vector's page overwrites block completely. */ - if (rw == READ || buf_off || bv_len < dm_bufio_get_block_size(ec->bufio)) + if (op == REQ_OP_READ || buf_off || bv_len < dm_bufio_get_block_size(ec->bufio)) ba = dm_bufio_read(ec->bufio, block, &b); else ba = dm_bufio_new(ec->bufio, block, &b); @@ -95,7 +96,7 @@ static int __ebs_rw_bvec(struct ebs_c *ec, int rw, struct bio_vec *bv, struct bv } else { /* Copy data to/from bio to buffer if read/new was successful above. */ ba += buf_off; - if (rw == READ) { + if (op == REQ_OP_READ) { memcpy(pa, ba, cur_len); flush_dcache_page(bv->bv_page); } else { @@ -117,14 +118,14 @@ static int __ebs_rw_bvec(struct ebs_c *ec, int rw, struct bio_vec *bv, struct bv } /* READ/WRITE: iterate bio vector's copying between (partial) pages and bufio blocks. */ -static int __ebs_rw_bio(struct ebs_c *ec, int rw, struct bio *bio) +static int __ebs_rw_bio(struct ebs_c *ec, enum req_op op, struct bio *bio) { int r = 0, rr; struct bio_vec bv; struct bvec_iter iter; bio_for_each_bvec(bv, bio, iter) { - rr = __ebs_rw_bvec(ec, rw, &bv, &iter); + rr = __ebs_rw_bvec(ec, op, &bv, &iter); if (rr) r = rr; } @@ -205,10 +206,10 @@ static void __ebs_process_bios(struct work_struct *ws) bio_list_for_each(bio, &bios) { r = -EIO; if (bio_op(bio) == REQ_OP_READ) - r = __ebs_rw_bio(ec, READ, bio); + r = __ebs_rw_bio(ec, REQ_OP_READ, bio); else if (bio_op(bio) == REQ_OP_WRITE) { write = true; - r = __ebs_rw_bio(ec, WRITE, bio); + r = __ebs_rw_bio(ec, REQ_OP_WRITE, bio); } else if (bio_op(bio) == REQ_OP_DISCARD) { __ebs_forget_bio(ec, bio); r = __ebs_discard_bio(ec, bio); From patchwork Thu Jun 23 18:04:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893062 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F33B4C43334 for ; Thu, 23 Jun 2022 19:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231320AbiFWTBF (ORCPT ); Thu, 23 Jun 2022 15:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbiFWTAp (ORCPT ); Thu, 23 Jun 2022 15:00:45 -0400 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A4ABB98D6 for ; Thu, 23 Jun 2022 11:06:03 -0700 (PDT) Received: by mail-pg1-f180.google.com with SMTP id 9so161235pgd.7 for ; Thu, 23 Jun 2022 11:06:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vcBryfIH3c3Mgb+xHjj15LSwFf469iz1YM+xVl2AH5k=; b=j6qshMR1rRLcjnPDJ4VBpzXBtbichqr97d/YoGSE6SOK8udonP/VsBLGkcWO1xqf3k mSg4d2NMxAZ8mxxVRng0qf7mQgegh6kVf6fOpVHQNuxIQCYi8EYykx/mwnR3P0K8Q2CB pao/V/hZG5jbbtD/ZXG/AL4cg00u60z2RgsBvBOXTb8wgaTZAV+T/pwqTywcBkOjfjo9 2Lse5hiZTqlmyRn1SHqWs5nntIFJxeRwprd3nlYKspHwnsZ7ECKXrJGYfcq6jQJOs3sD URx1PhqczXBFBD042gjgaPqNNfT1yLbyCAyy1YC0EoXJRzCy37NBqMeY9gT3CfXn+vBp pCAw== X-Gm-Message-State: AJIora/KdWEx3crPMeqJhCKx74Dtd1DmH2kU7egiFyWaa9gnWX4Bgt7P LbgwXQACpiIwEUPIxrU/z+2jM+LHJ9A= X-Google-Smtp-Source: AGRyM1uI8TzHtar6UBS+qJHdHLKjD7oX/BlP4IOhRcWvs3Kaw5GfcK56X6QtAKTkBhh44gKTEzUZdA== X-Received: by 2002:a63:82c3:0:b0:40d:3b63:a806 with SMTP id w186-20020a6382c3000000b0040d3b63a806mr6580305pgd.75.1656007562603; Thu, 23 Jun 2022 11:06:02 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:01 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Alasdair Kergon , Mike Snitzer Subject: [PATCH 18/51] dm/dm-flakey: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:04:55 -0700 Message-Id: <20220623180528.3595304-19-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Use the new blk_opf_t type for structure members that represent request flags. Cc: Alasdair Kergon Cc: Mike Snitzer Signed-off-by: Bart Van Assche --- drivers/md/dm-flakey.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c index f2305eb758a2..89fa7a68c6c4 100644 --- a/drivers/md/dm-flakey.c +++ b/drivers/md/dm-flakey.c @@ -32,7 +32,7 @@ struct flakey_c { unsigned corrupt_bio_byte; unsigned corrupt_bio_rw; unsigned corrupt_bio_value; - unsigned corrupt_bio_flags; + blk_opf_t corrupt_bio_flags; }; enum feature_flag_bits { @@ -145,7 +145,11 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc, /* * Only corrupt bios with these flags set. */ - r = dm_read_arg(_args + 3, as, &fc->corrupt_bio_flags, &ti->error); + BUILD_BUG_ON(sizeof(fc->corrupt_bio_flags) != + sizeof(unsigned int)); + r = dm_read_arg(_args + 3, as, + (__force unsigned *)&fc->corrupt_bio_flags, + &ti->error); if (r) return r; argc--; From patchwork Thu Jun 23 18:04:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F8C4CCA47C for ; Thu, 23 Jun 2022 19:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230198AbiFWTBF (ORCPT ); Thu, 23 Jun 2022 15:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231886AbiFWTAq (ORCPT ); Thu, 23 Jun 2022 15:00:46 -0400 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D92E1B98E0 for ; Thu, 23 Jun 2022 11:06:04 -0700 (PDT) Received: by mail-pl1-f171.google.com with SMTP id n10so1494280plp.0 for ; Thu, 23 Jun 2022 11:06:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=We+G/zalrauIq8lDvwmMOV2UeXfICQKgYcNFNeW0WE8=; b=e4c68kK7N7tcPC685rUg/aBT8+1ORPHOND4D8maO05zEpYrUzGslnr2GvHTLheHWAt 2LRGWK3BCbNHhUneXDc6yf8iTOYzTlnHQpI3/K63qB+Z07VacM5FnIUx47QIn0C0lMnk b+QyRD8cwAvMY5i3B22eswABXRBDGHshYM9SamNQOWehEHC7ZoSfM0sF5LcZGdvtd909 Ue+bUxYFBPBouif6RJwoliu25EnCyjwc7JQlvaqBhVHNXew/SV90aeTLpJnDA3w4qEiY fXHK3HoTKVC9afBlEKSNyIEz2O8NhNKR1IqcwoyXDqPD4DIlExpN3tReWwsMnIF94Gqw cIUw== X-Gm-Message-State: AJIora+J13A8B76KPrttw7gyjF/KzldDv5DPlVs/IdCw/jYIBpRxn2iV Iftyu34R2fW/glX1KIIei5g= X-Google-Smtp-Source: AGRyM1ufgFpYlAhg8BfxdgBSrPNszKFuBTrZyzN4zKM77WDLJfXtE8QLR3HYvGvcSAqW6nHk4xzCqQ== X-Received: by 2002:a17:90b:504:b0:1e6:a0a4:c823 with SMTP id r4-20020a17090b050400b001e6a0a4c823mr5346118pjz.190.1656007564322; Thu, 23 Jun 2022 11:06:04 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:03 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Alasdair Kergon , Mike Snitzer , Eric Biggers Subject: [PATCH 19/51] dm/dm-integrity: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:04:56 -0700 Message-Id: <20220623180528.3595304-20-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Alasdair Kergon Cc: Mike Snitzer Cc: Eric Biggers Signed-off-by: Bart Van Assche --- drivers/md/dm-integrity.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index 148978ad03a8..8bb0c7a88176 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -551,7 +551,8 @@ static int sb_mac(struct dm_integrity_c *ic, bool wr) return 0; } -static int sync_rw_sb(struct dm_integrity_c *ic, int op, int op_flags) +static int sync_rw_sb(struct dm_integrity_c *ic, enum req_op op, + blk_opf_t op_flags) { struct dm_io_request io_req; struct dm_io_region io_loc; @@ -1050,8 +1051,10 @@ static void complete_journal_io(unsigned long error, void *context) complete_journal_op(comp); } -static void rw_journal_sectors(struct dm_integrity_c *ic, int op, int op_flags, - unsigned sector, unsigned n_sectors, struct journal_completion *comp) +static void rw_journal_sectors(struct dm_integrity_c *ic, enum req_op op, + blk_opf_t op_flags, unsigned sector, + unsigned n_sectors, + struct journal_completion *comp) { struct dm_io_request io_req; struct dm_io_region io_loc; @@ -1096,7 +1099,8 @@ static void rw_journal_sectors(struct dm_integrity_c *ic, int op, int op_flags, } } -static void rw_journal(struct dm_integrity_c *ic, int op, int op_flags, unsigned section, +static void rw_journal(struct dm_integrity_c *ic, enum req_op op, + blk_opf_t op_flags, unsigned section, unsigned n_sections, struct journal_completion *comp) { unsigned sector, n_sectors; From patchwork Thu Jun 23 18:04:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893064 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AE9AC433EF for ; Thu, 23 Jun 2022 19:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229560AbiFWTBH (ORCPT ); Thu, 23 Jun 2022 15:01:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbiFWTAs (ORCPT ); Thu, 23 Jun 2022 15:00:48 -0400 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF56B8F9D for ; Thu, 23 Jun 2022 11:06:06 -0700 (PDT) Received: by mail-pj1-f41.google.com with SMTP id p3-20020a17090a428300b001ec865eb4a2so3363979pjg.3 for ; Thu, 23 Jun 2022 11:06:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TDQrp5hiicsBYoO4xA+zFz4qY0MpuwqxhJF2Y5bzmBs=; b=qPg7CqgbGVJtxrjK61XWnd/MqGlHCosgkdwvNXiBTW6TWFMi95eaToG3MJiIHwH9Wf 53lmu6jzoP+psf7qVcIRHH1ZuBiJiXf0hMEF/yYRYD6LL+PdMLtpsFzKONQs23pSSyNK 5vesDFEZtRB07TGzGlCXDz64IXpCqGEjjI8aD4O5SGKc5gyvbzbXMdMI0RNa1YY5LHP/ qN6zqgfNLuACKmD7qkMGuQYP3kZvmiRG8ZekbzzeBpvyUkiuEdF6T7w2hlYaP93UFJFN GuPbMh/RqUC9oLMLS8s3/cC1M+tc3WGXbrNV1IUrbFapqmnmzDkGXN6BFfH7g8FkhkLE uX+Q== X-Gm-Message-State: AJIora9NXuje8qw+61mgQtQ8VQUwm7Vz9+PU5Vb3lWqzj2d9T0rL6uCR rYHCFOXoCLVIw8ZqrtZvB6A= X-Google-Smtp-Source: AGRyM1tyOrFFgYtUR7vGjl8ebaGbAFLKR2VmNQHJ8NTkK/WzBDHd7WLcnVZ/r2I4HDuqxWPj3bFFhg== X-Received: by 2002:a17:90a:4749:b0:1e3:27a8:2e2a with SMTP id y9-20020a17090a474900b001e327a82e2amr5235409pjg.170.1656007565863; Thu, 23 Jun 2022 11:06:05 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:05 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Alasdair Kergon , Mike Snitzer Subject: [PATCH 20/51] dm/dm-snap: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:04:57 -0700 Message-Id: <20220623180528.3595304-21-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Alasdair Kergon Cc: Mike Snitzer Signed-off-by: Bart Van Assche --- drivers/md/dm-snap-persistent.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c index 3bb5cff5d6fc..e536f6be63b3 100644 --- a/drivers/md/dm-snap-persistent.c +++ b/drivers/md/dm-snap-persistent.c @@ -226,8 +226,8 @@ static void do_metadata(struct work_struct *work) /* * Read or write a chunk aligned and sized block of data from a device. */ -static int chunk_io(struct pstore *ps, void *area, chunk_t chunk, int op, - int op_flags, int metadata) +static int chunk_io(struct pstore *ps, void *area, chunk_t chunk, + enum req_op op, blk_opf_t op_flags, int metadata) { struct dm_io_region where = { .bdev = dm_snap_cow(ps->store->snap)->bdev, @@ -282,7 +282,7 @@ static void skip_metadata(struct pstore *ps) * Read or write a metadata area. Remembering to skip the first * chunk which holds the header. */ -static int area_io(struct pstore *ps, int op, int op_flags) +static int area_io(struct pstore *ps, enum req_op op, blk_opf_t op_flags) { chunk_t chunk = area_location(ps, ps->current_area); From patchwork Thu Jun 23 18:04:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95919C433EF for ; Thu, 23 Jun 2022 19:01:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231842AbiFWTBI (ORCPT ); Thu, 23 Jun 2022 15:01:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbiFWTAu (ORCPT ); Thu, 23 Jun 2022 15:00:50 -0400 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 274E1B98F6 for ; Thu, 23 Jun 2022 11:06:08 -0700 (PDT) Received: by mail-pf1-f180.google.com with SMTP id p14so306439pfh.6 for ; Thu, 23 Jun 2022 11:06:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oGk33Dk1rF6WoNxBb1iQ13uzHkxgsMyKqWnhk0peRfU=; b=eIrxhEuS06kNj3pFeZdaMJ15Fc9aomULLvLt5DzUi8VzxsOeFUukR3xTPtKzfzeoof Up7PFCOmBbxOuKNtxxhY3ZVPh2tDZoG4QP8BcOWJHWWLG1lyAYIGN8bKur7/LRM4n6f2 2BX2t9apRgeyZ1xAn7+1O/tVpQ4qRv9mbWSz7ehqVpHRgkPbZ04+IjBNIbzQgNNbb9JZ aMlot7NG/6IGS8SSXRqqYH/F0pKkQcOr5LWCUPHV2aiqG2Jsy9AxAY4XtKvwFnzrQUS3 my9v73R9/YtKKD/A1loK8rlgCSPWcylW5L1XULoUvBPKLR2s1roq/8SWn/cCEXx0MWz2 HiXw== X-Gm-Message-State: AJIora8iT/lzg1nakuCpGXB4mheN7i6yghTyEcggtVrE467IMq3v2b7a HRIJG54vpxdIAWTklidteUU= X-Google-Smtp-Source: AGRyM1vzBAffZYH4uPCuKV7hqRmsqSG6G9h2v9uwHoN3a2dNGvaDASqqH32Jayp9Y88yP50QSvJMYQ== X-Received: by 2002:a63:5108:0:b0:3fd:77f1:57a4 with SMTP id f8-20020a635108000000b003fd77f157a4mr8391076pgb.125.1656007567559; Thu, 23 Jun 2022 11:06:07 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:06 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Alasdair Kergon , Mike Snitzer , Damien Le Moal Subject: [PATCH 21/51] dm/dm-zoned: Use the enum req_op type Date: Thu, 23 Jun 2022 11:04:58 -0700 Message-Id: <20220623180528.3595304-22-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for arguments that represent a request operation. Cc: Alasdair Kergon Cc: Mike Snitzer Cc: Damien Le Moal Signed-off-by: Bart Van Assche Reviewed-by: Damien Le Moal --- drivers/md/dm-zoned-metadata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c index d1ea66114d14..9341c46e44b7 100644 --- a/drivers/md/dm-zoned-metadata.c +++ b/drivers/md/dm-zoned-metadata.c @@ -737,7 +737,7 @@ static int dmz_write_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk, /* * Read/write a metadata block. */ -static int dmz_rdwr_block(struct dmz_dev *dev, int op, +static int dmz_rdwr_block(struct dmz_dev *dev, enum req_op op, sector_t block, struct page *page) { struct bio *bio; From patchwork Thu Jun 23 18:04:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0283C43334 for ; Thu, 23 Jun 2022 19:01:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229676AbiFWTBL (ORCPT ); Thu, 23 Jun 2022 15:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbiFWTA7 (ORCPT ); Thu, 23 Jun 2022 15:00:59 -0400 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAD86A1E31 for ; Thu, 23 Jun 2022 11:06:09 -0700 (PDT) Received: by mail-pj1-f44.google.com with SMTP id g10-20020a17090a708a00b001ea8aadd42bso397230pjk.0 for ; Thu, 23 Jun 2022 11:06:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5jrCiQdokB8oLIJ21/NSzCXovkSx6x/n5GeFI5oMSnQ=; b=j5VScy3OoFpp/w9tj8aTfJfP4FnuJ2HYLNIdyA2kyJ1yTWxg1g+h2npml2/jRxhy8K ANyp5M7lx6082qzQRc5c/3tCU7ipVyujct7EvSUwLVgbd4AKewiCCko7sjhb1nICquLf ebcmKgKsF5+hekoqTx8/mNglleg8ZBpMZy9Eqs+aDrVeBtJg3ZxtErbzLTwMzakJVJHu G1k4BQIerSSsq1FlRn6sRP7gxyUZYGfQJrmJhGphgjUHaOQ2/dBmuwHB0pAkOG2eJ4sS x3ef921qO2qCbKApWBicoSlZFOzGIG6qv6aP6z8RH192/nT6C+wSbMrPFKD3FU0niICm DosQ== X-Gm-Message-State: AJIora/U9s4hBanK04Bjz8p0jeIoeWRoyehzhgV4KWqHt9XeucoDAPdg AHFEHT7YaPAje7QHvuwYc5TPfdwxcLs= X-Google-Smtp-Source: AGRyM1sOHAk6GTB2jospjBexLwXGDR6ofS8yO/ToQsG9vb4Bas2ZyOyFi+MYYT7ifvAOO0BIiR1GpQ== X-Received: by 2002:a17:902:7c0e:b0:16a:6ec:69e9 with SMTP id x14-20020a1709027c0e00b0016a06ec69e9mr32577427pll.108.1656007569158; Thu, 23 Jun 2022 11:06:09 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:08 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Song Liu Subject: [PATCH 22/51] md/core: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:04:59 -0700 Message-Id: <20220623180528.3595304-23-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Song Liu Signed-off-by: Bart Van Assche --- drivers/md/md.c | 3 ++- drivers/md/md.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index c7ecb0bffda0..d354faa95be7 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -993,7 +993,8 @@ int md_super_wait(struct mddev *mddev) } int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, - struct page *page, int op, int op_flags, bool metadata_op) + struct page *page, enum req_op op, blk_opf_t op_flags, + bool metadata_op) { struct bio bio; struct bio_vec bvec; diff --git a/drivers/md/md.h b/drivers/md/md.h index cf2cbb17acbd..f93bf7396d86 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -738,8 +738,8 @@ extern void md_super_write(struct mddev *mddev, struct md_rdev *rdev, sector_t sector, int size, struct page *page); extern int md_super_wait(struct mddev *mddev); extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, - struct page *page, int op, int op_flags, - bool metadata_op); + struct page *page, enum req_op op, blk_opf_t op_flags, + bool metadata_op); extern void md_do_sync(struct md_thread *thread); extern void md_new_event(void); extern void md_allow_write(struct mddev *mddev); From patchwork Thu Jun 23 18:05:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57967C433EF for ; Thu, 23 Jun 2022 19:01:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230487AbiFWTBM (ORCPT ); Thu, 23 Jun 2022 15:01:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbiFWTA7 (ORCPT ); Thu, 23 Jun 2022 15:00:59 -0400 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A2918858D for ; Thu, 23 Jun 2022 11:06:11 -0700 (PDT) Received: by mail-pl1-f178.google.com with SMTP id c4so2629850plc.8 for ; Thu, 23 Jun 2022 11:06:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zuhgZ0rXAW6rh8dAncL1seag6twZCavNh0PD870KD0M=; b=4XgntJxprHflewnWDBiQL4ZcenN98lQmD+KvU408rmr0P4UOEVEPhaJaj/MmLtXLGz SxMIG7G57loWricyge02xlBNuYL7+6cXWnJsVfIX6tf2wxW91keqUdge253Lw/8Q83Zp UBuBnR1mXC/um9efoZWEi7Lq9Cp5sGtNtk12Jqk6A46a8rsnmQkymvibHbfvkFTPNCHj ZDkcBhQfcnnd2W5dFRLV6Za57P0rp7Za5MTZ1Q2ukvjY9D8psIBDxvEiw7PamPpTKSKB RRRCbMtq6TqV+p9OePzx2tsXcbGQxaZxtKvWyiNc+1Uv/iAKcrJrixCMdY4TANWWL0oG BYew== X-Gm-Message-State: AJIora8PtJqQMztzajdKRWfXW8Ii0depvrC1VQbA+fQgmrddr3TPONFV YPBewnbeA+A8ZmqIykSGc4Q= X-Google-Smtp-Source: AGRyM1ufxTH/Ba4Dj/dZ77xQ9zVCsN+f10xECxabpV2mts3V+gEzpcwT3RnfmdpjMqjw2nG5komxqg== X-Received: by 2002:a17:902:f34a:b0:16a:e2d:3e9 with SMTP id q10-20020a170902f34a00b0016a0e2d03e9mr31043596ple.95.1656007570766; Thu, 23 Jun 2022 11:06:10 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:10 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Coly Li Subject: [PATCH 23/51] md/bcache: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:00 -0700 Message-Id: <20220623180528.3595304-24-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Coly Li Signed-off-by: Bart Van Assche --- drivers/md/bcache/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 3563d15dbaf2..93f18bae28cf 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -414,7 +414,7 @@ static void uuid_io_unlock(struct closure *cl) up(&c->uuid_write_mutex); } -static void uuid_io(struct cache_set *c, int op, unsigned long op_flags, +static void uuid_io(struct cache_set *c, enum req_op op, blk_opf_t op_flags, struct bkey *k, struct closure *parent) { struct closure *cl = &c->uuid_write; @@ -588,7 +588,7 @@ static void prio_endio(struct bio *bio) } static void prio_io(struct cache *ca, uint64_t bucket, int op, - unsigned long op_flags) + blk_opf_t op_flags) { struct closure *cl = &ca->prio; struct bio *bio = bch_bbio_alloc(ca->set); From patchwork Thu Jun 23 18:05:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E4A8CCA47F for ; Thu, 23 Jun 2022 19:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230170AbiFWTBN (ORCPT ); Thu, 23 Jun 2022 15:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbiFWTBA (ORCPT ); Thu, 23 Jun 2022 15:01:00 -0400 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93951B98F8 for ; Thu, 23 Jun 2022 11:06:12 -0700 (PDT) Received: by mail-pl1-f182.google.com with SMTP id m2so11564923plx.3 for ; Thu, 23 Jun 2022 11:06:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4Q602S72IjnxpqADwZEMgtbxEodM4Brb55UwO2z/frM=; b=aixw3GEvNfduFnoipNWgcxJCfGpCRgHngp2+3nJ6Nt7Sy7zfvSdd3JSgQWhf7eIx+l GTFUBOkibBMfc8Nlc00zVHKL5hXSWpVAQDI9Cpgvk/jdU4nRQUCpCa31tfThmemg2Qmp MK20tgbTIqSiJggA2YZv1c0EEE3xZcghkfaCZKqAlPSBCYkfpsDHS9C8K2aL0uWd4/O2 13jklS2IiVSeFXcKsNJLujzr/vKAoS5S2gx3GMSmPEZC5ReYsUdUWzBNOaBBpFVMWqXK htdRu+VrVTAksB8d3dZHtty2xojBeZCKUexfLF0Eb5aG9x8QPOTTL9ZLNP04NQA6grvC oe8g== X-Gm-Message-State: AJIora9xYGO15OWOKsgCIyvkRMfYBQeBh6daBpLyRb+NDRBRC2fIh1Jp bBDB0sT7ateFnMXiiq5SJA0= X-Google-Smtp-Source: AGRyM1tTD3dl/zUY0MuTB4BA611vmlkDU7bYeaspK17abZEMXTiWRI/wvpcidLe5zJSXn7vyBcZ8zw== X-Received: by 2002:a17:90b:3506:b0:1e8:8449:6acb with SMTP id ls6-20020a17090b350600b001e884496acbmr5221780pjb.27.1656007572060; Thu, 23 Jun 2022 11:06:12 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:11 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Song Liu Subject: [PATCH 24/51] md/raid1: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:01 -0700 Message-Id: <20220623180528.3595304-25-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the new blk_opf_t type for variables that represent request flags. Cc: Song Liu Signed-off-by: Bart Van Assche --- drivers/md/raid1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 258d4eb2d63c..63b3f70abbc3 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1221,7 +1221,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, struct bio *read_bio; struct bitmap *bitmap = mddev->bitmap; const int op = bio_op(bio); - const unsigned long do_sync = (bio->bi_opf & REQ_SYNC); + const blk_opf_t do_sync = bio->bi_opf & REQ_SYNC; int max_sectors; int rdisk; bool r1bio_existed = !!r1_bio; From patchwork Thu Jun 23 18:05:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 175B3C43334 for ; Thu, 23 Jun 2022 19:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230235AbiFWTBO (ORCPT ); Thu, 23 Jun 2022 15:01:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231830AbiFWTBB (ORCPT ); Thu, 23 Jun 2022 15:01:01 -0400 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C2AB8858A for ; Thu, 23 Jun 2022 11:06:14 -0700 (PDT) Received: by mail-pj1-f54.google.com with SMTP id h9-20020a17090a648900b001ecb8596e43so328735pjj.5 for ; Thu, 23 Jun 2022 11:06:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6kTj2GXVNl7+zFYPFnYZPqnF36iK5I7RBbvm/rOsyNU=; b=v0QJR26Mvt2Cjjw3OmL0/Yf2DDyV1v7I3ST6kvrHg1O3qMtnirG9/lNiMofg7AnMFd FsfCBtWAt/txbmtlIhbZYhsHoExaNl09xaAZR79I61YHTyyiWmUhhOY80BtdAfu6PSNn dwQ5mH80l0iN2snCIgfp878YKDI/eYyPwG5qC5qyoIf6cyskcL5h2TXtcUs4icyNw+lU 6n5xa8aPPHykZ4K0Kk0GCOlJ7R5eIYAaKiHtZ/qTiAGTU4vZceSyZVbpomSfm2nDrV+q XsNVzwc80VlSa0Ueqs24IcMZ4wuLf4Tewj2ttekQOCLYJhxpbQB5eGgeKFqHSgqA6F6F 0iRA== X-Gm-Message-State: AJIora+Z8/KSU0SiKOL5SIHoiJYyT4WbmOlowb+kvgv9i6Euom31FqpF jsKKK42AncU9H2UGsEEd7dW/6hAKeG8= X-Google-Smtp-Source: AGRyM1tkJupTi6C6eLcTx6wZEiMlFWC/ljZzBA6DIWRzX6BLFXUiZyUPuJkAxZTb9YDXXAgEk1PK2g== X-Received: by 2002:a17:902:f688:b0:163:ee37:91c5 with SMTP id l8-20020a170902f68800b00163ee3791c5mr41312907plg.86.1656007573693; Thu, 23 Jun 2022 11:06:13 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:12 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Song Liu Subject: [PATCH 25/51] md/raid10: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:02 -0700 Message-Id: <20220623180528.3595304-26-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the new blk_opf_t type for variables that represent a request flags. Cc: Song Liu Signed-off-by: Bart Van Assche --- drivers/md/raid10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index d589f823feb1..649635e04e38 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1137,7 +1137,7 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, struct r10conf *conf = mddev->private; struct bio *read_bio; const int op = bio_op(bio); - const unsigned long do_sync = (bio->bi_opf & REQ_SYNC); + const blk_opf_t do_sync = bio->bi_opf & REQ_SYNC; int max_sectors; struct md_rdev *rdev; char b[BDEVNAME_SIZE]; @@ -1231,8 +1231,8 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio, int n_copy) { const int op = bio_op(bio); - const unsigned long do_sync = (bio->bi_opf & REQ_SYNC); - const unsigned long do_fua = (bio->bi_opf & REQ_FUA); + const blk_opf_t do_sync = bio->bi_opf & REQ_SYNC; + const blk_opf_t do_fua = bio->bi_opf & REQ_FUA; unsigned long flags; struct blk_plug_cb *cb; struct raid1_plug_cb *plug = NULL; From patchwork Thu Jun 23 18:05:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A8A3C433EF for ; Thu, 23 Jun 2022 19:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbiFWTBP (ORCPT ); Thu, 23 Jun 2022 15:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231838AbiFWTBB (ORCPT ); Thu, 23 Jun 2022 15:01:01 -0400 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6EBA10CD3D for ; Thu, 23 Jun 2022 11:06:15 -0700 (PDT) Received: by mail-pl1-f178.google.com with SMTP id c4so2629850plc.8 for ; Thu, 23 Jun 2022 11:06:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=knKlLEHn8hCQZqUlhnKOmaPVcm9Kj1Qvvc0B3u5dn7k=; b=gMiy3BcB74D/vlnXXFd9f7FnQMXyftmTm/UdUP4Ty9TIJzn3EhexQJz6C3WkCpJFX1 JcDXk5jPdNtQULm962jFmaWYMxrJskt4GCvSbdwNEvvICcAmAvr4Kmtym7DOOGHvyscB jBjCUfli+iCAX+wuIpFwcFdfsU0B8c/ryjA38zntwpVl3ra34pdkLfrNesbfHLzXY9cG z69fhHu6Me/z5AZ7CKiAdrTvLVWVk9T+2oIrqQIpKCel8gNmpT0vEgHSLneQs4p5H9RX PY2S/6bR4fZCLYBvDso1j57N24IbBXuCFe6O9KKnSuroT7Xi8Cvv+aOVQl6iiBsU0O3S oZWQ== X-Gm-Message-State: AJIora/pBb4e9jeQCLzG3846Ba6LF8yXDlDpba3obtiAjw13IEE7N3M6 1fvTft02mZAPkpqdg1LUI94Pj//8mc4= X-Google-Smtp-Source: AGRyM1tSUSrwG2L1MiP3cVPUMGE/LaPCVISebC4m3AEZI/A5+T0QGQpbwVRhh1MK3gutcW1fTZZLAg== X-Received: by 2002:a17:902:d4cf:b0:16a:3027:b286 with SMTP id o15-20020a170902d4cf00b0016a3027b286mr17447968plg.142.1656007575319; Thu, 23 Jun 2022 11:06:15 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:14 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Song Liu Subject: [PATCH 26/51] md/raid5: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:03 -0700 Message-Id: <20220623180528.3595304-27-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Song Liu Signed-off-by: Bart Van Assche --- drivers/md/raid5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 5d09256d7f81..b11d8b6a2dc2 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -1082,7 +1082,8 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) should_defer = conf->batch_bio_dispatch && conf->group_cnt; for (i = disks; i--; ) { - int op, op_flags = 0; + enum req_op op; + blk_opf_t op_flags = 0; int replace_only = 0; struct bio *bi, *rbi; struct md_rdev *rdev, *rrdev = NULL; @@ -5896,7 +5897,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) (unsigned long long)logical_sector); sh = raid5_get_active_stripe(conf, new_sector, previous, - (bi->bi_opf & REQ_RAHEAD), 0); + !!(bi->bi_opf & REQ_RAHEAD), 0); if (sh) { if (unlikely(previous)) { /* expansion might have moved on while waiting for a From patchwork Thu Jun 23 18:05:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EA4FCCA480 for ; Thu, 23 Jun 2022 19:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230450AbiFWTBP (ORCPT ); Thu, 23 Jun 2022 15:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232012AbiFWTBD (ORCPT ); Thu, 23 Jun 2022 15:01:03 -0400 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DDA113B for ; Thu, 23 Jun 2022 11:06:17 -0700 (PDT) Received: by mail-pj1-f44.google.com with SMTP id g10-20020a17090a708a00b001ea8aadd42bso397230pjk.0 for ; Thu, 23 Jun 2022 11:06:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nPiIisWhrYnmyGWGAYEgmzeS55+iM33aJpih0eJ3hLk=; b=Zmfzo5vlf6qx2MFwmN48sbYHjtyqxd3eVb/6r8PH2glKDE0okz1umK1gr7fa1pmNDq hn44F4AsuCQ6iBz203MO/afe+BtqROwHxpU6fHok/tuPZBrDNNnewopMeeRt5nM4HINe 40yZK6L+yCe+N2bc+O5ovh1HV9Oa686e7ufFYy2hH6McAVagWUAd1YSG6zBlK8hkjY6j QgLXWOTY/HSVkexauy5TJjgkXIO3eznx0np9/fXOazbwMaZGSeojjO/kBR4pE2WoB46f XSF1LmzcbqNoz9x3RPneF2PYCTQG21qMThNlDFP0EZ4l0iFO4Q1b+8Zd22LNHoo169Pp byMg== X-Gm-Message-State: AJIora+qizyfz5msC8v+XB4KneMB3Ao4qz1yVN5S7V0s7l8Co+Vi4gkf hC/9fo7WkFxpDFAecxdJf1M= X-Google-Smtp-Source: AGRyM1tgc/AVS4LJH3As739nMsZIbl8TeefkCnXpkBgmcBmGPuiv2HczH9M94080nbP9pqec9JgImw== X-Received: by 2002:a17:90a:2e02:b0:1ea:c661:7507 with SMTP id q2-20020a17090a2e0200b001eac6617507mr5235072pjd.133.1656007576914; Thu, 23 Jun 2022 11:06:16 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:16 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Keith Busch , Sagi Grimberg Subject: [PATCH 27/51] nvme/host: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:04 -0700 Message-Id: <20220623180528.3595304-28-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Christoph Hellwig Cc: Keith Busch Cc: Sagi Grimberg Signed-off-by: Bart Van Assche Reviewed-by: Sagi Grimberg --- drivers/nvme/host/ioctl.c | 4 ++-- drivers/nvme/host/nvme.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index a2e89db1cd63..27614bee7380 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -68,7 +68,7 @@ static struct request *nvme_alloc_user_request(struct request_queue *q, struct nvme_command *cmd, void __user *ubuffer, unsigned bufflen, void __user *meta_buffer, unsigned meta_len, u32 meta_seed, void **metap, unsigned timeout, bool vec, - unsigned int rq_flags, blk_mq_req_flags_t blk_flags) + blk_opf_t rq_flags, blk_mq_req_flags_t blk_flags) { bool write = nvme_is_write(cmd); struct nvme_ns *ns = q->queuedata; @@ -407,7 +407,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns, struct nvme_uring_data d; struct nvme_command c; struct request *req; - unsigned int rq_flags = 0; + blk_opf_t rq_flags = 0; blk_mq_req_flags_t blk_flags = 0; void *meta = NULL; diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 0da94b233fed..ac9753674d5d 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -733,7 +733,7 @@ void nvme_wait_freeze(struct nvme_ctrl *ctrl); int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); void nvme_start_freeze(struct nvme_ctrl *ctrl); -static inline unsigned int nvme_req_op(struct nvme_command *cmd) +static inline enum req_op nvme_req_op(struct nvme_command *cmd) { return nvme_is_write(cmd) ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN; } From patchwork Thu Jun 23 18:05:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893072 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7926C433EF for ; Thu, 23 Jun 2022 19:01:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231838AbiFWTBR (ORCPT ); Thu, 23 Jun 2022 15:01:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232020AbiFWTBF (ORCPT ); Thu, 23 Jun 2022 15:01:05 -0400 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09AFA10E64E for ; Thu, 23 Jun 2022 11:06:19 -0700 (PDT) Received: by mail-pl1-f178.google.com with SMTP id c4so2629850plc.8 for ; Thu, 23 Jun 2022 11:06:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XJ/sGb3XCWvOZL3qB6wyTMEmWtH7m2nEWJDejHsFgow=; b=agLaak4HV2sp0t3t0d8Dvrlhh/zT5/XDpuI/DqKICs2u/Yk2xtwgppgBy6MUqpe/R5 myLYNpocrmIRwmoNZJm5DXgushQVhxmuasBxZGyBSPJYworvCo67G9QzE20T3E44AS9h iv4vTmR8Bh5bK77j9jojB5BnTzv8wBuEiZ1f8GYYLpo0CJ7sZbYWwAiTY7glPB8VYv9E Lcu0wDyTQr3IfgQgZtZlhjdpU+DdXRD+/wIY0M7GVxONPvcLw5q0BVQTNg7rRxFtPVxF 8GTI89zcIu6SnybSpv1RPiFsaxHm4mW03v5ByHa/9TEzM0HMLfNCkORITpxDeJk+BsQY Cfmg== X-Gm-Message-State: AJIora/VLqYq/Qa+dTAwi9C2gvuEJckfxetOL3u2oii6gfBx5+KP+5l1 MJKhrXeh7uTjG4sL1W34FqNvDUAIBpg= X-Google-Smtp-Source: AGRyM1ucaitJsUNXBveRefrZ+IgyKLhnXp216Irm/sIZWm1Q2dykhFqe2w3rsNXVd/6bGC5rSy+zOQ== X-Received: by 2002:a17:90b:3849:b0:1e8:7f47:5dcd with SMTP id nl9-20020a17090b384900b001e87f475dcdmr5136891pjb.61.1656007578668; Thu, 23 Jun 2022 11:06:18 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:17 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Sagi Grimberg , Chaitanya Kulkarni Subject: [PATCH 28/51] nvme/target: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:05 -0700 Message-Id: <20220623180528.3595304-29-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the new blk_opf_t type for variables that represent a request operation combined with request flags. Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Chaitanya Kulkarni Signed-off-by: Bart Van Assche Reviewed-by: Sagi Grimberg --- drivers/nvme/target/io-cmd-bdev.c | 3 ++- drivers/nvme/target/zns.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c index 27a72504d31c..306d97b3840f 100644 --- a/drivers/nvme/target/io-cmd-bdev.c +++ b/drivers/nvme/target/io-cmd-bdev.c @@ -246,7 +246,8 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req) struct scatterlist *sg; struct blk_plug plug; sector_t sector; - int op, i, rc; + blk_opf_t op; + int i, rc; struct sg_mapping_iter prot_miter; unsigned int iter_flags; unsigned int total_len = nvmet_rw_data_len(req) + req->metadata_len; diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c index 62afb7936132..c5e315d57d60 100644 --- a/drivers/nvme/target/zns.c +++ b/drivers/nvme/target/zns.c @@ -525,7 +525,7 @@ static void nvmet_bdev_zone_append_bio_done(struct bio *bio) void nvmet_bdev_execute_zone_append(struct nvmet_req *req) { sector_t sect = nvmet_lba_to_sect(req->ns, req->cmd->rw.slba); - const unsigned int op = REQ_OP_ZONE_APPEND | REQ_SYNC | REQ_IDLE; + const blk_opf_t op = REQ_OP_ZONE_APPEND | REQ_SYNC | REQ_IDLE; u16 status = NVME_SC_SUCCESS; unsigned int total_len = 0; struct scatterlist *sg; From patchwork Thu Jun 23 18:05:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893073 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 315A1C43334 for ; Thu, 23 Jun 2022 19:01:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231781AbiFWTBT (ORCPT ); Thu, 23 Jun 2022 15:01:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231779AbiFWTBG (ORCPT ); Thu, 23 Jun 2022 15:01:06 -0400 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D15F310E654 for ; Thu, 23 Jun 2022 11:06:20 -0700 (PDT) Received: by mail-pj1-f45.google.com with SMTP id d14so334155pjs.3 for ; Thu, 23 Jun 2022 11:06:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gN4bfvORSKJmj2cEmic3OBJkZeLF1uahbAz0Y3BxY0k=; b=6X+NpM/8g09nxbRpdcQ3s1p5JA7BZR1jx0+rXwmwWwun7SYWe7XBnlutWciTdPPqe4 ywImYovF7lcvDej4kHH0sqthfikwtj2wVCyn09od4TNQQk3b7fUanJE9Kth1ZQjwnc14 nez7comHROpqay8UB7Mt+qOkFNeFRm672lHVHHK5ezLKKZMLp2YcqQieGQd5UVaWNXn2 g9h8ERs6ZYKhe5/Bg3+DNVu1Rgic66MwUBt8k77mDAnYXLNJlDN7HCduNbUS6DB1USpb r7tL3OrUoBzD5p/lPNVbGAMZZU9qRduYS9zvJlbbgNNTTX/B8431PjWPDwZyw5XRX2nZ gL2A== X-Gm-Message-State: AJIora+v2YY+Fil41/1bESVDhtW3aTuGznXvGuSkXaNnam1cnHXBrxZu 8mdJ0nSQZinPmUt588MEh87F/WW7U4E= X-Google-Smtp-Source: AGRyM1utKMN1cClDIJr8Cf+Mreb0Nix0XVrNePm9gMTuakD3IEx0Dim9C9hXx+UaKUKHQAOS4QMkUQ== X-Received: by 2002:a17:902:d292:b0:16a:2a8d:616e with SMTP id t18-20020a170902d29200b0016a2a8d616emr19379555plc.5.1656007580236; Thu, 23 Jun 2022 11:06:20 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:19 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Martin K . Petersen" , John Garry , Mike Christie Subject: [PATCH 29/51] scsi/core: Improve static type checking Date: Thu, 23 Jun 2022 11:05:06 -0700 Message-Id: <20220623180528.3595304-30-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using enum req_op where appropriate. Cc: Martin K. Petersen Cc: John Garry Cc: Mike Christie Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_lib.c | 4 ++-- include/scsi/scsi_cmnd.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 6ffc9e4258a8..6b6a7a4b0950 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1125,8 +1125,8 @@ static void scsi_initialize_rq(struct request *rq) cmd->retries = 0; } -struct request *scsi_alloc_request(struct request_queue *q, - unsigned int op, blk_mq_req_flags_t flags) +struct request *scsi_alloc_request(struct request_queue *q, enum req_op op, + blk_mq_req_flags_t flags) { struct request *rq; diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 1e80e70dfa92..6df0af7dd508 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -387,6 +387,6 @@ extern void scsi_build_sense(struct scsi_cmnd *scmd, int desc, u8 key, u8 asc, u8 ascq); struct request *scsi_alloc_request(struct request_queue *q, - unsigned int op, blk_mq_req_flags_t flags); + enum req_op op, blk_mq_req_flags_t flags); #endif /* _SCSI_SCSI_CMND_H */ From patchwork Thu Jun 23 18:05:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79480CCA47F for ; Thu, 23 Jun 2022 19:01:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231799AbiFWTBT (ORCPT ); Thu, 23 Jun 2022 15:01:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231843AbiFWTBH (ORCPT ); Thu, 23 Jun 2022 15:01:07 -0400 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72CC610E65B for ; Thu, 23 Jun 2022 11:06:22 -0700 (PDT) Received: by mail-pj1-f46.google.com with SMTP id f16so359681pjj.1 for ; Thu, 23 Jun 2022 11:06:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TraJCwU51nOTrBB3rdN7pOVK5aie3yl6MvtfDVDMn3k=; b=l/Y/y/Jo/0N3y/w6TdWGgLCH9Y6+T68SYlxoNYsYGOLMeZVmaMSXvD9rBG34wX6B2i QaHDfscVgilnVfS24EAmAVLAbQgnucoNCljAOhKDEMBBhI0BJ7oAsK7cGhSillQYapIN FPiroXpR6O9l+BLT9f22yTjYHRGO1DQNUEmYz10zmcns/qWapVo31Ql65aiOzCRs4pnI urBHnjXxndNq0ODqNE0KODR89ui7qepAJZUGVJNVimdYOvEVxVM30ASCZ6vOwTwDWS6D GKBwH4NZaV0ff7k6DwpshbJr+mnsWl4zVOO9AXdAVz9zqL9O9WVn01g99SIMnXesXPjS Z0jQ== X-Gm-Message-State: AJIora/W3vnNwj1Csj0ycclUZkxdqElWHE+q5pfwfThXY5wLsvKTgCPD caaR3KSydyvUnZk6hUwER/I= X-Google-Smtp-Source: AGRyM1vrEkBc42g4wfDDDiN0d4OmxJ15w9u96fjf/P1MbtrhvTdliRPUGodcXOIAeN+k9b0o3e/pkw== X-Received: by 2002:a17:90b:1d06:b0:1ec:cd94:539b with SMTP id on6-20020a17090b1d0600b001eccd94539bmr5128394pjb.215.1656007581733; Thu, 23 Jun 2022 11:06:21 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:21 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Martin K . Petersen" , John Garry , Mike Christie Subject: [PATCH 30/51] scsi/core: Change the return type of scsi_noretry_cmd() into bool Date: Thu, 23 Jun 2022 11:05:07 -0700 Message-Id: <20220623180528.3595304-31-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This patch prepares for introducing the new blk_opf_t type in the SCSI core. Since the value returned by scsi_noretry_cmd() is only used in boolean expressions, this patch does not change any functionality. Cc: Martin K. Petersen Cc: John Garry Cc: Mike Christie Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_error.c | 10 +++++----- drivers/scsi/scsi_priv.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 49ef864df581..60bcb37acafd 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1779,7 +1779,7 @@ static void scsi_eh_offline_sdevs(struct list_head *work_q, * scsi_noretry_cmd - determine if command should be failed fast * @scmd: SCSI cmd to examine. */ -int scsi_noretry_cmd(struct scsi_cmnd *scmd) +bool scsi_noretry_cmd(struct scsi_cmnd *scmd) { struct request *req = scsi_cmd_to_rq(scmd); @@ -1794,14 +1794,14 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd) return req->cmd_flags & REQ_FAILFAST_DEV; case DID_ERROR: if (get_status_byte(scmd) == SAM_STAT_RESERVATION_CONFLICT) - return 0; + return false; fallthrough; case DID_SOFT_ERROR: return req->cmd_flags & REQ_FAILFAST_DRIVER; } if (!scsi_status_is_check_condition(scmd->result)) - return 0; + return false; check_type: /* @@ -1809,9 +1809,9 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd) * the check condition was retryable. */ if (req->cmd_flags & REQ_FAILFAST_DEV || blk_rq_is_passthrough(req)) - return 1; + return true; - return 0; + return false; } /** diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index 5c4786310a31..90fbffca7eb0 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -82,7 +82,7 @@ void scsi_eh_ready_devs(struct Scsi_Host *shost, struct list_head *done_q); int scsi_eh_get_sense(struct list_head *work_q, struct list_head *done_q); -int scsi_noretry_cmd(struct scsi_cmnd *scmd); +bool scsi_noretry_cmd(struct scsi_cmnd *scmd); void scsi_eh_done(struct scsi_cmnd *scmd); /* scsi_lib.c */ From patchwork Thu Jun 23 18:05:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21155C43334 for ; Thu, 23 Jun 2022 19:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232020AbiFWTBU (ORCPT ); Thu, 23 Jun 2022 15:01:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbiFWTBI (ORCPT ); Thu, 23 Jun 2022 15:01:08 -0400 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D1D210E65F for ; Thu, 23 Jun 2022 11:06:24 -0700 (PDT) Received: by mail-pf1-f180.google.com with SMTP id 128so278471pfv.12 for ; Thu, 23 Jun 2022 11:06:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8ec/YeJokhE0PwfOH5Ta6a/JptpB65lHBo+E6SkP32s=; b=b64K6PFlFS+oXWmE63k0LvUCpAtDuCQjHqFNHQVCJJshqgINqv55DTUHLOy4jb061b R0FfBKaGNaCrB2Y9qGipHY0dWqudi75+hywq6vrnHZFI8TuP2tyTUaLAwDBCzujjZrwx ZyxiOtmW8xQhbJ4I2FFM6E68KXw3D0uxawoRoaqgZNzaCcsUbDUmS6gO7zmRZK9OfxWZ y8M+hpTJv6PI5H5q5EevGEDGlAOR8B/8Gv9SVx6yAPhifTfi0XhqVKZdtKP4FHU9muRD k2WN2ZsmecF+BYW8TE5c0kDAAreqNU3SkxxR1/Byrx5GM8q4fNthwZ5837XzmIvBH1sY k2OQ== X-Gm-Message-State: AJIora9z0EP6ngAUF/atTi+Ap7OLDxmuCbBpb4BBVjrKxepd2ZTEAXdY ugARyhmqNzK42LDcfi2yh4o= X-Google-Smtp-Source: AGRyM1v8K5h7oPzlU4UvhBPQBbUG8gSEmXSXciDXi7/8VHEtjhgEpLPrFOCHL61I6KBkOubhHkV77Q== X-Received: by 2002:a63:fc63:0:b0:405:34ac:920d with SMTP id r35-20020a63fc63000000b0040534ac920dmr8709424pgk.40.1656007583384; Thu, 23 Jun 2022 11:06:23 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:22 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Martin K . Petersen" , John Garry , Mike Christie Subject: [PATCH 31/51] scsi/core: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:08 -0700 Message-Id: <20220623180528.3595304-32-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Use the new blk_opf_t type for arguments and variables that represent request flags. Use the !! operator in scsi_noretry_cmd() to convert the blk_opf_t type into a boolean. This patch does not change any functionality. Cc: Martin K. Petersen Cc: John Garry Cc: Mike Christie Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_error.c | 6 +++--- drivers/scsi/scsi_lib.c | 6 +++--- include/scsi/scsi_device.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 60bcb37acafd..4b8686162ddd 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1789,15 +1789,15 @@ bool scsi_noretry_cmd(struct scsi_cmnd *scmd) case DID_TIME_OUT: goto check_type; case DID_BUS_BUSY: - return req->cmd_flags & REQ_FAILFAST_TRANSPORT; + return !!(req->cmd_flags & REQ_FAILFAST_TRANSPORT); case DID_PARITY: - return req->cmd_flags & REQ_FAILFAST_DEV; + return !!(req->cmd_flags & REQ_FAILFAST_DEV); case DID_ERROR: if (get_status_byte(scmd) == SAM_STAT_RESERVATION_CONFLICT) return false; fallthrough; case DID_SOFT_ERROR: - return req->cmd_flags & REQ_FAILFAST_DRIVER; + return !!(req->cmd_flags & REQ_FAILFAST_DRIVER); } if (!scsi_status_is_check_condition(scmd->result)) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 6b6a7a4b0950..beff0015258a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -209,8 +209,8 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, struct scsi_sense_hdr *sshdr, - int timeout, int retries, u64 flags, req_flags_t rq_flags, - int *resid) + int timeout, int retries, blk_opf_t flags, + req_flags_t rq_flags, int *resid) { struct request *req; struct scsi_cmnd *scmd; @@ -633,7 +633,7 @@ static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result) */ static unsigned int scsi_rq_err_bytes(const struct request *rq) { - unsigned int ff = rq->cmd_flags & REQ_FAILFAST_MASK; + blk_opf_t ff = rq->cmd_flags & REQ_FAILFAST_MASK; unsigned int bytes = 0; struct bio *bio; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 7cf5f3b7589f..2493bd65351a 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -457,7 +457,7 @@ extern void scsi_sanitize_inquiry_string(unsigned char *s, int len); extern int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, struct scsi_sense_hdr *sshdr, - int timeout, int retries, u64 flags, + int timeout, int retries, blk_opf_t flags, req_flags_t rq_flags, int *resid); /* Make sure any sense buffer is the correct size. */ #define scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \ From patchwork Thu Jun 23 18:05:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893076 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3AB9CCA480 for ; Thu, 23 Jun 2022 19:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231955AbiFWTBV (ORCPT ); Thu, 23 Jun 2022 15:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231860AbiFWTBI (ORCPT ); Thu, 23 Jun 2022 15:01:08 -0400 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31BCC10E65A for ; Thu, 23 Jun 2022 11:06:25 -0700 (PDT) Received: by mail-pl1-f178.google.com with SMTP id c4so2629850plc.8 for ; Thu, 23 Jun 2022 11:06:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E+7fz1kpwun+FM+ENLhLC8EM6umBuEasV+oUHoRPE00=; b=73xQaq6z6uDDsmI43UXakycA1afFAd59QDJWI9wDvKBpe7ibzlmyvunIItXG6/8HwA IkxsZlVeMpJ+LdKITvxLRaUCi3BDkZwxd1vDIBoJheNs5YrT1qqlh1IEwsEN72oaSfCk /aUW8rvtkDPZeB7sbdgqFkC03YtdfPV4qzILZ14TziLRNLAZkqza0GFDAgmA6hlqDfbj dVuwCi30+wwrneE+H9vii8pEOeN2DXAoI70IgfzHFKtt2rwpeGbEQTTgiBVje1piJElY Xx8dOMhzQxOe7sXdNDVj4iap+r543mK8/LXS1VjV40vdTeuRdV8i8AolKygy2M2esI6P MbpA== X-Gm-Message-State: AJIora+4WjVTgu3GcRNUfjlzzb7qHwhEGiwCUa0OdsVODmUM/wXAFxJS lI+pBBBvp/MT7MPZuZsSGXk= X-Google-Smtp-Source: AGRyM1tXqEFpDPEo2draovkPUEFsova4X6QqPjqwZTktQlBJRzBw/EGm8BhHWMDir0iAiX7qf2XWEg== X-Received: by 2002:a17:903:18a:b0:16a:612f:c9da with SMTP id z10-20020a170903018a00b0016a612fc9damr2050192plg.174.1656007584780; Thu, 23 Jun 2022 11:06:24 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:24 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Hannes Reinecke Subject: [PATCH 32/51] scsi/device_handlers: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:09 -0700 Message-Id: <20220623180528.3595304-33-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the new blk_opf_t type for variables that represent request flags. Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/scsi/device_handler/scsi_dh_alua.c | 4 ++-- drivers/scsi/device_handler/scsi_dh_emc.c | 2 +- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 4 ++-- drivers/scsi/device_handler/scsi_dh_rdac.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 1d9be771f3ee..610a51538f03 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -127,7 +127,7 @@ static int submit_rtpg(struct scsi_device *sdev, unsigned char *buff, int bufflen, struct scsi_sense_hdr *sshdr, int flags) { u8 cdb[MAX_COMMAND_SIZE]; - int req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | + blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; /* Prepare the command. */ @@ -157,7 +157,7 @@ static int submit_stpg(struct scsi_device *sdev, int group_id, u8 cdb[MAX_COMMAND_SIZE]; unsigned char stpg_data[8]; int stpg_len = 8; - int req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | + blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; /* Prepare the data buffer */ diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c index bd28ec6cfb72..2e21ab447873 100644 --- a/drivers/scsi/device_handler/scsi_dh_emc.c +++ b/drivers/scsi/device_handler/scsi_dh_emc.c @@ -239,7 +239,7 @@ static int send_trespass_cmd(struct scsi_device *sdev, unsigned char cdb[MAX_COMMAND_SIZE]; int err, res = SCSI_DH_OK, len; struct scsi_sense_hdr sshdr; - u64 req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | + blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; if (csdev->flags & CLARIION_SHORT_TRESPASS) { diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 4a3f7831a2d6..0d2cfa60aa06 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -83,7 +83,7 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) unsigned char cmd[6] = { TEST_UNIT_READY }; struct scsi_sense_hdr sshdr; int ret = SCSI_DH_OK, res; - u64 req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | + blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; retry: @@ -121,7 +121,7 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) struct scsi_device *sdev = h->sdev; int res, rc = SCSI_DH_OK; int retry_cnt = HP_SW_RETRIES; - u64 req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | + blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; retry: diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index 66652ab409cc..bf8754741f85 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -536,7 +536,7 @@ static void send_mode_select(struct work_struct *work) unsigned char cdb[MAX_COMMAND_SIZE]; struct scsi_sense_hdr sshdr; unsigned int data_size; - u64 req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | + blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; spin_lock(&ctlr->ms_lock); From patchwork Thu Jun 23 18:05:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AEF1C433EF for ; Thu, 23 Jun 2022 19:01:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231700AbiFWTBX (ORCPT ); Thu, 23 Jun 2022 15:01:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232009AbiFWTBK (ORCPT ); Thu, 23 Jun 2022 15:01:10 -0400 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14D1F10E664 for ; Thu, 23 Jun 2022 11:06:27 -0700 (PDT) Received: by mail-pl1-f169.google.com with SMTP id r1so18807623plo.10 for ; Thu, 23 Jun 2022 11:06:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rKTCk58kKj6hHEYQUU+L0ZT122Mosw2WofE5kNcBd7s=; b=ZNf3+h4r1DYJsQ5+j01saz0K7CSFCzEkEk9ghxng3JqXTKdVHkenv1uZIdxBgsLzAX Xp6ZbeNWAx92/N7td7wfeBkKeAxTkHsuuC21bEmBYamkJ2Lony/Mq6IakxT5PYc856YS n4709HEUmepWlcpZtNS4q6biPNfHgXBf58k1WwHHw6WlZruMw+Lhh4DFPV4Y8lM+xaGX g1m/4kS9pV8fxGlR02eW7AKjj7Ss09qsl179UX6iaGCyrc6KvXTFO+vSGVz5F6j0n+w/ xV8vq2NJbgya+NE7WvxdWarMpTAwVX+kgj9KTuFA4R875yd03eZsC/DK5BUWlxwKFLdn DTBA== X-Gm-Message-State: AJIora/DGDMKDk17QX8KRQlQEyhuBICPbOc65pit2ltwmABygW7LJbHq Tc1WtTW0Pl9iiyOsTZXoVKm8D5xkmlY= X-Google-Smtp-Source: AGRyM1tbpecTSmX2EedCxj4ZJMTK2rh/myShvZYksjOZtvo8Wj2rhzsxxdHn0ZeWVbdNHsjRlkuGRw== X-Received: by 2002:a17:902:e807:b0:16a:471b:a4cc with SMTP id u7-20020a170902e80700b0016a471ba4ccmr9837713plg.102.1656007586465; Thu, 23 Jun 2022 11:06:26 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:25 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Martin K . Petersen" , Avri Altman Subject: [PATCH 33/51] scsi/ufs: Rename a 'dir' argument into 'op' Date: Thu, 23 Jun 2022 11:05:10 -0700 Message-Id: <20220623180528.3595304-34-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve consistency of the kernel code by renaming a request operation argument from 'dir' into 'op'. Cc: Martin K. Petersen Cc: Avri Altman Signed-off-by: Bart Van Assche Reviewed-by: Avri Altman --- drivers/ufs/core/ufshpb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/core/ufshpb.c b/drivers/ufs/core/ufshpb.c index 24f1ee82c215..a1a7a1175a5a 100644 --- a/drivers/ufs/core/ufshpb.c +++ b/drivers/ufs/core/ufshpb.c @@ -434,7 +434,7 @@ int ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) } static struct ufshpb_req *ufshpb_get_req(struct ufshpb_lu *hpb, int rgn_idx, - enum req_op dir, bool atomic) + enum req_op op, bool atomic) { struct ufshpb_req *rq; struct request *req; @@ -445,7 +445,7 @@ static struct ufshpb_req *ufshpb_get_req(struct ufshpb_lu *hpb, int rgn_idx, return NULL; retry: - req = blk_mq_alloc_request(hpb->sdev_ufs_lu->request_queue, dir, + req = blk_mq_alloc_request(hpb->sdev_ufs_lu->request_queue, op, BLK_MQ_REQ_NOWAIT); if (!atomic && (PTR_ERR(req) == -EWOULDBLOCK) && (--retries > 0)) { From patchwork Thu Jun 23 18:05:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893078 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B94BC43334 for ; Thu, 23 Jun 2022 19:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbiFWTBg (ORCPT ); Thu, 23 Jun 2022 15:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232069AbiFWTBM (ORCPT ); Thu, 23 Jun 2022 15:01:12 -0400 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78DEC10E673 for ; Thu, 23 Jun 2022 11:06:28 -0700 (PDT) Received: by mail-pf1-f182.google.com with SMTP id k127so288056pfd.10 for ; Thu, 23 Jun 2022 11:06:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wa/sr+NP/FT4fKWkIMXc8lgZJSIyAgOvOxw719smI0c=; b=mIhLjUKauphq6cdPr/+abnNhI0mTrAscs6w5fAqWayH8CMr3byY80NWX3aPo3bII4S xGz+OUFlB1AUVTSWJlbFATzoql0CWUm5sWVQ3WPcKoAHOnQUlMGq3JRq783HhPvaP8b8 aunljK7L2hbU69qViLaS1mOX0N2UmCTz5xA4yjKgLK5Crm14yH8fkuxNg3p/wwQyrtyx ce6ITp+Z5WsjIoGEg1knyi+/WtLmWCbCl1uOKlr+m6yVOTYqAAHy+MnylG92fim1iqaX bH4kWnxr0fkF0MdpH956jrOQXJjq/ivNSl7BxVksuOCSK7D6AiS+7rBMk1Ddp3gQU8no uDCg== X-Gm-Message-State: AJIora93ukKzIf0aCLhUETnhLWPN72osUKLJ+pJN2dWjazFlpTdOCz1P b/bbUuOP2lhqYVjCeSDbpcI= X-Google-Smtp-Source: AGRyM1tRGaBl/bW98h5/DKKZgjSXaxtAeOJKvM2wtJqd7pEIFCt+oLNoKBUKIJ8k+65s9yHrmQ/BkA== X-Received: by 2002:a05:6a00:1306:b0:512:ca3d:392f with SMTP id j6-20020a056a00130600b00512ca3d392fmr42378220pfu.79.1656007587793; Thu, 23 Jun 2022 11:06:27 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:27 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Mike Christie Subject: [PATCH 34/51] scsi/target: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:11 -0700 Message-Id: <20220623180528.3595304-35-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the new blk_opf_t type for variables that represent a request operation combined with request flags. Cc: Mike Christie Signed-off-by: Bart Van Assche --- drivers/target/target_core_iblock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 378c80313a0f..5fef19af88df 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -343,7 +343,7 @@ static void iblock_bio_done(struct bio *bio) } static struct bio *iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num, - unsigned int opf) + blk_opf_t opf) { struct iblock_dev *ib_dev = IBLOCK_DEV(cmd->se_dev); struct bio *bio; @@ -719,7 +719,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, struct bio_list list; struct scatterlist *sg; u32 sg_num = sgl_nents; - unsigned int opf; + blk_opf_t opf; unsigned bio_cnt; int i, rc; struct sg_mapping_iter prot_miter; From patchwork Thu Jun 23 18:05:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 648D5C433EF for ; Thu, 23 Jun 2022 19:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232037AbiFWTBd (ORCPT ); Thu, 23 Jun 2022 15:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232057AbiFWTBL (ORCPT ); Thu, 23 Jun 2022 15:01:11 -0400 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C06C010E67E for ; Thu, 23 Jun 2022 11:06:30 -0700 (PDT) Received: by mail-pg1-f176.google.com with SMTP id r66so184873pgr.2 for ; Thu, 23 Jun 2022 11:06:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WDrUbGX6pJvpKfdPLgsIQ+aIpWdnNjzAWz8vQdxyqAM=; b=sDS+9nignxwwTbKnxpcS0Chce2jdTsxo43HBFdaHlDRRQN0HnP0+2X7V0YlN6OzaRq TXywXYYSFtMM/pMn+e2ZLgXpDAfVQVSJO1HHBI/zsxnLO3nZ891Yo5VY3yNIn9i7xD0n FozSbxHeOGdfAILBlux5t27uKtxwCwqNvWiuhui/8DO1tP+nxWGfWKhvahPDaiGmxO3R nUqEWX+mwBryuaUgzKp8us/2KyuagYQ0yPbEd4vEJbO519zMygVQpd/Hz7kAhGIfDAcK VNMFWwcFba+4tkeb+OcZ+3CxhzcEBAacmW1dsk4iasyohpmS7YbjnRruJG01ZIwSVSaJ LNpA== X-Gm-Message-State: AJIora9Ct7bBDZpjyN/s7nhjveQR9LDqo5GemMaqD4LKugTUGhyaKk0/ whBgTMRoMB32EOfbXj70JQM= X-Google-Smtp-Source: AGRyM1vYnG3menuGI91AwfsD9P0Kr4/+Gx/XA6p1FCITgG2/oPQ1YYMbQi5OL/EsjTUaoc4ccnH4nA== X-Received: by 2002:a63:2b16:0:b0:3fa:faf9:e6d7 with SMTP id r22-20020a632b16000000b003fafaf9e6d7mr8442209pgr.325.1656007590051; Thu, 23 Jun 2022 11:06:30 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:28 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Andrew Morton Subject: [PATCH 35/51] mm: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:12 -0700 Message-Id: <20220623180528.3595304-36-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the new blk_opf_t type for block layer request flags. Cc: Andrew Morton Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- include/linux/writeback.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/writeback.h b/include/linux/writeback.h index b8c9610c2313..3f045f6d6c4f 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -101,9 +101,9 @@ struct writeback_control { #endif }; -static inline int wbc_to_write_flags(struct writeback_control *wbc) +static inline blk_opf_t wbc_to_write_flags(struct writeback_control *wbc) { - int flags = 0; + blk_opf_t flags = 0; if (wbc->punt_to_cgroup) flags = REQ_CGROUP_PUNT; From patchwork Thu Jun 23 18:05:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893080 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB7E8CCA47C for ; Thu, 23 Jun 2022 19:01:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231559AbiFWTBg (ORCPT ); Thu, 23 Jun 2022 15:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231455AbiFWTBM (ORCPT ); Thu, 23 Jun 2022 15:01:12 -0400 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B81ED10EF4A for ; Thu, 23 Jun 2022 11:06:32 -0700 (PDT) Received: by mail-pg1-f180.google.com with SMTP id 23so157930pgc.8 for ; Thu, 23 Jun 2022 11:06:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1Dh7/lajnx7uH/hp2GGdYwvcyrZEgzC/mYGlJopdH7c=; b=E0KmUxKuubr3kyGOJ79kJeYW8g5tQPdLajG6TlJ2kb0nRPx6G3tUL9r9TTbcxBn1Zi vP8QcDcAUpkx5W0+mgAvRcCtmtLAb/MR6phfQzJdZWLmRaMSyU8gIU6pKe0pC6ICDzaJ fqRkAzJNbVYetwKtxzSHevsIUHQ2L3OaQj8y2ahoWYb2+LSUr24Yl9bcgGKm4wLsqrVl 0zomfKqhrOIRmt2Co2KxAjv//BC6UIR0hRK7OpXPp0lIlqtbf8a5UhDm8JIvfsLYV1w6 v33dH80cHZQCVl6RGbPQyWpPHAF9QNPPb3TuMzfWSnI8xx4CyUaRLmpBNrl4qzc5fYMn 5LTg== X-Gm-Message-State: AJIora/z4OrvizCEDbPpEu6r/QKtY8y0JN2xa2FbuC8PLyb6YnpnytBe MSoeteZ1HCWKnsW9uH1v4LE= X-Google-Smtp-Source: AGRyM1tW2DZ/Z4Ybr9EuBFJlVLzVH1kOAr/Ax9+2eIhKqPidXhobuzZ4H3+GX+XcX5FH+jEIj+7fFw== X-Received: by 2002:a05:6a00:21c8:b0:4c4:4bd:dc17 with SMTP id t8-20020a056a0021c800b004c404bddc17mr42142270pfj.57.1656007592114; Thu, 23 Jun 2022 11:06:32 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:31 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Matthew Wilcox , Jan Kara Subject: [PATCH 36/51] fs/buffer: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:13 -0700 Message-Id: <20220623180528.3595304-37-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the new blk_opf_t type for block layer request flags. Change WRITE into REQ_OP_WRITE. This patch does not change any functionality since REQ_OP_WRITE == WRITE == 1. Cc: Christoph Hellwig Cc: Matthew Wilcox Cc: Jan Kara Signed-off-by: Bart Van Assche --- fs/buffer.c | 21 +++++++++++---------- include/linux/buffer_head.h | 9 +++++---- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 898c7f301b1b..4a00b61f35ec 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -52,8 +52,8 @@ #include "internal.h" static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); -static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, - struct writeback_control *wbc); +static int submit_bh_wbc(enum req_op op, blk_opf_t op_flags, + struct buffer_head *bh, struct writeback_control *wbc); #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers) @@ -1716,7 +1716,7 @@ int __block_write_full_page(struct inode *inode, struct page *page, struct buffer_head *bh, *head; unsigned int blocksize, bbits; int nr_underway = 0; - int write_flags = wbc_to_write_flags(wbc); + blk_opf_t write_flags = wbc_to_write_flags(wbc); head = create_page_buffers(page, inode, (1 << BH_Dirty)|(1 << BH_Uptodate)); @@ -2994,8 +2994,8 @@ static void end_bio_bh_io_sync(struct bio *bio) bio_put(bio); } -static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, - struct writeback_control *wbc) +static int submit_bh_wbc(enum req_op op, blk_opf_t op_flags, + struct buffer_head *bh, struct writeback_control *wbc) { struct bio *bio; @@ -3040,7 +3040,7 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, return 0; } -int submit_bh(int op, int op_flags, struct buffer_head *bh) +int submit_bh(enum req_op op, blk_opf_t op_flags, struct buffer_head *bh) { return submit_bh_wbc(op, op_flags, bh, NULL); } @@ -3072,7 +3072,8 @@ EXPORT_SYMBOL(submit_bh); * All of the buffers must be for the same device, and must also be a * multiple of the current approved size for the device. */ -void ll_rw_block(int op, int op_flags, int nr, struct buffer_head *bhs[]) +void ll_rw_block(enum req_op op, blk_opf_t op_flags, int nr, + struct buffer_head *bhs[]) { int i; @@ -3081,7 +3082,7 @@ void ll_rw_block(int op, int op_flags, int nr, struct buffer_head *bhs[]) if (!trylock_buffer(bh)) continue; - if (op == WRITE) { + if (op == REQ_OP_WRITE) { if (test_clear_buffer_dirty(bh)) { bh->b_end_io = end_buffer_write_sync; get_bh(bh); @@ -3101,7 +3102,7 @@ void ll_rw_block(int op, int op_flags, int nr, struct buffer_head *bhs[]) } EXPORT_SYMBOL(ll_rw_block); -void write_dirty_buffer(struct buffer_head *bh, int op_flags) +void write_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags) { lock_buffer(bh); if (!test_clear_buffer_dirty(bh)) { @@ -3119,7 +3120,7 @@ EXPORT_SYMBOL(write_dirty_buffer); * and then start new I/O and then wait upon it. The caller must have a ref on * the buffer_head. */ -int __sync_dirty_buffer(struct buffer_head *bh, int op_flags) +int __sync_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags) { int ret = 0; diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index c9d1463bb20f..9795df9400bd 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -9,6 +9,7 @@ #define _LINUX_BUFFER_HEAD_H #include +#include #include #include #include @@ -201,11 +202,11 @@ struct buffer_head *alloc_buffer_head(gfp_t gfp_flags); void free_buffer_head(struct buffer_head * bh); void unlock_buffer(struct buffer_head *bh); void __lock_buffer(struct buffer_head *bh); -void ll_rw_block(int, int, int, struct buffer_head * bh[]); +void ll_rw_block(enum req_op, blk_opf_t, int, struct buffer_head * bh[]); int sync_dirty_buffer(struct buffer_head *bh); -int __sync_dirty_buffer(struct buffer_head *bh, int op_flags); -void write_dirty_buffer(struct buffer_head *bh, int op_flags); -int submit_bh(int, int, struct buffer_head *); +int __sync_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags); +void write_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags); +int submit_bh(enum req_op, blk_opf_t, struct buffer_head *); void write_boundary_block(struct block_device *bdev, sector_t bblock, unsigned blocksize); int bh_uptodate_or_lock(struct buffer_head *bh); From patchwork Thu Jun 23 18:05:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893081 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE663C43334 for ; Thu, 23 Jun 2022 19:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229448AbiFWTBj (ORCPT ); Thu, 23 Jun 2022 15:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbiFWTBN (ORCPT ); Thu, 23 Jun 2022 15:01:13 -0400 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F191D10EF54 for ; Thu, 23 Jun 2022 11:06:33 -0700 (PDT) Received: by mail-pj1-f52.google.com with SMTP id k12-20020a17090a404c00b001eaabc1fe5dso3386544pjg.1 for ; Thu, 23 Jun 2022 11:06:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EvjW7rY36ZMy0wNyWgmCOUx7rdaNJWo/Gm6UsZieMd0=; b=s+k1ZOgac64boll1RoOE0Xvb0gcf3NJ2WbuVMGPdlpIUU2MNDllaRx8d0dR7hijxSS JC3PwWadQZicSxdA/Q2nS1SrVbG8TQOfoZZZFVktqcuLcKmBThk9DJmfHx5SlhEN3lhq +e0MvR6LBWsi8Uv4FhBiOHVjLh0XR8srUJd9sx1JyEftfZPfp3aGA6diE925O4BNKgg8 713AMTUklgpZoasZAcUrQhO6FM9DOAK++IunlMB/7xdgQPuH4LzNvzdBQ0oPgTw/qVyR keO/c2YCWAOzBdsta3sVcFzT6RYXQ8usQ3XKOg6OHDZoaSQXV01z5JgQSoxBO87CqjRv YBXQ== X-Gm-Message-State: AJIora/mFyhXWD7+Rdz7KpX89xDcwl+6TVRvflV5ctV4Rob/qv5QNcIe sHbwI24xRk2F6mBmS8f/kGE= X-Google-Smtp-Source: AGRyM1vbu9NW6J1bk5WNGNl3X/fLLGTmlzqVXr35Iy2pVCKodgANyTisggoBomfcNjgw19uv3hlcvg== X-Received: by 2002:a17:902:8546:b0:16a:2460:3e5b with SMTP id d6-20020a170902854600b0016a24603e5bmr22239990plo.19.1656007593371; Thu, 23 Jun 2022 11:06:33 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:32 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Al Viro Subject: [PATCH 37/51] fs/direct-io: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:14 -0700 Message-Id: <20220623180528.3595304-38-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for block layer request operations and the new blk_opf_t type for block layer request flags. Cc: Al Viro Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- fs/direct-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/direct-io.c b/fs/direct-io.c index 840752006f60..9cfbb37ec62a 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -117,8 +117,8 @@ struct dio_submit { /* dio_state communicated between submission path and end_io */ struct dio { int flags; /* doesn't change */ - int op; - int op_flags; + enum req_op op; + blk_opf_t op_flags; struct gendisk *bio_disk; struct inode *inode; loff_t i_size; /* i_size when submitted */ From patchwork Thu Jun 23 18:05:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893082 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A955C433EF for ; Thu, 23 Jun 2022 19:01:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229933AbiFWTBj (ORCPT ); Thu, 23 Jun 2022 15:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230217AbiFWTBO (ORCPT ); Thu, 23 Jun 2022 15:01:14 -0400 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70A4910EF5A for ; Thu, 23 Jun 2022 11:06:35 -0700 (PDT) Received: by mail-pl1-f182.google.com with SMTP id l6so10659514plg.11 for ; Thu, 23 Jun 2022 11:06:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3L+13jbsL2KytYOAIGe5reLvhMdInbYdB1ucfP6bHbc=; b=isJXMcWwn6OxymS7/yeu2A3lOKJTOtr0OP7jVxQhQ2TH4teFaoPM6MFQTI25A3XaNz 3cf0BkVMmg+GOJfmrGq4HHdVBJU7lecar1IcjcoBIjlLtgWO+9BhhecPLceitvmEFi8+ Sd2NXCvXMaZ2Jc9bCAC3eIgvL9cjrYEy0T0JgFyLR9CJQ5XJ9zdqD/wJbQE3IOIG07sV E9t8RtlKwrhDlR3mRxQAMhP668wvXKBIZBHP872bWyF+SYWYg/Q+6DThc9lKRYCeaRrj nbkhpVnHpgmKTWbdNtkIjcLZhb+vhGhaGa3k1VTWRHe/m/p1E0TYmIlU9MN0Ru8DbSs7 uEwg== X-Gm-Message-State: AJIora+0NYZrG9inc5kx44wFpJki/1XLjrXwJ//3Dq9tsiEoAPAqxT2o ANfMxqs4eq5gJEj9hHzcXaE= X-Google-Smtp-Source: AGRyM1t+m8unQSgbAX2f3v5YB1NbrYPrKQ1SEc+UVIGs2gYtH9wnIBhnk99hPJcsoHPFis7g9RcNtA== X-Received: by 2002:a17:902:7486:b0:16a:cfc:7f49 with SMTP id h6-20020a170902748600b0016a0cfc7f49mr30847575pll.135.1656007594754; Thu, 23 Jun 2022 11:06:34 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:33 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Al Viro Subject: [PATCH 38/51] fs/mpage: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:15 -0700 Message-Id: <20220623180528.3595304-39-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the new blk_opf_t type for the combination of a block layer request with block layer request flags. Cc: Al Viro Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- fs/mpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/mpage.c b/fs/mpage.c index 0d25f44f5707..5830705672dd 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -145,7 +145,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) struct block_device *bdev = NULL; int length; int fully_mapped = 1; - int op = REQ_OP_READ; + blk_opf_t op = REQ_OP_READ; unsigned nblocks; unsigned relative_block; gfp_t gfp = mapping_gfp_constraint(page->mapping, GFP_KERNEL); From patchwork Thu Jun 23 18:05:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893083 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11A15C433EF for ; Thu, 23 Jun 2022 19:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229529AbiFWTBn (ORCPT ); Thu, 23 Jun 2022 15:01:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231696AbiFWTBS (ORCPT ); Thu, 23 Jun 2022 15:01:18 -0400 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A26CA10EF72 for ; Thu, 23 Jun 2022 11:06:37 -0700 (PDT) Received: by mail-pf1-f169.google.com with SMTP id n12so365743pfq.0 for ; Thu, 23 Jun 2022 11:06:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4aDY5TeEl9khD/49HOQ4tT2++Ig59INqTGmDhSK7Q2A=; b=P6Tpi+nICjfRHEuylppxI7my2rfOVJHr1uwWxEzUghenCElTq55SPyJB8rFlDbxi4h 0udgkdq/K17bQ4hK4dOvuCVTa9ieMlD0/ZdqgSW28B5Dyb5EL0V6MBkdaAWOg+P1NSQD Qhqxe3+NDqUNirCimVm5A6ZqR2JDsyZReHqO7RVeMR1SAEdaPNoJmhw5HgIf8WFMNP1t E6idFzmbKIve3DFmigAn9KlGNiKNgZ9J0XdhWXmZ/wLQItPTtnJXOamKXK4+Mv454bvj siZz7t7MANYoM5/d2Z7DNqoJVWJMjXgOwRJlOyw9VdIogfmqE+y5cVapnlkex8yxttfI cNfQ== X-Gm-Message-State: AJIora8itCofyjI8gfY9vRSaWggJ73y8drXk85khmdLMNOoCmIZ3K35X GWkV3bxLhAvCl6v6fFzC1ZvSn9+l7Bs= X-Google-Smtp-Source: AGRyM1vjy2hHnvRSlfNDEjIpybCaAa/xdzu0TkfNgOsdmuOWYZ7A3gtMIize3SUSPcEx0YFeZ2ITtg== X-Received: by 2002:a65:6b94:0:b0:3fb:16f4:3620 with SMTP id d20-20020a656b94000000b003fb16f43620mr8550261pgw.464.1656007596777; Thu, 23 Jun 2022 11:06:36 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:36 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , David Sterba , Josef Bacik Subject: [PATCH 39/51] fs/btrfs: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:16 -0700 Message-Id: <20220623180528.3595304-40-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: David Sterba Cc: Josef Bacik Signed-off-by: Bart Van Assche --- fs/btrfs/check-integrity.c | 4 ++-- fs/btrfs/compression.c | 6 +++--- fs/btrfs/compression.h | 2 +- fs/btrfs/extent_io.c | 18 +++++++++--------- fs/btrfs/inode.c | 4 ++-- fs/btrfs/raid56.c | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 5d20137b7b67..98c6e5feab19 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c @@ -152,7 +152,7 @@ struct btrfsic_block { struct btrfsic_block *next_in_same_bio; void *orig_bio_private; bio_end_io_t *orig_bio_end_io; - int submit_bio_bh_rw; + blk_opf_t submit_bio_bh_rw; u64 flush_gen; /* only valid if !never_written */ }; @@ -1681,7 +1681,7 @@ static void btrfsic_process_written_block(struct btrfsic_dev_state *dev_state, u64 dev_bytenr, char **mapped_datav, unsigned int num_pages, struct bio *bio, int *bio_is_patched, - int submit_bio_bh_rw) + blk_opf_t submit_bio_bh_rw) { int is_metadata; struct btrfsic_block *block; diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index f4564f32f6d9..a82b9f17f476 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -455,7 +455,7 @@ static blk_status_t submit_compressed_bio(struct btrfs_fs_info *fs_info, static struct bio *alloc_compressed_bio(struct compressed_bio *cb, u64 disk_bytenr, - unsigned int opf, bio_end_io_t endio_func, + blk_opf_t opf, bio_end_io_t endio_func, u64 *next_stripe_start) { struct btrfs_fs_info *fs_info = btrfs_sb(cb->inode->i_sb); @@ -505,7 +505,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start, unsigned int compressed_len, struct page **compressed_pages, unsigned int nr_pages, - unsigned int write_flags, + blk_opf_t write_flags, struct cgroup_subsys_state *blkcg_css, bool writeback) { @@ -517,7 +517,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start, blk_status_t ret; int skip_sum = inode->flags & BTRFS_INODE_NODATASUM; const bool use_append = btrfs_use_zone_append(inode, disk_start); - const unsigned int bio_op = use_append ? REQ_OP_ZONE_APPEND : REQ_OP_WRITE; + const enum req_op bio_op = use_append ? REQ_OP_ZONE_APPEND : REQ_OP_WRITE; ASSERT(IS_ALIGNED(start, fs_info->sectorsize) && IS_ALIGNED(len, fs_info->sectorsize)); diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h index 2707404389a5..2b56d63e01ce 100644 --- a/fs/btrfs/compression.h +++ b/fs/btrfs/compression.h @@ -99,7 +99,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start, unsigned int compressed_len, struct page **compressed_pages, unsigned int nr_pages, - unsigned int write_flags, + blk_opf_t write_flags, struct cgroup_subsys_state *blkcg_css, bool writeback); void btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8f6b544ae616..10f8df7f883d 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3357,7 +3357,7 @@ static int calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl, static int alloc_new_bio(struct btrfs_inode *inode, struct btrfs_bio_ctrl *bio_ctrl, struct writeback_control *wbc, - unsigned int opf, + blk_opf_t opf, bio_end_io_t end_io_func, u64 disk_bytenr, u32 offset, u64 file_offset, enum btrfs_compression_type compress_type) @@ -3437,7 +3437,7 @@ static int alloc_new_bio(struct btrfs_inode *inode, * @prev_bio_flags: flags of previous bio to see if we can merge the current one * @compress_type: compress type for current bio */ -static int submit_extent_page(unsigned int opf, +static int submit_extent_page(blk_opf_t opf, struct writeback_control *wbc, struct btrfs_bio_ctrl *bio_ctrl, struct page *page, u64 disk_bytenr, @@ -3615,7 +3615,7 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset, */ static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached, struct btrfs_bio_ctrl *bio_ctrl, - unsigned int read_flags, u64 *prev_em_start) + blk_opf_t read_flags, u64 *prev_em_start) { struct inode *inode = page->mapping->host; struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); @@ -3983,8 +3983,8 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode, int saved_ret = 0; int ret = 0; int nr = 0; - u32 opf = REQ_OP_WRITE; - const unsigned int write_flags = wbc_to_write_flags(wbc); + enum req_op op = REQ_OP_WRITE; + const blk_opf_t write_flags = wbc_to_write_flags(wbc); bool has_error = false; bool compressed; @@ -4058,7 +4058,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode, iosize = min(min(em_end, end + 1), dirty_range_end) - cur; if (btrfs_use_zone_append(inode, em->block_start)) - opf = REQ_OP_ZONE_APPEND; + op = REQ_OP_ZONE_APPEND; free_extent_map(em); em = NULL; @@ -4094,7 +4094,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode, */ btrfs_page_clear_dirty(fs_info, page, cur, iosize); - ret = submit_extent_page(opf | write_flags, wbc, + ret = submit_extent_page(op | write_flags, wbc, &epd->bio_ctrl, page, disk_bytenr, iosize, cur - page_offset(page), @@ -4575,7 +4575,7 @@ static int write_one_subpage_eb(struct extent_buffer *eb, { struct btrfs_fs_info *fs_info = eb->fs_info; struct page *page = eb->pages[0]; - unsigned int write_flags = wbc_to_write_flags(wbc) | REQ_META; + blk_opf_t write_flags = wbc_to_write_flags(wbc) | REQ_META; bool no_dirty_ebs = false; int ret; @@ -4620,7 +4620,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb, { u64 disk_bytenr = eb->start; int i, num_pages; - unsigned int write_flags = wbc_to_write_flags(wbc) | REQ_META; + blk_opf_t write_flags = wbc_to_write_flags(wbc) | REQ_META; int ret = 0; prepare_eb_write(eb); diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 81737eff92f3..724f8f7e3599 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -485,7 +485,7 @@ struct async_chunk { struct page *locked_page; u64 start; u64 end; - unsigned int write_flags; + blk_opf_t write_flags; struct list_head extents; struct cgroup_subsys_state *blkcg_css; struct btrfs_work work; @@ -1435,7 +1435,7 @@ static int cow_file_range_async(struct btrfs_inode *inode, int i; bool should_compress; unsigned nofs_flag; - const unsigned int write_flags = wbc_to_write_flags(wbc); + const blk_opf_t write_flags = wbc_to_write_flags(wbc); unlock_extent(&inode->io_tree, start, end); diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index a5b623ee6fac..c520412d1f86 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1136,7 +1136,7 @@ static int rbio_add_io_sector(struct btrfs_raid_bio *rbio, unsigned int stripe_nr, unsigned int sector_nr, unsigned long bio_max_len, - unsigned int opf) + enum req_op op) { const u32 sectorsize = rbio->bioc->fs_info->sectorsize; struct bio *last = bio_list->tail; @@ -1181,7 +1181,7 @@ static int rbio_add_io_sector(struct btrfs_raid_bio *rbio, /* put a new bio on the list */ bio = bio_alloc(stripe->dev->bdev, max(bio_max_len >> PAGE_SHIFT, 1UL), - opf, GFP_NOFS); + op, GFP_NOFS); bio->bi_iter.bi_sector = disk_start >> 9; bio->bi_private = rbio; From patchwork Thu Jun 23 18:05:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893085 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B902CCA47C for ; Thu, 23 Jun 2022 19:01:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231956AbiFWTBp (ORCPT ); Thu, 23 Jun 2022 15:01:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232122AbiFWTBW (ORCPT ); Thu, 23 Jun 2022 15:01:22 -0400 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31AA65E4 for ; Thu, 23 Jun 2022 11:06:39 -0700 (PDT) Received: by mail-pf1-f180.google.com with SMTP id u37so326585pfg.3 for ; Thu, 23 Jun 2022 11:06:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fQoCVR8sjxT2PQsdyc9RrxPkFcahnRoIG+jmu+pHHW4=; b=FHbOFikoIIn1r+SnMSGHWl0OGfzQa5xKJEePYa2xJWaUDsCayj+745pHWE1hneAuLs AnL8BBPJIHN1km6VPSInvj4qAUhyGwqImy9jZbS1qi5+X+Dcc/aTaGFmG6ZHLz3D33LJ 5VArP4XdsD9goNqmYH/uYR3MGOviFLgfX+6QNrAKW+FVPdtIPZjjf9SCImLs7h43KBWa NSIe9GPMvPuqkLFCDinXSUfTN5Bon6Ik8Yut+yF/4blrBEmYOxdI+Y971BqB2XBxSK3n WFw+571EIsdq+sR3i8fZ58Ep63wOgGue47SUZEZMbqBUSl3A/kUqghzLNEZphOA/+js6 Stzw== X-Gm-Message-State: AJIora+J+5K9f9d83CoJ0e2vauOuUukueO1aqvcJI/sdaNEARtxBnr73 s3Nlojej8jxXHeDnAYDCbsthtxJRKik= X-Google-Smtp-Source: AGRyM1sRk9DQBPJ7KtsEpXs1H+Q/ajrP+eHEvfHhhkpJP1XIx7f50C6WeORzvu8973cLZMZz30lojg== X-Received: by 2002:a65:6e9b:0:b0:3fc:587a:6dcd with SMTP id bm27-20020a656e9b000000b003fc587a6dcdmr8564580pgb.200.1656007598547; Thu, 23 Jun 2022 11:06:38 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:37 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Theodore Ts'o Subject: [PATCH 40/51] fs/ext4: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:17 -0700 Message-Id: <20220623180528.3595304-41-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the new blk_opf_t type for variables that represent request flags. Cc: Theodore Ts'o Signed-off-by: Bart Van Assche --- fs/ext4/ext4.h | 8 ++++---- fs/ext4/fast_commit.c | 2 +- fs/ext4/super.c | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 75b8d81b2469..29fc575a4eb6 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -3058,14 +3058,14 @@ extern unsigned int ext4_list_backups(struct super_block *sb, /* super.c */ extern struct buffer_head *ext4_sb_bread(struct super_block *sb, - sector_t block, int op_flags); + sector_t block, blk_opf_t op_flags); extern struct buffer_head *ext4_sb_bread_unmovable(struct super_block *sb, sector_t block); -extern void ext4_read_bh_nowait(struct buffer_head *bh, int op_flags, +extern void ext4_read_bh_nowait(struct buffer_head *bh, blk_opf_t op_flags, bh_end_io_t *end_io); -extern int ext4_read_bh(struct buffer_head *bh, int op_flags, +extern int ext4_read_bh(struct buffer_head *bh, blk_opf_t op_flags, bh_end_io_t *end_io); -extern int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, bool wait); +extern int ext4_read_bh_lock(struct buffer_head *bh, blk_opf_t op_flags, bool wait); extern void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block); extern int ext4_seq_options_show(struct seq_file *seq, void *offset); extern int ext4_calculate_overhead(struct super_block *sb); diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c index 795a60ad1897..de6c73d0f431 100644 --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -658,7 +658,7 @@ void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t star static void ext4_fc_submit_bh(struct super_block *sb, bool is_tail) { - int write_flags = REQ_SYNC; + blk_opf_t write_flags = REQ_SYNC; struct buffer_head *bh = EXT4_SB(sb)->s_fc_bh; /* Add REQ_FUA | REQ_PREFLUSH only its tail */ diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 845f2f8aee5f..1d7f65088ddc 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -159,7 +159,7 @@ MODULE_ALIAS("ext3"); #define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) -static inline void __ext4_read_bh(struct buffer_head *bh, int op_flags, +static inline void __ext4_read_bh(struct buffer_head *bh, blk_opf_t op_flags, bh_end_io_t *end_io) { /* @@ -174,7 +174,7 @@ static inline void __ext4_read_bh(struct buffer_head *bh, int op_flags, submit_bh(REQ_OP_READ, op_flags, bh); } -void ext4_read_bh_nowait(struct buffer_head *bh, int op_flags, +void ext4_read_bh_nowait(struct buffer_head *bh, blk_opf_t op_flags, bh_end_io_t *end_io) { BUG_ON(!buffer_locked(bh)); @@ -186,7 +186,7 @@ void ext4_read_bh_nowait(struct buffer_head *bh, int op_flags, __ext4_read_bh(bh, op_flags, end_io); } -int ext4_read_bh(struct buffer_head *bh, int op_flags, bh_end_io_t *end_io) +int ext4_read_bh(struct buffer_head *bh, blk_opf_t op_flags, bh_end_io_t *end_io) { BUG_ON(!buffer_locked(bh)); @@ -203,7 +203,7 @@ int ext4_read_bh(struct buffer_head *bh, int op_flags, bh_end_io_t *end_io) return -EIO; } -int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, bool wait) +int ext4_read_bh_lock(struct buffer_head *bh, blk_opf_t op_flags, bool wait) { if (trylock_buffer(bh)) { if (wait) @@ -227,8 +227,8 @@ int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, bool wait) * return. */ static struct buffer_head *__ext4_sb_bread_gfp(struct super_block *sb, - sector_t block, int op_flags, - gfp_t gfp) + sector_t block, + blk_opf_t op_flags, gfp_t gfp) { struct buffer_head *bh; int ret; @@ -248,7 +248,7 @@ static struct buffer_head *__ext4_sb_bread_gfp(struct super_block *sb, } struct buffer_head *ext4_sb_bread(struct super_block *sb, sector_t block, - int op_flags) + blk_opf_t op_flags) { return __ext4_sb_bread_gfp(sb, block, op_flags, __GFP_MOVABLE); } From patchwork Thu Jun 23 18:05:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893084 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 122BCCCA480 for ; Thu, 23 Jun 2022 19:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229833AbiFWTBq (ORCPT ); Thu, 23 Jun 2022 15:01:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229745AbiFWTB3 (ORCPT ); Thu, 23 Jun 2022 15:01:29 -0400 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B340D10EF7F for ; Thu, 23 Jun 2022 11:06:40 -0700 (PDT) Received: by mail-pl1-f176.google.com with SMTP id n10so1495768plp.0 for ; Thu, 23 Jun 2022 11:06:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NbqJk9X+e4LnUrGqAiO/XLFGsNwZG2TtaOxZSknhgOA=; b=VBO9QqdoDK56NNsxis3U9PzBn6OwCux4NH0IBjdtKHqRzJLnqfDrJELh1VwSgenwIJ cL2YeY7KzbiPLDZ1tvDYqO/GKJtI78DSJSH+vOl3/FEjBlNAwIK7Lvgfnjfm8JRnCCaz yi3sCMmNnx7q2Dby4CXXtivG57/EHLEb6QvO8dmKxiChbv8Vt4kw7bAr4vERXmAGCLSY uwzy4DFv9nqw0YQB8b1FXPS8UhiMBLWR9dL/XZ3p9T9hC4mC7TQnEbwO95acbJ9QQy1H w/O+IgRBGT315OkqIFCNLPDuz+tkBPpzP7t9EkBwmJiQvXoEcHgd2tTXtrtFVwKrobl0 QW9Q== X-Gm-Message-State: AJIora9gVKxXogELPdF+zYrDFK2XLB1L036tXvHQRwxu3qTijMn5FpBP Wqxtkhwo3z+xnc3FKTUeRnw95rSbG64= X-Google-Smtp-Source: AGRyM1u2og4SLSE7WAzLqkJpJcM2DrKeMM0eK/4cB2guw6I5VUUpodc2NvPL8B1HccMVUpzd/vggHw== X-Received: by 2002:a17:902:f544:b0:16a:2b62:ef77 with SMTP id h4-20020a170902f54400b0016a2b62ef77mr18995609plf.134.1656007599814; Thu, 23 Jun 2022 11:06:39 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:39 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Jaegeuk Kim Subject: [PATCH 41/51] fs/f2fs: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:18 -0700 Message-Id: <20220623180528.3595304-42-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Jaegeuk Kim Signed-off-by: Bart Van Assche --- fs/f2fs/data.c | 11 ++++++----- fs/f2fs/f2fs.h | 6 +++--- fs/f2fs/node.c | 2 +- fs/f2fs/segment.c | 2 +- include/trace/events/f2fs.h | 28 +++++++++++++++------------- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 7fcbcf979737..5c13ee321940 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -387,11 +387,11 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr) return 0; } -static unsigned int f2fs_io_flags(struct f2fs_io_info *fio) +static blk_opf_t f2fs_io_flags(struct f2fs_io_info *fio) { unsigned int temp_mask = (1 << NR_TEMP_TYPE) - 1; unsigned int fua_flag, meta_flag, io_flag; - unsigned int op_flags = 0; + blk_opf_t op_flags = 0; if (fio->op != REQ_OP_WRITE) return 0; @@ -999,7 +999,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) } static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr, - unsigned nr_pages, unsigned op_flag, + unsigned nr_pages, blk_opf_t op_flag, pgoff_t first_idx, bool for_write) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); @@ -1047,7 +1047,8 @@ static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr, /* This can handle encryption stuffs */ static int f2fs_submit_page_read(struct inode *inode, struct page *page, - block_t blkaddr, int op_flags, bool for_write) + block_t blkaddr, blk_opf_t op_flags, + bool for_write) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct bio *bio; @@ -1181,7 +1182,7 @@ int f2fs_get_block(struct dnode_of_data *dn, pgoff_t index) } struct page *f2fs_get_read_data_page(struct inode *inode, pgoff_t index, - int op_flags, bool for_write) + blk_opf_t op_flags, bool for_write) { struct address_space *mapping = inode->i_mapping; struct dnode_of_data dn; diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index d9bbecd008d2..868170b72de9 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1183,8 +1183,8 @@ struct f2fs_io_info { nid_t ino; /* inode number */ enum page_type type; /* contains DATA/NODE/META/META_FLUSH */ enum temp_type temp; /* contains HOT/WARM/COLD */ - int op; /* contains REQ_OP_ */ - int op_flags; /* req_flag_bits */ + enum req_op op; /* contains REQ_OP_ */ + blk_opf_t op_flags; /* req_flag_bits */ block_t new_blkaddr; /* new block address to be written */ block_t old_blkaddr; /* old block address before Cow */ struct page *page; /* page to be written */ @@ -3741,7 +3741,7 @@ int f2fs_reserve_new_block(struct dnode_of_data *dn); int f2fs_get_block(struct dnode_of_data *dn, pgoff_t index); int f2fs_reserve_block(struct dnode_of_data *dn, pgoff_t index); struct page *f2fs_get_read_data_page(struct inode *inode, pgoff_t index, - int op_flags, bool for_write); + blk_opf_t op_flags, bool for_write); struct page *f2fs_find_data_page(struct inode *inode, pgoff_t index); struct page *f2fs_get_lock_data_page(struct inode *inode, pgoff_t index, bool for_write); diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 836c79a20afc..c4f1e895ebd2 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1327,7 +1327,7 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) * 0: f2fs_put_page(page, 0) * LOCKED_PAGE or error: f2fs_put_page(page, 1) */ -static int read_node_page(struct page *page, int op_flags) +static int read_node_page(struct page *page, blk_opf_t op_flags) { struct f2fs_sb_info *sbi = F2FS_P_SB(page); struct node_info ni; diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 874c1b9c41a2..c7afc588cf26 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1082,7 +1082,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi, struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; struct list_head *wait_list = (dpolicy->type == DPOLICY_FSTRIM) ? &(dcc->fstrim_list) : &(dcc->wait_list); - int flag = dpolicy->sync ? REQ_SYNC : 0; + blk_opf_t flag = dpolicy->sync ? REQ_SYNC : 0; block_t lstart, start, len, total_len; int err = 0; diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 513e889ef8aa..0f51b2e9c3d0 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -66,7 +66,7 @@ TRACE_DEFINE_ENUM(CP_RESIZE); #define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO | \ REQ_PREFLUSH | REQ_FUA) -#define F2FS_BIO_FLAG_MASK(t) (t & F2FS_OP_FLAGS) +#define F2FS_BIO_FLAG_MASK(t) ((t) & (__force u32)F2FS_OP_FLAGS) #define show_bio_type(op,op_flags) show_bio_op(op), \ show_bio_op_flags(op_flags) @@ -75,12 +75,12 @@ TRACE_DEFINE_ENUM(CP_RESIZE); #define show_bio_op_flags(flags) \ __print_flags(F2FS_BIO_FLAG_MASK(flags), "|", \ - { REQ_RAHEAD, "R" }, \ - { REQ_SYNC, "S" }, \ - { REQ_META, "M" }, \ - { REQ_PRIO, "P" }, \ - { REQ_PREFLUSH, "PF" }, \ - { REQ_FUA, "FUA" }) + { (__force u32)REQ_RAHEAD, "R" }, \ + { (__force u32)REQ_SYNC, "S" }, \ + { (__force u32)REQ_META, "M" }, \ + { (__force u32)REQ_PRIO, "P" }, \ + { (__force u32)REQ_PREFLUSH, "PF" }, \ + { (__force u32)REQ_FUA, "FUA" }) #define show_data_type(type) \ __print_symbolic(type, \ @@ -1048,8 +1048,8 @@ DECLARE_EVENT_CLASS(f2fs__submit_page_bio, __entry->index = page->index; __entry->old_blkaddr = fio->old_blkaddr; __entry->new_blkaddr = fio->new_blkaddr; - __entry->op = fio->op; - __entry->op_flags = fio->op_flags; + __entry->op = (__force int)fio->op; + __entry->op_flags = (__force int)fio->op_flags; __entry->temp = fio->temp; __entry->type = fio->type; ), @@ -1060,7 +1060,8 @@ DECLARE_EVENT_CLASS(f2fs__submit_page_bio, (unsigned long)__entry->index, (unsigned long long)__entry->old_blkaddr, (unsigned long long)__entry->new_blkaddr, - show_bio_type(__entry->op, __entry->op_flags), + show_bio_type((__force enum req_op)__entry->op, + __entry->op_flags), show_block_temp(__entry->temp), show_block_type(__entry->type)) ); @@ -1102,8 +1103,8 @@ DECLARE_EVENT_CLASS(f2fs__bio, TP_fast_assign( __entry->dev = sb->s_dev; __entry->target = bio_dev(bio); - __entry->op = bio_op(bio); - __entry->op_flags = bio->bi_opf; + __entry->op = (__force int)bio_op(bio); + __entry->op_flags = (__force int)bio->bi_opf; __entry->type = type; __entry->sector = bio->bi_iter.bi_sector; __entry->size = bio->bi_iter.bi_size; @@ -1112,7 +1113,8 @@ DECLARE_EVENT_CLASS(f2fs__bio, TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u", show_dev(__entry->target), show_dev(__entry->dev), - show_bio_type(__entry->op, __entry->op_flags), + show_bio_type((__force enum req_op)__entry->op, + __entry->op_flags), show_block_type(__entry->type), (unsigned long long)__entry->sector, __entry->size) From patchwork Thu Jun 23 18:05:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893086 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 203CDC433EF for ; Thu, 23 Jun 2022 19:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232100AbiFWTBr (ORCPT ); Thu, 23 Jun 2022 15:01:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232009AbiFWTBb (ORCPT ); Thu, 23 Jun 2022 15:01:31 -0400 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26A2860F09 for ; Thu, 23 Jun 2022 11:06:42 -0700 (PDT) Received: by mail-pl1-f169.google.com with SMTP id r1so18808172plo.10 for ; Thu, 23 Jun 2022 11:06:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SVHkZf2sTQS9SE2dnzik0Dn4Cehwp8o6/dpBWgcOOn0=; b=iJce6cSF1t4W2AjUcKcBKQXfoEMxp0+/cESzI/kg77oI03meXj7Uvx28PC/1h1ObCT qaMEo/qS8OmxlfgSGW3D4i2sqF8DZduUAxLk0I29NhnnIiuRnHc+QUCNGZpvSM3vc2So mwNzF5B/xoOZ8HoD2CyQkXq8plF/BmWAJiEVMye0Fj/qMFpCflcnB76ohF1Pi+8PNukP Liiyk+sm4/oXrQs4UDxVmWZEZ596xHXzrOyzqkJgeHDz2hF7XnYKu3pmnLZ+K0CI0OME fAItEIuX2vkKTjXrFXQ6E6oT5n49EIfEpu1RwvegpuBgkgc+UudAAIFrc9mHEAlReHWk Tyzw== X-Gm-Message-State: AJIora+ZsMtue4NzcS08p80YbR612f5wu9Up+irxxjn0+fcRD+nXLOnm ev5lBQ0yYyZ7XNeB6b6YdaM= X-Google-Smtp-Source: AGRyM1sa43og8CnN5oApJY5eMw6rLBV7DFqYg/KhmYQrWzrhoi9pgI5VoNben/PFZxmNnxvs4GtYYw== X-Received: by 2002:a17:902:b105:b0:16a:1a48:3382 with SMTP id q5-20020a170902b10500b0016a1a483382mr24684133plr.128.1656007601560; Thu, 23 Jun 2022 11:06:41 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:40 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Bob Peterson , Andreas Gruenbacher Subject: [PATCH 42/51] fs/gfs2: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:19 -0700 Message-Id: <20220623180528.3595304-43-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Bob Peterson Cc: Andreas Gruenbacher Signed-off-by: Bart Van Assche --- fs/gfs2/log.c | 4 ++-- fs/gfs2/log.h | 2 +- fs/gfs2/lops.c | 4 ++-- fs/gfs2/lops.h | 2 +- fs/gfs2/meta_io.c | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index f0ee3ff6f9a8..eec4159b08aa 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -823,7 +823,7 @@ void gfs2_flush_revokes(struct gfs2_sbd *sdp) void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, u64 seq, u32 tail, u32 lblock, u32 flags, - int op_flags) + blk_opf_t op_flags) { struct gfs2_log_header *lh; u32 hash, crc; @@ -905,7 +905,7 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, static void log_write_header(struct gfs2_sbd *sdp, u32 flags) { - int op_flags = REQ_PREFLUSH | REQ_FUA | REQ_META | REQ_SYNC; + blk_opf_t op_flags = REQ_PREFLUSH | REQ_FUA | REQ_META | REQ_SYNC; enum gfs2_freeze_state state = atomic_read(&sdp->sd_freeze_state); gfs2_assert_withdraw(sdp, (state != SFS_FROZEN)); diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h index fc905c2af53c..653cffcbf869 100644 --- a/fs/gfs2/log.h +++ b/fs/gfs2/log.h @@ -82,7 +82,7 @@ extern void gfs2_log_reserve(struct gfs2_sbd *sdp, struct gfs2_trans *tr, unsigned int *extra_revokes); extern void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, u64 seq, u32 tail, u32 lblock, u32 flags, - int op_flags); + blk_opf_t op_flags); extern void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 type); extern void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 6ba51cbb94cf..90a2d7bc91c4 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -238,7 +238,7 @@ static void gfs2_end_log_write(struct bio *bio) * there is no pending bio, then this is a no-op. */ -void gfs2_log_submit_bio(struct bio **biop, int opf) +void gfs2_log_submit_bio(struct bio **biop, blk_opf_t opf) { struct bio *bio = *biop; if (bio) { @@ -292,7 +292,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno, */ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno, - struct bio **biop, int op, + struct bio **biop, enum req_op op, bio_end_io_t *end_io, bool flush) { struct bio *bio = *biop; diff --git a/fs/gfs2/lops.h b/fs/gfs2/lops.h index f707601597dc..1412ffba1d44 100644 --- a/fs/gfs2/lops.h +++ b/fs/gfs2/lops.h @@ -16,7 +16,7 @@ extern u64 gfs2_log_bmap(struct gfs2_jdesc *jd, unsigned int lbn); extern void gfs2_log_write(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, struct page *page, unsigned size, unsigned offset, u64 blkno); -extern void gfs2_log_submit_bio(struct bio **biop, int opf); +extern void gfs2_log_submit_bio(struct bio **biop, blk_opf_t opf); extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh); extern int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, bool keep_cache); diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 868dcc71b581..fe0fdec628ea 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c @@ -34,7 +34,7 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb { struct buffer_head *bh, *head; int nr_underway = 0; - int write_flags = REQ_META | REQ_PRIO | wbc_to_write_flags(wbc); + blk_opf_t write_flags = REQ_META | REQ_PRIO | wbc_to_write_flags(wbc); BUG_ON(!PageLocked(page)); BUG_ON(!page_has_buffers(page)); @@ -217,8 +217,8 @@ static void gfs2_meta_read_endio(struct bio *bio) * Submit several consecutive buffer head I/O requests as a single bio I/O * request. (See submit_bh_wbc.) */ -static void gfs2_submit_bhs(int op, int op_flags, struct buffer_head *bhs[], - int num) +static void gfs2_submit_bhs(enum req_op op, blk_opf_t op_flags, + struct buffer_head *bhs[], int num) { while (num > 0) { struct buffer_head *bh = *bhs; From patchwork Thu Jun 23 18:05:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1DF6CCA47C for ; Thu, 23 Jun 2022 19:01:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229880AbiFWTBr (ORCPT ); Thu, 23 Jun 2022 15:01:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbiFWTBc (ORCPT ); Thu, 23 Jun 2022 15:01:32 -0400 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EF0160F0D for ; Thu, 23 Jun 2022 11:06:43 -0700 (PDT) Received: by mail-pj1-f50.google.com with SMTP id cv13so330393pjb.4 for ; Thu, 23 Jun 2022 11:06:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4QISfDrQdl2eEQhQFuFgah+fp2LY7IkAXfTzhiFh0/Q=; b=Za76Wg9zBeDPmmVLcPatu/5AekDHix16BFiFFrm9Sw/nHv9C8MH4cfxwmqxQRAxT+M urpdQnccHRwDAfBiChMEHn026+FR2qvtq99AHmAsC1i7+JpYQL9XBaM2nvkxeRgFNMBd cxSP/3R4703JfketjZCR0QCG7M//YeePfVkOV2Q06MXeidVw3Fv8RY3yLWsbMSGU9qGN AzUcik2ycjA6o8IILdDTPrJxhDNorMKJC1Nk+iwjsvglV1rTWd7YBp/K4wdZ0J8Md8vJ JyEPDuUWzCs8wZMxcN5PUuIzI97urYXi9Mw+Q2SjFdy0tOXZw4MZAd/LlmwkMOzBZAi5 6l4g== X-Gm-Message-State: AJIora+AcH1E7YiUvW10yTG1ZoI7fxCTDfNHOfcAdYG4cpGCBQQ1QrNG CJjb5GHHOL9EeZvh/FGuft0= X-Google-Smtp-Source: AGRyM1s1C8oHsKkRXCY+0LotXE28NNpDG6T+SsLOJ6SRBZe4dA2sitqDl1w78BAasOIebUB+TxtNjQ== X-Received: by 2002:a17:90a:c402:b0:1e6:8254:3478 with SMTP id i2-20020a17090ac40200b001e682543478mr5279006pjt.101.1656007602762; Thu, 23 Jun 2022 11:06:42 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:42 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 43/51] fs/hfsplus: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:20 -0700 Message-Id: <20220623180528.3595304-44-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- fs/hfsplus/hfsplus_fs.h | 2 +- fs/hfsplus/wrapper.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index 396e73aa0961..ac93c2445b29 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h @@ -525,7 +525,7 @@ int hfsplus_compare_dentry(const struct dentry *dentry, unsigned int len, /* wrapper.c */ int hfsplus_submit_bio(struct super_block *sb, sector_t sector, void *buf, - void **data, int op, int op_flags); + void **data, enum req_op op, blk_opf_t op_flags); int hfsplus_read_wrapper(struct super_block *sb); /* diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c index 0b8ad6586df5..bf5e89748df0 100644 --- a/fs/hfsplus/wrapper.c +++ b/fs/hfsplus/wrapper.c @@ -45,7 +45,8 @@ struct hfsplus_wd { * will work correctly. */ int hfsplus_submit_bio(struct super_block *sb, sector_t sector, - void *buf, void **data, int op, int op_flags) + void *buf, void **data, enum req_op op, + blk_opf_t op_flags) { struct bio *bio; int ret = 0; @@ -66,7 +67,7 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector, bio = bio_alloc(sb->s_bdev, 1, op | op_flags, GFP_NOIO); bio->bi_iter.bi_sector = sector; - if (op != WRITE && data) + if (op != REQ_OP_WRITE && data) *data = (u8 *)buf + offset; while (io_size > 0) { From patchwork Thu Jun 23 18:05:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893088 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5B4ACCA47F for ; Thu, 23 Jun 2022 19:01:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231682AbiFWTBs (ORCPT ); Thu, 23 Jun 2022 15:01:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231500AbiFWTBg (ORCPT ); Thu, 23 Jun 2022 15:01:36 -0400 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B237E47542 for ; Thu, 23 Jun 2022 11:06:44 -0700 (PDT) Received: by mail-pl1-f171.google.com with SMTP id jh14so1402212plb.1 for ; Thu, 23 Jun 2022 11:06:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JQy39SeZG+twTO0WI2+BNN0Zr2MVVoRDZTiM6bUMTPA=; b=QFusToGjAdAEVBrYN4ovQ+fEJR9d6IkVZu5gxKe2H5m19ULngSjmd+Q6VkodAZfDOD wyGizcH8VLmvseA3Zwg/eStIVJNF5WpwGzgERVI/83cpNGQZV6P6B1qf7RNXieytfmWH RFbsEIrsBttyoO3UNZDq0egYz4TUJpAkQTprwjcciZiYAS7mkeRdys/y9f5LvSdV5rU7 cWfxIS02zIWBJDb0bMzHMiKhHEm/CyOxWqkufANl0LUu5dqJLZMfg/rhIt1FLXXXd4il y7Qb5f0ZhX79nbzxoHRlpXHk/0IiKEU660m70C3bi3FuvnwNK65zpkEurZR9UQkZHdRE YwAQ== X-Gm-Message-State: AJIora9fC0QcVJrR8FX+jfn/cSLnbh+brw7slp0ExiHbvhTng1QdplHi UwEELUlxkrIUMbzi4KJE1w8= X-Google-Smtp-Source: AGRyM1tlFQmhRkX75or0mRdHKyQ61yB3qSw3aYRddBPMUlT+OCLOiidwnLDhXqUZ0U1IIRpfSk6wvQ== X-Received: by 2002:a17:90b:4d88:b0:1ec:aa96:ac92 with SMTP id oj8-20020a17090b4d8800b001ecaa96ac92mr5328730pjb.196.1656007604118; Thu, 23 Jun 2022 11:06:44 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:43 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Al Viro Subject: [PATCH 44/51] fs/iomap: Use the new blk_opf_t type Date: Thu, 23 Jun 2022 11:05:21 -0700 Message-Id: <20220623180528.3595304-45-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for the combination of a request operation and request flags. Cc: Al Viro Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- fs/iomap/direct-io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 5d098adba443..18a3d9357dce 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -52,7 +52,7 @@ struct iomap_dio { }; static struct bio *iomap_dio_alloc_bio(const struct iomap_iter *iter, - struct iomap_dio *dio, unsigned short nr_vecs, unsigned int opf) + struct iomap_dio *dio, unsigned short nr_vecs, blk_opf_t opf) { if (dio->dops && dio->dops->bio_set) return bio_alloc_bioset(iter->iomap.bdev, nr_vecs, opf, @@ -212,10 +212,10 @@ static void iomap_dio_zero(const struct iomap_iter *iter, struct iomap_dio *dio, * mapping, and whether or not we want FUA. Note that we can end up * clearing the WRITE_FUA flag in the dio request. */ -static inline unsigned int iomap_dio_bio_opflags(struct iomap_dio *dio, +static inline blk_opf_t iomap_dio_bio_opflags(struct iomap_dio *dio, const struct iomap *iomap, bool use_fua) { - unsigned int opflags = REQ_SYNC | REQ_IDLE; + blk_opf_t opflags = REQ_SYNC | REQ_IDLE; if (!(dio->flags & IOMAP_DIO_WRITE)) { WARN_ON_ONCE(iomap->flags & IOMAP_F_ZONE_APPEND); @@ -244,7 +244,7 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter, unsigned int fs_block_size = i_blocksize(inode), pad; loff_t length = iomap_length(iter); loff_t pos = iter->pos; - unsigned int bio_opf; + blk_opf_t bio_opf; struct bio *bio; bool need_zeroout = false; bool use_fua = false; From patchwork Thu Jun 23 18:05:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB926C433EF for ; Thu, 23 Jun 2022 19:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229921AbiFWTBw (ORCPT ); Thu, 23 Jun 2022 15:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232166AbiFWTBi (ORCPT ); Thu, 23 Jun 2022 15:01:38 -0400 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65BE51B2 for ; Thu, 23 Jun 2022 11:06:46 -0700 (PDT) Received: by mail-pl1-f173.google.com with SMTP id k7so18835975plg.7 for ; Thu, 23 Jun 2022 11:06:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w33CDd6tc5/NO3OGDJVRMb5SGHoLyjsBZpnjenSoToE=; b=di6XLCPEexc0Yw3hw4w+qwxXNPN+GWtSYX0TA9fI3+eUN8eItU42U31vRA/xfJcRPk qXgrEoA+LiN5F9P8M0Dz7BNrediuxbjAlB56cGQocxRmZRzlvEjqO54935FttTNW/xnV 9/q5aJWBI6gcojQBR1EJhw1bWY7huwyVegtx733V3neETZqc1nwUSBrTvOnOhMnQWDaP J2QlOF+t7BljAB/G+0+Jp6YXY3OWqySxgjegJTCY8IukXxmnOAUdhPiXinAmod9bc29q xV0DYo9sxkL3hfZAmnShP0m087kLanBPHTfqEarfp0M28vcs6jG1ywwGTzXRLegFEVon joEg== X-Gm-Message-State: AJIora/K2QECVBJGi4i9VmKkbjPPTwFp64fPpGukjBNiUCeB+EqlEAII Vl24VvtgvtlHIf7xsLzcUw7/BSzbEkpWJA== X-Google-Smtp-Source: AGRyM1ssnLQAm7f2+uq+UpEUl6i7CBqfUMeyxJ4IFR4iomaf/8R1iflwt4CL91mbIoHywci3C3r7Sg== X-Received: by 2002:a17:90b:4acd:b0:1ed:55f:3ba3 with SMTP id mh13-20020a17090b4acd00b001ed055f3ba3mr5141031pjb.10.1656007605760; Thu, 23 Jun 2022 11:06:45 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:45 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Mike Christie , Theodore Ts'o Subject: [PATCH 45/51] fs/jbd2: Fix the documentation of the jbd2_write_superblock() callers Date: Thu, 23 Jun 2022 11:05:22 -0700 Message-Id: <20220623180528.3595304-46-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Commit 2a222ca992c3 ("fs: have submit_bh users pass in op and flags separately") renamed the jbd2_write_superblock() 'write_op' argument into 'write_flags'. Propagate this change to the jbd2_write_superblock() callers. Additionally, change the type of 'write_flags' into blk_opf_t. Cc: Mike Christie Cc: Theodore Ts'o Signed-off-by: Bart Van Assche --- fs/jbd2/journal.c | 15 ++++++++------- include/linux/jbd2.h | 2 +- include/trace/events/jbd2.h | 12 ++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index c0cbeeaec2d1..b1be8450c50c 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1602,7 +1602,7 @@ static int journal_reset(journal_t *journal) * This function expects that the caller will have locked the journal * buffer head, and will return with it unlocked */ -static int jbd2_write_superblock(journal_t *journal, int write_flags) +static int jbd2_write_superblock(journal_t *journal, blk_opf_t write_flags) { struct buffer_head *bh = journal->j_sb_buffer; journal_superblock_t *sb = journal->j_superblock; @@ -1659,13 +1659,14 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags) * @journal: The journal to update. * @tail_tid: TID of the new transaction at the tail of the log * @tail_block: The first block of the transaction at the tail of the log - * @write_op: With which operation should we write the journal sb + * @write_flags: Flags for the journal sb write operation * * Update a journal's superblock information about log tail and write it to * disk, waiting for the IO to complete. */ int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, - unsigned long tail_block, int write_op) + unsigned long tail_block, + blk_opf_t write_flags) { journal_superblock_t *sb = journal->j_superblock; int ret; @@ -1685,7 +1686,7 @@ int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, sb->s_sequence = cpu_to_be32(tail_tid); sb->s_start = cpu_to_be32(tail_block); - ret = jbd2_write_superblock(journal, write_op); + ret = jbd2_write_superblock(journal, write_flags); if (ret) goto out; @@ -1702,12 +1703,12 @@ int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, /** * jbd2_mark_journal_empty() - Mark on disk journal as empty. * @journal: The journal to update. - * @write_op: With which operation should we write the journal sb + * @write_flags: Flags for the journal sb write operation * * Update a journal's dynamic superblock fields to show that journal is empty. * Write updated superblock to disk waiting for IO to complete. */ -static void jbd2_mark_journal_empty(journal_t *journal, int write_op) +static void jbd2_mark_journal_empty(journal_t *journal, blk_opf_t write_flags) { journal_superblock_t *sb = journal->j_superblock; bool had_fast_commit = false; @@ -1733,7 +1734,7 @@ static void jbd2_mark_journal_empty(journal_t *journal, int write_op) had_fast_commit = true; } - jbd2_write_superblock(journal, write_op); + jbd2_write_superblock(journal, write_flags); if (had_fast_commit) jbd2_set_feature_fast_commit(journal); diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index e79d6e0b14e8..dc1724131300 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1557,7 +1557,7 @@ extern int jbd2_journal_wipe (journal_t *, int); extern int jbd2_journal_skip_recovery (journal_t *); extern void jbd2_journal_update_sb_errno(journal_t *); extern int jbd2_journal_update_sb_log_tail (journal_t *, tid_t, - unsigned long, int); + unsigned long, blk_opf_t); extern void jbd2_journal_abort (journal_t *, int); extern int jbd2_journal_errno (journal_t *); extern void jbd2_journal_ack_err (journal_t *); diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h index a4dfe005983d..91dae1f678fe 100644 --- a/include/trace/events/jbd2.h +++ b/include/trace/events/jbd2.h @@ -355,22 +355,22 @@ TRACE_EVENT(jbd2_update_log_tail, TRACE_EVENT(jbd2_write_superblock, - TP_PROTO(journal_t *journal, int write_op), + TP_PROTO(journal_t *journal, blk_opf_t write_flags), - TP_ARGS(journal, write_op), + TP_ARGS(journal, write_flags), TP_STRUCT__entry( __field( dev_t, dev ) - __field( int, write_op ) + __field( u32, write_flags ) ), TP_fast_assign( __entry->dev = journal->j_fs_dev->bd_dev; - __entry->write_op = write_op; + __entry->write_flags = (__force u32)write_flags; ), - TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev), - MINOR(__entry->dev), __entry->write_op) + TP_printk("dev %d,%d write_flags %x", MAJOR(__entry->dev), + MINOR(__entry->dev), __entry->write_flags) ); TRACE_EVENT(jbd2_lock_buffer_stall, From patchwork Thu Jun 23 18:05:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893090 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66ABAC43334 for ; Thu, 23 Jun 2022 19:01:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230340AbiFWTBx (ORCPT ); Thu, 23 Jun 2022 15:01:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230181AbiFWTBj (ORCPT ); Thu, 23 Jun 2022 15:01:39 -0400 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C58AC60C77 for ; Thu, 23 Jun 2022 11:06:47 -0700 (PDT) Received: by mail-pj1-f53.google.com with SMTP id w19-20020a17090a8a1300b001ec79064d8dso3384614pjn.2 for ; Thu, 23 Jun 2022 11:06:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OiRFOz/pc58fJY7R3kmiJRoWVSH6zT3FtqNeu7uf5ZI=; b=BX8ZhWP9PZu3a37x8h17w+ihl5DjMpIqIQC43hzVAw0e8R9Y94MdXoG+mC12PArfRJ Cxx28p2IdP7JZZas8XZSSwRvOkgSaBMRFygIIwb19zO3HNo5xaxIEoc3Bx4jinxmrPrr FRUsbh8kzYnlAHVV4wFgV9sQd7JHfq5M1+SYmTXPPBBQwky7X4Kau3+WVWX0yK035jBK sgSF2RRf+1883LWn9E2jvENEMcvUMCPpbk9zXJJe0jIpA0UE+Lo4DgnP98qgH86TJDOT 0xEKHT7hUHGAFHESaHUZFbW+W1UXzOVc37D5+sTSOSGZfzwLVFn0Ts1WBY93KZKQbLvQ 5NyA== X-Gm-Message-State: AJIora9mxy4aSuCCMCRXn/14LCN61GcFNkJHgphJqJC4OwZ1O95JvUv/ PFblQxqGvYcVYuvn6Yh8KD6aDGUx3d3ajg== X-Google-Smtp-Source: AGRyM1sf/vsM1zEmtW2mlHr7TUWgGoJgCkN5ZzJKOUa4uS7nbcLH8ZqR87CiH2m/iwvcbO9K5YHzHw== X-Received: by 2002:a17:902:8d98:b0:168:a310:3ea6 with SMTP id v24-20020a1709028d9800b00168a3103ea6mr39803886plo.9.1656007607093; Thu, 23 Jun 2022 11:06:47 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:46 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ryusuke Konishi Subject: [PATCH 46/51] fs/nilfs: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:23 -0700 Message-Id: <20220623180528.3595304-47-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Ryusuke Konishi Signed-off-by: Bart Van Assche Acked-by: Ryusuke Konishi --- fs/nilfs2/btnode.c | 4 ++-- fs/nilfs2/btnode.h | 5 +++-- fs/nilfs2/mdt.c | 3 ++- include/trace/events/nilfs2.h | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c index ca611ac09f7c..13784cf169ca 100644 --- a/fs/nilfs2/btnode.c +++ b/fs/nilfs2/btnode.c @@ -70,8 +70,8 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr) } int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr, - sector_t pblocknr, int mode, int mode_flags, - struct buffer_head **pbh, sector_t *submit_ptr) + sector_t pblocknr, enum req_op mode, blk_opf_t mode_flags, + struct buffer_head **pbh, sector_t *submit_ptr) { struct buffer_head *bh; struct inode *inode = btnc->host; diff --git a/fs/nilfs2/btnode.h b/fs/nilfs2/btnode.h index bd5544e63a01..b7d2948dc74f 100644 --- a/fs/nilfs2/btnode.h +++ b/fs/nilfs2/btnode.h @@ -34,8 +34,9 @@ void nilfs_init_btnc_inode(struct inode *btnc_inode); void nilfs_btnode_cache_clear(struct address_space *); struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr); -int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t, int, - int, struct buffer_head **, sector_t *); +int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t, + enum req_op, blk_opf_t, struct buffer_head **, + sector_t *); void nilfs_btnode_delete(struct buffer_head *); int nilfs_btnode_prepare_change_key(struct address_space *, struct nilfs_btnode_chkey_ctxt *); diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index d29a0f2b9c16..19d878f0e923 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c @@ -112,7 +112,8 @@ static int nilfs_mdt_create_block(struct inode *inode, unsigned long block, static int nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff, - int mode, int mode_flags, struct buffer_head **out_bh) + enum req_op mode, blk_opf_t mode_flags, + struct buffer_head **out_bh) { struct buffer_head *bh; __u64 blknum = 0; diff --git a/include/trace/events/nilfs2.h b/include/trace/events/nilfs2.h index 84ee31fc04cc..05668a783042 100644 --- a/include/trace/events/nilfs2.h +++ b/include/trace/events/nilfs2.h @@ -192,7 +192,7 @@ TRACE_EVENT(nilfs2_mdt_submit_block, TP_PROTO(struct inode *inode, unsigned long ino, unsigned long blkoff, - int mode), + enum req_op mode), TP_ARGS(inode, ino, blkoff, mode), @@ -207,7 +207,7 @@ TRACE_EVENT(nilfs2_mdt_submit_block, __entry->inode = inode; __entry->ino = ino; __entry->blkoff = blkoff; - __entry->mode = mode; + __entry->mode = (__force int)mode; ), TP_printk("inode = %p ino = %lu blkoff = %lu mode = %x", From patchwork Thu Jun 23 18:05:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893091 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 835AFC433EF for ; Thu, 23 Jun 2022 19:01:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231315AbiFWTBy (ORCPT ); Thu, 23 Jun 2022 15:01:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbiFWTBm (ORCPT ); Thu, 23 Jun 2022 15:01:42 -0400 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FDDA4F1F8 for ; Thu, 23 Jun 2022 11:06:49 -0700 (PDT) Received: by mail-pl1-f175.google.com with SMTP id d5so18803537plo.12 for ; Thu, 23 Jun 2022 11:06:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XH56dl7M34VcJLvlT7/jJn+XRwYnxiP7hAZYFPzpxZE=; b=7Oh3l7ZX0EEM/E3Wy/k3PHLVQ06UyXRbWkYh2X4jhbO4llFtn8wVgG15n4/QvONkZt wtm2joH5uLFgy7gMmjBzrBYiX42CRKB2PZVe78ybOfv/QiOkfRNRgVrMaF4Kjk1//bX5 NoW+p9pzObDR4sadlaUvkjl0MmZH8+YXKAA74rXa0GKW90tgvEW+/E40G4ut+vji0qoN 9k5+qdaZ0hc9O9Bhwpfn+OV/7RjE69HnJcoQZ/Uu0xTG42EeVOo4mpJ0sAjuc4olFR3k hWBsxoDbYkPGgYdoL25MLr7SRecCR7G4eevY0McbUSTrns/vqkRxDfFPC5gNHFJwouUU fVQw== X-Gm-Message-State: AJIora+Gugj9rzvgqd4mIwENdQbnhybNhw/bU/F2cR9Elyo2IQyahZ3m vXIKVxthddWUuEHRO6EAv7I= X-Google-Smtp-Source: AGRyM1tPYPVt8SdRyv/3RZ1ZIGXNkd38DSbr5xQ1sUiUDn/lA9Zz/0HPsqLYWg8btjXUtqXVy8bknQ== X-Received: by 2002:a17:90a:aa96:b0:1ea:3780:c3dc with SMTP id l22-20020a17090aaa9600b001ea3780c3dcmr5227013pjq.241.1656007608907; Thu, 23 Jun 2022 11:06:48 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:48 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Konstantin Komarov Subject: [PATCH 47/51] fs/ntfs3: Use enum req_op where appropriate Date: Thu, 23 Jun 2022 11:05:24 -0700 Message-Id: <20220623180528.3595304-48-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using enum req_op instead of u32 for block layer request operations. Cc: Konstantin Komarov Signed-off-by: Bart Van Assche --- fs/ntfs3/fsntfs.c | 2 +- fs/ntfs3/ntfs_fs.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index 3de5700a9b83..1835e35199c2 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -1448,7 +1448,7 @@ int ntfs_write_bh(struct ntfs_sb_info *sbi, struct NTFS_RECORD_HEADER *rhdr, */ int ntfs_bio_pages(struct ntfs_sb_info *sbi, const struct runs_tree *run, struct page **pages, u32 nr_pages, u64 vbo, u32 bytes, - u32 op) + enum req_op op) { int err = 0; struct bio *new, *bio = NULL; diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 8de129a6419b..3a8abf13143e 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -617,7 +617,7 @@ int ntfs_write_bh(struct ntfs_sb_info *sbi, struct NTFS_RECORD_HEADER *rhdr, struct ntfs_buffers *nb, int sync); int ntfs_bio_pages(struct ntfs_sb_info *sbi, const struct runs_tree *run, struct page **pages, u32 nr_pages, u64 vbo, u32 bytes, - u32 op); + enum req_op op); int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const struct runs_tree *run); int ntfs_vbo_to_lbo(struct ntfs_sb_info *sbi, const struct runs_tree *run, u64 vbo, u64 *lbo, u64 *bytes); From patchwork Thu Jun 23 18:05:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893092 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76013C43334 for ; Thu, 23 Jun 2022 19:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231493AbiFWTB4 (ORCPT ); Thu, 23 Jun 2022 15:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231567AbiFWTBm (ORCPT ); Thu, 23 Jun 2022 15:01:42 -0400 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 603C460F1B for ; Thu, 23 Jun 2022 11:06:51 -0700 (PDT) Received: by mail-pl1-f181.google.com with SMTP id jb13so5238239plb.9 for ; Thu, 23 Jun 2022 11:06:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ANaLQsYq39oxXtFTb+4mxeNrtDqVwkMZazBpJYrq+bg=; b=qJZvgPIX4qk3w7RHJepDkZ/RmD9vMBvoombTRtZpRKj0vx98W7QLvi1qqBybNIquNp wXVnjFBYaN4+s4td7oPCW4Fq2lKJBEKMDkW8gzcGT7v4N8Av0rXaGNtYSEQ7br46ZDxX o+tU3pGRI0GD6CTvjzrjZhO+2TP+tkiwZJenkY6jtuFzD5pdZD8dtT24MQyMoxL0a841 bXZyCvaDzg9W3aboweMzf7FqR2hdIFlRKeSW1ycfU1FQUi8PLbxGIgT0QXn1nkFYLSBn aHRaejxa/A7KxE+71L8DVsjIiLFpX+VsAJrkNvE5HKse/DJ+2gGEsBJ478tOsunxvJFF 8zuQ== X-Gm-Message-State: AJIora8ftdLm1pGr94E2hyx+a/DJD/BT43G7iQQnpV5P2Pt+4uMWZQDC 0JSiFfxFpe4a9wn4TIrYf9I= X-Google-Smtp-Source: AGRyM1tyDMaWOv6txGSJknbXRVugxZC23u3Px/Nnpz+Q1CAxjIC43DNcd0lH2nNfRKLDbV59pjTYJA== X-Received: by 2002:a17:902:c943:b0:16a:3ab8:3678 with SMTP id i3-20020a170902c94300b0016a3ab83678mr13852779pla.56.1656007610719; Thu, 23 Jun 2022 11:06:50 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:49 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Mark Fasheh , Joel Becker , Joseph Qi Subject: [PATCH 48/51] fs/ocfs2: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:25 -0700 Message-Id: <20220623180528.3595304-49-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Mark Fasheh Cc: Joel Becker Cc: Joseph Qi Signed-off-by: Bart Van Assche Acked-by: Joseph Qi --- fs/ocfs2/cluster/heartbeat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index ea0e70c0fce0..e955aca87936 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c @@ -503,8 +503,8 @@ static void o2hb_bio_end_io(struct bio *bio) static struct bio *o2hb_setup_one_bio(struct o2hb_region *reg, struct o2hb_bio_wait_ctxt *wc, unsigned int *current_slot, - unsigned int max_slots, int op, - int op_flags) + unsigned int max_slots, enum req_op op, + blk_opf_t op_flags) { int len, current_page; unsigned int vec_len, vec_start; From patchwork Thu Jun 23 18:05:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893093 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85F85CCA47C for ; Thu, 23 Jun 2022 19:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231567AbiFWTB5 (ORCPT ); Thu, 23 Jun 2022 15:01:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231696AbiFWTBo (ORCPT ); Thu, 23 Jun 2022 15:01:44 -0400 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9853C60F32 for ; Thu, 23 Jun 2022 11:06:53 -0700 (PDT) Received: by mail-pj1-f44.google.com with SMTP id n16-20020a17090ade9000b001ed15b37424so340502pjv.3 for ; Thu, 23 Jun 2022 11:06:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xcxVFeJnoTHrDFd+Jax7HwCAg9gLuZIP6Eln3ZPSdh0=; b=jWmaDFuLNKshE/jPkl+0OhPLnjhyGadM3Rnn9z3Xwp5t6G+CxlN4UCh7r8EdExjQd9 X4RTE3e5Oj9LMnvZ5CBYZB8V4my226tWUIvbLDAh/R13WR6i59BUKaqzYGnIOvBmL4hE j6ynLt3ZpX9qR667xhCSqsY8LqTMi40lQ/CC0G3Syw4s2e4YsGtA79dGi3YkxSuYqO7j YkC9ybxhHvWSs9vqsdiAHM+L8Jm6b+aB4gSFW+wDypHiUJ3GmCwCYVSD0/1xuvziXX2o aFvmsatCoQlN86dtYFXJf2r5FPgaCkyXu+//t5HQqUpcLjQxNRN7jSBA8SnpVXZUw+vQ 3ZjA== X-Gm-Message-State: AJIora+3meFycuqoWs7On3dNRCgt05xj3DHhCHiSwm/3tS5LyDcgfUDS 6+dF86L6bVNFiL/5LC2q18Q= X-Google-Smtp-Source: AGRyM1vQn6qOqm6hD2x7E/3UA7liRSXqRqVJcuB3C/kV2Bfk14r/1jGGBUQYRiMV9CLaLYTY212WiQ== X-Received: by 2002:a17:90b:3557:b0:1ec:cd27:1ca9 with SMTP id lt23-20020a17090b355700b001eccd271ca9mr5155123pjb.148.1656007612328; Thu, 23 Jun 2022 11:06:52 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:51 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Rafael J . Wysocki" Subject: [PATCH 49/51] PM: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:26 -0700 Message-Id: <20220623180528.3595304-50-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for variables that represent request flags. Cc: Rafael J. Wysocki Cc: Christoph Hellwig Signed-off-by: Bart Van Assche Acked-by: Rafael J. Wysocki --- kernel/power/swap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 91fffdd2c7fb..db01cac40a4c 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c @@ -269,8 +269,8 @@ static void hib_end_io(struct bio *bio) bio_put(bio); } -static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr, - struct hib_bio_batch *hb) +static int hib_submit_io(enum req_op op, blk_opf_t op_flags, + pgoff_t page_off, void *addr, struct hib_bio_batch *hb) { struct page *page = virt_to_page(addr); struct bio *bio; From patchwork Thu Jun 23 18:05:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893094 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0A11C43334 for ; Thu, 23 Jun 2022 19:02:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbiFWTB7 (ORCPT ); Thu, 23 Jun 2022 15:01:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231877AbiFWTBp (ORCPT ); Thu, 23 Jun 2022 15:01:45 -0400 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F0E960F38 for ; Thu, 23 Jun 2022 11:06:54 -0700 (PDT) Received: by mail-pl1-f177.google.com with SMTP id m14so18832357plg.5 for ; Thu, 23 Jun 2022 11:06:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JfTDvfTK6+TcFj85MvGtQ2BzwTY2bgwPALXrVpGLWiA=; b=o/9MNRbMfnoAa5nMDMt5n1AYA4JhEZufLp+xha4mvIS4mm5gFxS/00/7OxKqR4gLt8 UIGdclpgR3BD87wgm/lPrRmbBXUc3A1SvRfz4lyqSRLRCja+SWet3iIBEl0T0d1jQJzs hUuyQFBmA8hJJXBeJBuE8NQJAELLXyZ9aXii+hAewYxL6VTtnzPQNrtLdJEe4K9jiT2n 7Ey7m0ghpVpdK4HUPB5KOZLBvHST6+x9PAGQhj4L1viMpXV2TPkehr/zHXN+xom/0VRK RjUAMC8xs4dgK47XcfaNE80vMFQ2f/ECwB0U4rxXyhtCjwmkDFJhFnx3QsC/cGXPH/oe b4dQ== X-Gm-Message-State: AJIora/+9MM8mZsEc77tN5t2wUr/4lxPxKK4D4t3ubKrjnS8f8g5rRpv M6Iri2VnZk7/yiCxWwTHaec= X-Google-Smtp-Source: AGRyM1vauuknEQ8DfHYM7PMUum1pq3RjS6jjxfIETc16jhaEPBfDhYAaRbXLRw78X7zmzzi8TrmN9g== X-Received: by 2002:a17:90b:4b41:b0:1ec:cb06:2fa3 with SMTP id mi1-20020a17090b4b4100b001eccb062fa3mr5171497pjb.55.1656007613856; Thu, 23 Jun 2022 11:06:53 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:53 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Darrick J . Wong" Subject: [PATCH 50/51] fs/xfs: Use the enum req_op and blk_opf_t types Date: Thu, 23 Jun 2022 11:05:27 -0700 Message-Id: <20220623180528.3595304-51-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Improve static type checking by using the enum req_op type for variables that represent a request operation and the new blk_opf_t type for the combination of a request operation with request flags. Cc: Darrick J. Wong Cc: Christoph Hellwig Signed-off-by: Bart Van Assche Acked-by: Darrick J. Wong --- fs/xfs/xfs_bio_io.c | 2 +- fs/xfs/xfs_buf.c | 4 ++-- fs/xfs/xfs_linux.h | 2 +- fs/xfs/xfs_log_recover.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/xfs/xfs_bio_io.c b/fs/xfs/xfs_bio_io.c index ae4345b37621..fe21c76f75b8 100644 --- a/fs/xfs/xfs_bio_io.c +++ b/fs/xfs/xfs_bio_io.c @@ -15,7 +15,7 @@ xfs_rw_bdev( sector_t sector, unsigned int count, char *data, - unsigned int op) + enum req_op op) { unsigned int is_vmalloc = is_vmalloc_addr(data); diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index bf4e60871068..5e8f40d8c052 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1416,7 +1416,7 @@ xfs_buf_ioapply_map( int map, int *buf_offset, int *count, - int op) + blk_opf_t op) { int page_index; unsigned int total_nr_pages = bp->b_page_count; @@ -1493,7 +1493,7 @@ _xfs_buf_ioapply( struct xfs_buf *bp) { struct blk_plug plug; - int op; + blk_opf_t op; int offset; int size; int i; diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h index cb9105d667db..f9878021e7d0 100644 --- a/fs/xfs/xfs_linux.h +++ b/fs/xfs/xfs_linux.h @@ -196,7 +196,7 @@ static inline uint64_t howmany_64(uint64_t x, uint32_t y) } int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count, - char *data, unsigned int op); + char *data, enum req_op op); #define ASSERT_ALWAYS(expr) \ (likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__)) diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 5f7e4e6e33ce..940c8107cbd4 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -122,7 +122,7 @@ xlog_do_io( xfs_daddr_t blk_no, unsigned int nbblks, char *data, - unsigned int op) + enum req_op op) { int error; From patchwork Thu Jun 23 18:05:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 12893095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0BF1C433EF for ; Thu, 23 Jun 2022 19:02:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231857AbiFWTCE (ORCPT ); Thu, 23 Jun 2022 15:02:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232007AbiFWTBr (ORCPT ); Thu, 23 Jun 2022 15:01:47 -0400 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E3E910FA44 for ; Thu, 23 Jun 2022 11:06:56 -0700 (PDT) Received: by mail-pl1-f172.google.com with SMTP id c4so2631707plc.8 for ; Thu, 23 Jun 2022 11:06:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jnE/YgHw2EtnT+Jh86RbozgbnpRo/XT0jIlRtsTryeI=; b=tx9iUthFYoGqPek20anf1HBQ3wynnyPwn572hKAw4sDaIuhlTI5lnhJ9Vj/Z4FDFb+ tvHh6ls8C4KEjtJY78zc6INpHiG79lD7OfGcsByyQ6wexixN4wZihxFNEBLL5tTUhg0S 0bPOSfdZR8d+92zqHwXLHDVt9o24DRTXNSakwIzQcnc5YdM5BIMocuOyS2dtyO+QqwdO 0/NPzWamUBHkLA41nEY6EWSZ8RXN1MY5FBPVO7y6QEIe1CfxqHhIvxXrkL7Z2xnnC1W5 FDX0D7UedPS16VaKBjg9V+5dD8SVb34j7RW02rto8AlbI88f7yo4DJNl+UXXG17gl1w5 uaaA== X-Gm-Message-State: AJIora9nfa+gInQLBx8jPwcyirHerVg0d5SBZijQZbbl1CRfy1M0tThb cjI3I013rc0tuQc3AeFMPy8= X-Google-Smtp-Source: AGRyM1tAYewKTneU/+C8hYri0jY6hO1rRRpJkGdGDJVQmCETpyEQjqo2/wM3H61jjxW1OZ9vTa1GiA== X-Received: by 2002:a17:902:ec83:b0:16a:3029:a44 with SMTP id x3-20020a170902ec8300b0016a30290a44mr17907037plg.141.1656007615605; Thu, 23 Jun 2022 11:06:55 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:70af:1dc5:d20:a563]) by smtp.gmail.com with ESMTPSA id a18-20020a056a000c9200b0051c4ecb0e3dsm16019967pfv.193.2022.06.23.11.06.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:06:55 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Damien Le Moal , Naohiro Aota , Johannes Thumshirn Subject: [PATCH 51/51] fs/zonefs: Fix sparse warnings in tracing code Date: Thu, 23 Jun 2022 11:05:28 -0700 Message-Id: <20220623180528.3595304-52-bvanassche@acm.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220623180528.3595304-1-bvanassche@acm.org> References: <20220623180528.3595304-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Since __bitwise types are not supported by the tracing infrastructure, store the operation type as an int in the tracing event. Cc: Damien Le Moal Cc: Naohiro Aota Cc: Johannes Thumshirn Signed-off-by: Bart Van Assche Acked-by: Damien Le Moal Signed-off-by: Bart Van Assche --- fs/zonefs/trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/zonefs/trace.h b/fs/zonefs/trace.h index 21501da764bd..8707e1c3023c 100644 --- a/fs/zonefs/trace.h +++ b/fs/zonefs/trace.h @@ -32,15 +32,15 @@ TRACE_EVENT(zonefs_zone_mgmt, TP_fast_assign( __entry->dev = inode->i_sb->s_dev; __entry->ino = inode->i_ino; - __entry->op = op; + __entry->op = (__force int)op; __entry->sector = ZONEFS_I(inode)->i_zsector; __entry->nr_sectors = ZONEFS_I(inode)->i_zone_size >> SECTOR_SHIFT; ), TP_printk("bdev=(%d,%d), ino=%lu op=%s, sector=%llu, nr_sectors=%llu", show_dev(__entry->dev), (unsigned long)__entry->ino, - blk_op_str(__entry->op), __entry->sector, - __entry->nr_sectors + blk_op_str((__force enum req_op)__entry->op), + __entry->sector, __entry->nr_sectors ) );