fix confusion around GFP_* flags and blk_get_request
Subsystems (18)
Christoph Hellwig
reviewerHi all,
this series sorts out the mess around how we use gfp flags in the block layer get_request interface.
Christoph Hellwig
reviewerPATCH 1/7 scsi/osd: remove the gfp argument to osd_start_request
Always GFP_KERNEL, and keeping it would cause serious complications for the next change.
--- drivers/scsi/osd/osd_initiator.c | 24 +++++++++++------------- fs/exofs/ore.c | 10 +++++----- fs/exofs/super.c | 2 +- include/scsi/osd_initiator.h | 6 +----- 4 files changed, 18 insertions(+), 24 deletions(-)
drivers/scsi/osd/osd_initiator.c +11 -13
@@ -99,7 +99,7 @@ static int _osd_get_print_system_info(struct osd_dev *od,int nelem =ARRAY_SIZE (get_attrs), a =0 ;int ret; - or =osd_start_request (od,GFP_KERNEL ); + or =osd_start_request (od);if (!or)return -ENOMEM ;
@@ -409,16 +409,15 @@ static void _osd_request_free(struct osd_request *or)kfree (or); } -struct osd_request *osd_start_request (struct osd_dev *dev,gfp_t gfp) +struct osd_request *osd_start_request (struct osd_dev *dev) {struct osd_request *or; - or =_osd_request_alloc (gfp); + or =_osd_request_alloc (GFP_KERNEL );if (!or)return NULL ; or->osd_dev = dev; - or->alloc_flags = gfp; or->timeout = dev->def_timeout; or->retries =OSD_REQ_RETRIES ;
@@ -546,7 +545,7 @@ static int _osd_realloc_seg(struct osd_request *or,if (seg->alloc_size >= max_bytes)return 0 ; - buff =krealloc (seg->buff, max_bytes, or->alloc_flags); + buff =krealloc (seg->buff, max_bytes,GFP_KERNEL );if (!buff) {OSD_ERR ("Failed to Realloc %d-bytes was-%d\n" , max_bytes, seg->alloc_size);
@@ -728,7 +727,7 @@ static int _osd_req_list_objects(struct osd_request *or,_osd_req_encode_olist (or, list);WARN_ON (or->in.bio); - bio =bio_map_kern (q, list, len, or->alloc_flags); + bio =bio_map_kern (q, list, len,GFP_KERNEL );if (IS_ERR (bio)) {OSD_ERR ("!!! Failed to allocate list_objects BIO\n" );return PTR_ERR (bio);
@@ -1190,14 +1189,14 @@ static int _req_append_segment(struct osd_request *or, pad_buff = io->pad_buff; ret =blk_rq_map_kern (io->req->q, io->req, pad_buff, padding, - or->alloc_flags); +GFP_KERNEL );if (ret)return ret; io->total_bytes += padding; } ret =blk_rq_map_kern (io->req->q, io->req, seg->buff, seg->total_bytes, - or->alloc_flags); +GFP_KERNEL );if (ret)return ret;
@@ -1564,14 +1563,14 @@ static int _osd_req_finalize_data_integrity(struct osd_request *or,* osd_finalize_request and helpers */ static struct request *_make_request (struct request_queue *q,bool has_write, -struct _osd_io_info *oii,gfp_t flags) +struct _osd_io_info *oii) {struct request *req;struct bio *bio = oii->bio;int ret; req =blk_get_request (q, has_write ?REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN , - flags); +GFP_KERNEL );if (IS_ERR (req))return req;
@@ -1589,13 +1588,12 @@ static struct request *_make_request(struct request_queue *q, bool has_write,static int _init_blk_request (struct osd_request *or,bool has_in,bool has_out) { -gfp_t flags = or->alloc_flags;struct scsi_device *scsi_device = or->osd_dev->scsi_device;struct request_queue *q = scsi_device->request_queue;struct request *req;int ret; - req =_make_request (q, has_out, has_out ? &or->out : &or->in, flags); + req =_make_request (q, has_out, has_out ? &or->out : &or->in);if (IS_ERR (req)) { ret =PTR_ERR (req); goto out;
@@ -1611,7 +1609,7 @@ static int _init_blk_request(struct osd_request *or, or->out.req = req;if (has_in) {/* allocate bidi request */ - req =_make_request (q, false, &or->in, flags); + req =_make_request (q, false, &or->in);if (IS_ERR (req)) {OSD_DEBUG ("blk_get_request for bidi failed\n" ); ret =PTR_ERR (req);
fs/exofs/ore.c +5 -5
@@ -790,7 +790,7 @@ int ore_create(struct ore_io_state *ios)for (i =0 ; i < ios->oc->numdevs; i++) {struct osd_request *or; - or =osd_start_request (_ios_od (ios, i),GFP_KERNEL ); + or =osd_start_request (_ios_od (ios, i));if (unlikely (!or)) {ORE_ERR ("%s: osd_start_request failed\n" , __func__); ret = -ENOMEM ;
@@ -815,7 +815,7 @@ int ore_remove(struct ore_io_state *ios)for (i =0 ; i < ios->oc->numdevs; i++) {struct osd_request *or; - or =osd_start_request (_ios_od (ios, i),GFP_KERNEL ); + or =osd_start_request (_ios_od (ios, i));if (unlikely (!or)) {ORE_ERR ("%s: osd_start_request failed\n" , __func__); ret = -ENOMEM ;
@@ -847,7 +847,7 @@ static int _write_mirror(struct ore_io_state *ios, int cur_comp)struct ore_per_dev_state *per_dev = &ios->per_dev[cur_comp];struct osd_request *or; - or =osd_start_request (_ios_od (ios, dev),GFP_KERNEL ); + or =osd_start_request (_ios_od (ios, dev));if (unlikely (!or)) {ORE_ERR ("%s: osd_start_request failed\n" , __func__); ret = -ENOMEM ;
@@ -966,7 +966,7 @@ int _ore_read_mirror(struct ore_io_state *ios, unsigned cur_comp)return 0 ;/* Just an empty slot */ first_dev = per_dev->dev + first_dev % ios->layout->mirrors_p1; - or =osd_start_request (_ios_od (ios, first_dev),GFP_KERNEL ); + or =osd_start_request (_ios_od (ios, first_dev));if (unlikely (!or)) {ORE_ERR ("%s: osd_start_request failed\n" , __func__);return -ENOMEM ;
@@ -1060,7 +1060,7 @@ static int _truncate_mirrors(struct ore_io_state *ios, unsigned cur_comp,struct ore_per_dev_state *per_dev = &ios->per_dev[cur_comp];struct osd_request *or; - or =osd_start_request (_ios_od (ios, cur_comp),GFP_KERNEL ); + or =osd_start_request (_ios_od (ios, cur_comp));if (unlikely (!or)) {ORE_ERR ("%s: osd_start_request failed\n" , __func__);return -ENOMEM ;
fs/exofs/super.c +1 -1
@@ -229,7 +229,7 @@ void exofs_make_credential(u8 cred_a[OSD_CAP_LEN], const struct osd_obj_id *obj)static int exofs_read_kern (struct osd_dev *od,u8 *cred,struct osd_obj_id *obj,u64 offset,void *p,unsigned length) { -struct osd_request *or =osd_start_request (od,GFP_KERNEL ); +struct osd_request *or =osd_start_request (od);/* struct osd_sense_info osi = {.key = 0};*/ int ret;
include/scsi/osd_initiator.h +1 -5
@@ -148,7 +148,6 @@ struct osd_request {u8 *pad_buff; } out, in; -gfp_t alloc_flags;unsigned timeout;unsigned retries;unsigned sense_len;
@@ -202,14 +201,11 @@ static inline bool osd_req_is_ver1(struct osd_request *or)* * @osd_dev: OSD device that holds the scsi-device and default values * that the request is associated with. -* @gfp: The allocation flags to use for request allocation, and all -* subsequent allocations. This will be stored at -* osd_request->alloc_flags, can be changed by user later * * Allocate osd_request and initialize all members to the * default/initial state. */ -struct osd_request *osd_start_request (struct osd_dev *od,gfp_t gfp); +struct osd_request *osd_start_request (struct osd_dev *od);enum osd_req_options {OSD_REQ_FUA =0x08 ,/* Force Unit Access */
Signature · 1 line
2.16.3
Christoph Hellwig
reviewerPATCH 2/7 block: fix __get_request documentation
In reply to Christoph Hellwig--- block/blk-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-core.c +1 -1
@@ -1517,7 +1517,7 @@ static struct request *__get_request(struct request_list *rl, unsigned int op,* @bio: bio to allocate request for (can be %NULL) * @flags: BLK_MQ_REQ_* flags. * -* Get a free request from @q. If %__GFP_DIRECT_RECLAIM is set in @gfp_mask, +* Get a free request from @q. If %BLK_MQ_REQ_NOWAIT is set in @flags, * this function keeps retrying under memory pressure and fails iff @q is dead. * * Must be called with @q->queue_lock held and,
Signature · 1 line
2.16.3
Christoph Hellwig
reviewerPATCH 3/7 block: sanitize blk_get_request calling conventions
In reply to Christoph HellwigSwitch everyone to blk_get_request_flags, and then rename blk_get_request_flags to blk_get_request.
--- block/blk-core.c | 14 +++----------- block/bsg.c | 5 ++--- block/scsi_ioctl.c | 8 +++----- drivers/block/paride/pd.c | 2 +- drivers/block/pktcdvd.c | 2 +- drivers/block/sx8.c | 2 +- drivers/block/virtio_blk.c | 2 +- drivers/cdrom/cdrom.c | 2 +- drivers/ide/ide-atapi.c | 2 +- drivers/ide/ide-cd.c | 2 +- drivers/ide/ide-cd_ioctl.c | 2 +- drivers/ide/ide-devsets.c | 2 +- drivers/ide/ide-disk.c | 2 +- drivers/ide/ide-ioctls.c | 4 ++-- drivers/ide/ide-park.c | 4 ++-- drivers/ide/ide-pm.c | 5 ++--- drivers/ide/ide-tape.c | 2 +- drivers/ide/ide-taskfile.c | 2 +- drivers/md/dm-mpath.c | 3 ++- drivers/mmc/core/block.c | 12 +++++------- drivers/scsi/osd/osd_initiator.c | 2 +- drivers/scsi/osst.c | 2 +- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/scsi_lib.c | 2 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/target/target_core_pscsi.c | 3 +-- fs/nfsd/blocklayout.c | 2 +- include/linux/blkdev.h | 5 +---- 29 files changed, 42 insertions(+), 59 deletions(-)
block/blk-core.c +3 -11
@@ -1606,13 +1606,13 @@ static struct request *blk_old_get_request(struct request_queue *q, }/** -* blk_get_request_flags - allocate a request +* blk_get_request - allocate a request * @q: request queue to allocate a request for * @op: operation (REQ_OP_*) and REQ_* flags, e.g. REQ_SYNC. * @flags: BLK_MQ_REQ_* flags, e.g. BLK_MQ_REQ_NOWAIT. */ -struct request *blk_get_request_flags (struct request_queue *q,unsigned int op, -blk_mq_req_flags_t flags) +struct request *blk_get_request (struct request_queue *q,unsigned int op, +blk_mq_req_flags_t flags) {struct request *req;
@@ -1631,14 +1631,6 @@ struct request *blk_get_request_flags(struct request_queue *q, unsigned int op,return req; } -EXPORT_SYMBOL (blk_get_request_flags); - -struct request *blk_get_request (struct request_queue *q,unsigned int op, -gfp_t gfp_mask) -{ -return blk_get_request_flags (q, op, gfp_mask & __GFP_DIRECT_RECLAIM ? -0 :BLK_MQ_REQ_NOWAIT ); -}EXPORT_SYMBOL (blk_get_request);/**
block/bsg.c +2 -3
@@ -226,8 +226,7 @@ bsg_map_hdr(struct request_queue *q, struct sg_io_v4 *hdr, fmode_t mode)return ERR_PTR (ret); rq =blk_get_request (q, hdr->dout_xfer_len ? -REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN , -GFP_KERNEL ); +REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,0 );if (IS_ERR (rq))return rq;
@@ -249,7 +248,7 @@ bsg_map_hdr(struct request_queue *q, struct sg_io_v4 *hdr, fmode_t mode) goto out; } - next_rq =blk_get_request (q,REQ_OP_SCSI_IN ,GFP_KERNEL ); + next_rq =blk_get_request (q,REQ_OP_SCSI_IN ,0 );if (IS_ERR (next_rq)) { ret =PTR_ERR (next_rq); goto out;
block/scsi_ioctl.c +3 -5
@@ -321,8 +321,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, at_head =1 ; ret = -ENOMEM ; - rq =blk_get_request (q, writing ?REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN , -GFP_KERNEL ); + rq =blk_get_request (q, writing ?REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,0 );if (IS_ERR (rq))return PTR_ERR (rq); req =scsi_req (rq);
@@ -449,8 +448,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, } - rq =blk_get_request (q, in_len ?REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN , - __GFP_RECLAIM); + rq =blk_get_request (q, in_len ?REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,0 );if (IS_ERR (rq)) { err =PTR_ERR (rq); goto error_free_buffer;
@@ -538,7 +536,7 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk,struct request *rq;int err; - rq =blk_get_request (q,REQ_OP_SCSI_OUT , __GFP_RECLAIM); + rq =blk_get_request (q,REQ_OP_SCSI_OUT ,0 );if (IS_ERR (rq))return PTR_ERR (rq); rq->timeout =BLK_DEFAULT_SG_TIMEOUT ;
drivers/block/paride/pd.c +1 -1
@@ -740,7 +740,7 @@ static int pd_special_command(struct pd_unit *disk, {struct request *rq; - rq =blk_get_request (disk->gd->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); + rq =blk_get_request (disk->gd->queue,REQ_OP_DRV_IN ,0 );if (IS_ERR (rq))return PTR_ERR (rq);
drivers/block/pktcdvd.c +1 -1
@@ -704,7 +704,7 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *int ret =0 ; rq =blk_get_request (q, (cgc->data_direction ==CGC_DATA_WRITE ) ? -REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN , __GFP_RECLAIM); +REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,0 );if (IS_ERR (rq))return PTR_ERR (rq);
drivers/block/sx8.c +1 -1
@@ -567,7 +567,7 @@ static struct carm_request *carm_get_special(struct carm_host *host)if (!crq)return NULL ; - rq =blk_get_request (host->oob_q,REQ_OP_DRV_OUT ,GFP_KERNEL ); + rq =blk_get_request (host->oob_q,REQ_OP_DRV_OUT ,0 );if (IS_ERR (rq)) {spin_lock_irqsave (&host->lock, flags);carm_put_request (host, crq);
drivers/block/virtio_blk.c +1 -1
@@ -298,7 +298,7 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str)struct request *req;int err; - req =blk_get_request (q,REQ_OP_DRV_IN ,GFP_KERNEL ); + req =blk_get_request (q,REQ_OP_DRV_IN ,0 );if (IS_ERR (req))return PTR_ERR (req);
drivers/cdrom/cdrom.c +1 -1
@@ -2192,7 +2192,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, len = nr *CD_FRAMESIZE_RAW ; - rq =blk_get_request (q,REQ_OP_SCSI_IN ,GFP_KERNEL ); + rq =blk_get_request (q,REQ_OP_SCSI_IN ,0 );if (IS_ERR (rq)) { ret =PTR_ERR (rq);break ;
drivers/ide/ide-atapi.c +1 -1
@@ -92,7 +92,7 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,struct request *rq;int error; - rq =blk_get_request (drive->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); + rq =blk_get_request (drive->queue,REQ_OP_DRV_IN ,0 );ide_req (rq)->type =ATA_PRIV_MISC ; rq->special = (char *)pc;
drivers/ide/ide-cd.c +1 -1
@@ -437,7 +437,7 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,bool delay = false; rq =blk_get_request (drive->queue, - write ?REQ_OP_DRV_OUT :REQ_OP_DRV_IN , __GFP_RECLAIM); + write ?REQ_OP_DRV_OUT :REQ_OP_DRV_IN ,0 );memcpy (scsi_req (rq)->cmd, cmd,BLK_MAX_CDB );ide_req (rq)->type =ATA_PRIV_PC ; rq->rq_flags |= rq_flags;
drivers/ide/ide-cd_ioctl.c +1 -1
@@ -304,7 +304,7 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi)struct request *rq;int ret; - rq =blk_get_request (drive->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); + rq =blk_get_request (drive->queue,REQ_OP_DRV_IN ,0 );ide_req (rq)->type =ATA_PRIV_MISC ; rq->rq_flags =RQF_QUIET ;blk_execute_rq (drive->queue, cd->disk, rq,0 );
drivers/ide/ide-devsets.c +1 -1
@@ -166,7 +166,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,if (!(setting->flags &DS_SYNC ))return setting->set (drive, arg); - rq =blk_get_request (q,REQ_OP_DRV_IN , __GFP_RECLAIM); + rq =blk_get_request (q,REQ_OP_DRV_IN ,0 );ide_req (rq)->type =ATA_PRIV_MISC ;scsi_req (rq)->cmd_len =5 ;scsi_req (rq)->cmd[0 ] =REQ_DEVSET_EXEC ;
drivers/ide/ide-disk.c +1 -1
@@ -478,7 +478,7 @@ static int set_multcount(ide_drive_t *drive, int arg)if (drive->special_flags &IDE_SFLAG_SET_MULTMODE )return -EBUSY ; - rq =blk_get_request (drive->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); + rq =blk_get_request (drive->queue,REQ_OP_DRV_IN ,0 );ide_req (rq)->type =ATA_PRIV_TASKFILE ; drive->mult_req = arg;
drivers/ide/ide-ioctls.c +2 -2
@@ -125,7 +125,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)if (NULL == (void *) arg) {struct request *rq; - rq =blk_get_request (drive->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); + rq =blk_get_request (drive->queue,REQ_OP_DRV_IN ,0 );ide_req (rq)->type =ATA_PRIV_TASKFILE ;blk_execute_rq (drive->queue,NULL , rq,0 ); err =scsi_req (rq)->result ? -EIO :0 ;
@@ -222,7 +222,7 @@ static int generic_drive_reset(ide_drive_t *drive)struct request *rq;int ret =0 ; - rq =blk_get_request (drive->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); + rq =blk_get_request (drive->queue,REQ_OP_DRV_IN ,0 );ide_req (rq)->type =ATA_PRIV_MISC ;scsi_req (rq)->cmd_len =1 ;scsi_req (rq)->cmd[0 ] =REQ_DRIVE_RESET ;
drivers/ide/ide-park.c +2 -2
@@ -32,7 +32,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) }spin_unlock_irq (&hwif->lock); - rq =blk_get_request (q,REQ_OP_DRV_IN , __GFP_RECLAIM); + rq =blk_get_request (q,REQ_OP_DRV_IN ,0 );scsi_req (rq)->cmd[0 ] =REQ_PARK_HEADS ;scsi_req (rq)->cmd_len =1 ;ide_req (rq)->type =ATA_PRIV_MISC ;
@@ -47,7 +47,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)* Make sure that *some* command is sent to the drive after the * timeout has expired, so power management will be reenabled. */ - rq =blk_get_request (q,REQ_OP_DRV_IN ,GFP_NOWAIT ); + rq =blk_get_request (q,REQ_OP_DRV_IN ,BLK_MQ_REQ_NOWAIT );if (IS_ERR (rq)) goto out;
drivers/ide/ide-pm.c +2 -3
@@ -19,7 +19,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) }memset (&rqpm,0 ,sizeof (rqpm)); - rq =blk_get_request (drive->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); + rq =blk_get_request (drive->queue,REQ_OP_DRV_IN ,0 );ide_req (rq)->type =ATA_PRIV_PM_SUSPEND ; rq->special = &rqpm; rqpm.pm_step =IDE_PM_START_SUSPEND ;
@@ -90,8 +90,7 @@ int generic_ide_resume(struct device *dev) }memset (&rqpm,0 ,sizeof (rqpm)); - rq =blk_get_request_flags (drive->queue,REQ_OP_DRV_IN , -BLK_MQ_REQ_PREEMPT ); + rq =blk_get_request (drive->queue,REQ_OP_DRV_IN ,BLK_MQ_REQ_PREEMPT );ide_req (rq)->type =ATA_PRIV_PM_RESUME ; rq->special = &rqpm; rqpm.pm_step =IDE_PM_START_RESUME ;
drivers/ide/ide-tape.c +1 -1
@@ -854,7 +854,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size)BUG_ON (cmd !=REQ_IDETAPE_READ && cmd !=REQ_IDETAPE_WRITE );BUG_ON (size <0 || size % tape->blk_size); - rq =blk_get_request (drive->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); + rq =blk_get_request (drive->queue,REQ_OP_DRV_IN ,0 );ide_req (rq)->type =ATA_PRIV_MISC ;scsi_req (rq)->cmd[13 ] = cmd; rq->rq_disk = tape->disk;
drivers/ide/ide-taskfile.c +1 -1
@@ -431,7 +431,7 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf, rq =blk_get_request (drive->queue, (cmd->tf_flags &IDE_TFLAG_WRITE ) ? -REQ_OP_DRV_OUT :REQ_OP_DRV_IN , __GFP_RECLAIM); +REQ_OP_DRV_OUT :REQ_OP_DRV_IN ,0 );ide_req (rq)->type =ATA_PRIV_TASKFILE ;/*
drivers/md/dm-mpath.c +2 -1
@@ -520,7 +520,8 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, bdev = pgpath->path.dev->bdev; q =bdev_get_queue (bdev); - clone =blk_get_request (q, rq->cmd_flags |REQ_NOMERGE ,GFP_ATOMIC ); + clone =blk_get_request (q, rq->cmd_flags |REQ_NOMERGE , +BLK_MQ_REQ_NOWAIT );if (IS_ERR (clone)) {/* EBUSY, ENODEV or EWOULDBLOCK: requeue */ if (blk_queue_dying (q)) {
drivers/mmc/core/block.c +5 -7
@@ -244,7 +244,7 @@ static ssize_t power_ro_lock_store(struct device *dev, mq = &md->queue;/* Dispatch locking to the block layer */ - req =blk_get_request (mq->queue,REQ_OP_DRV_OUT , __GFP_RECLAIM); + req =blk_get_request (mq->queue,REQ_OP_DRV_OUT ,0 );if (IS_ERR (req)) { count =PTR_ERR (req); goto out_put;
@@ -650,8 +650,7 @@ static int mmc_blk_ioctl_cmd(struct mmc_blk_data *md,*/ mq = &md->queue; req =blk_get_request (mq->queue, - idata->ic.write_flag ?REQ_OP_DRV_OUT :REQ_OP_DRV_IN , - __GFP_RECLAIM); + idata->ic.write_flag ?REQ_OP_DRV_OUT :REQ_OP_DRV_IN ,0 );if (IS_ERR (req)) { err =PTR_ERR (req); goto cmd_done;
@@ -721,8 +720,7 @@ static int mmc_blk_ioctl_multi_cmd(struct mmc_blk_data *md,*/ mq = &md->queue; req =blk_get_request (mq->queue, - idata[0 ]->ic.write_flag ?REQ_OP_DRV_OUT :REQ_OP_DRV_IN , - __GFP_RECLAIM); + idata[0 ]->ic.write_flag ?REQ_OP_DRV_OUT :REQ_OP_DRV_IN ,0 );if (IS_ERR (req)) { err =PTR_ERR (req); goto cmd_err;
@@ -2750,7 +2748,7 @@ static int mmc_dbg_card_status_get(void *data, u64 *val)int ret;/* Ask the block layer about the card status */ - req =blk_get_request (mq->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); + req =blk_get_request (mq->queue,REQ_OP_DRV_IN ,0 );if (IS_ERR (req))return PTR_ERR (req);req_to_mmc_queue_req (req)->drv_op =MMC_DRV_OP_GET_CARD_STATUS ;
@@ -2786,7 +2784,7 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp)return -ENOMEM ;/* Ask the block layer for the EXT CSD */ - req =blk_get_request (mq->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); + req =blk_get_request (mq->queue,REQ_OP_DRV_IN ,0 );if (IS_ERR (req)) { err =PTR_ERR (req); goto out_free;
drivers/scsi/osd/osd_initiator.c +1 -1
@@ -1570,7 +1570,7 @@ static struct request *_make_request(struct request_queue *q, bool has_write,int ret; req =blk_get_request (q, has_write ?REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN , -GFP_KERNEL ); +0 );if (IS_ERR (req))return req;
drivers/scsi/osst.c +1 -1
@@ -368,7 +368,7 @@ static int osst_execute(struct osst_request *SRpnt, const unsigned char *cmd,int write = (data_direction ==DMA_TO_DEVICE ); req =blk_get_request (SRpnt->stp->device->request_queue, - write ?REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,GFP_KERNEL ); + write ?REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,0 );if (IS_ERR (req))return DRIVER_ERROR <<24 ;
drivers/scsi/scsi_error.c +1 -1
@@ -1937,7 +1937,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev)* blk_get_request with GFP_KERNEL (__GFP_RECLAIM) sleeps until a * request becomes available */ - req =blk_get_request (sdev->request_queue,REQ_OP_SCSI_IN ,GFP_KERNEL ); + req =blk_get_request (sdev->request_queue,REQ_OP_SCSI_IN ,0 );if (IS_ERR (req))return ; rq =scsi_req (req);
drivers/scsi/scsi_lib.c +1 -1
@@ -265,7 +265,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,struct scsi_request *rq;int ret =DRIVER_ERROR <<24 ; - req =blk_get_request_flags (sdev->request_queue, + req =blk_get_request (sdev->request_queue, data_direction ==DMA_TO_DEVICE ?REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,BLK_MQ_REQ_PREEMPT );if (IS_ERR (req))
drivers/scsi/sg.c +1 -1
@@ -1715,7 +1715,7 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)* does not sleep except under memory pressure. */ rq =blk_get_request (q, hp->dxfer_direction ==SG_DXFER_TO_DEV ? -REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,GFP_KERNEL ); +REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,0 );if (IS_ERR (rq)) {kfree (long_cmdp);return PTR_ERR (rq);
drivers/scsi/st.c +1 -1
@@ -545,7 +545,7 @@ static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd, req =blk_get_request (SRpnt->stp->device->request_queue, data_direction ==DMA_TO_DEVICE ? -REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,GFP_KERNEL ); +REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,0 );if (IS_ERR (req))return DRIVER_ERROR <<24 ; rq =scsi_req (req);
drivers/target/target_core_pscsi.c +1 -2
@@ -984,8 +984,7 @@ pscsi_execute_cmd(struct se_cmd *cmd) req =blk_get_request (pdv->pdv_sd->request_queue, cmd->data_direction ==DMA_TO_DEVICE ? -REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN , -GFP_KERNEL ); +REQ_OP_SCSI_OUT :REQ_OP_SCSI_IN ,0 );if (IS_ERR (req)) {pr_err ("PSCSI: blk_get_request() failed\n" ); ret =TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
fs/nfsd/blocklayout.c +1 -1
@@ -227,7 +227,7 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev,if (!buf)return -ENOMEM ; - rq =blk_get_request (q,REQ_OP_SCSI_IN ,GFP_KERNEL ); + rq =blk_get_request (q,REQ_OP_SCSI_IN ,0 );if (IS_ERR (rq)) { error = -ENOMEM ; goto out_free_buf;
include/linux/blkdev.h +1 -4
@@ -961,11 +961,8 @@ extern void blk_rq_init(struct request_queue *q, struct request *rq);extern void blk_init_request_from_bio (struct request *req,struct bio *bio);extern void blk_put_request (struct request *);extern void __blk_put_request (struct request_queue *,struct request *); -extern struct request *blk_get_request_flags (struct request_queue *, -unsigned int op, -blk_mq_req_flags_t flags);extern struct request *blk_get_request (struct request_queue *,unsigned int op, -gfp_t gfp_mask); +blk_mq_req_flags_t flags);extern void blk_requeue_request (struct request_queue *,struct request *);extern int blk_lld_busy (struct request_queue *q); extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
Signature · 1 line
2.16.3
Re: [PATCH 3/7] block: sanitize blk_get_request calling conventions
Quoted 27 lines · On Mon, 9 Apr 2018 17:39:12 +0200 Christoph Hellwig <[email protected]> wrote:
Switch everyone to
blk_get_request_flags, and then renameblk_get_request_flagstoblk_get_request.Signed-off-by Christoph Hellwig <[email protected]>--- block/blk-core.c | 14 +++----------- block/bsg.c | 5 ++--- block/scsi_ioctl.c | 8 +++----- drivers/block/paride/pd.c | 2 +- drivers/block/pktcdvd.c | 2 +- drivers/block/sx8.c | 2 +- drivers/block/virtio_blk.c | 2 +- drivers/cdrom/cdrom.c | 2 +- drivers/ide/ide-atapi.c | 2 +- drivers/ide/ide-cd.c | 2 +- drivers/ide/ide-cd_ioctl.c | 2 +- drivers/ide/ide-devsets.c | 2 +- drivers/ide/ide-disk.c | 2 +- drivers/ide/ide-ioctls.c | 4 ++-- drivers/ide/ide-park.c | 4 ++-- drivers/ide/ide-pm.c | 5 ++--- drivers/ide/ide-tape.c | 2 +- drivers/ide/ide-taskfile.c | 2 +- drivers/md/dm-mpath.c | 3 ++- drivers/mmc/core/block.c | 12 +++++------- drivers/scsi/osd/osd_initiator.c | 2 +- drivers/scsi/osst.c | 2 +-
Quoted 9 lines
drivers/scsi/scsi_error.c | 2 +- drivers/scsi/scsi_lib.c | 2 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/target/target_core_pscsi.c | 3 +-- fs/nfsd/blocklayout.c | 2 +- include/linux/blkdev.h | 5 +---- 29 files changed, 42 insertions(+), 59 deletions(-)
Long overdue.
Cheers,
Hannes
Christoph Hellwig
reviewerPATCH 4/7 block: pass explicit gfp_t to get_request
In reply to Christoph Hellwigblk_old_get_request already has it at hand, and in blk_queue_bio, which is the fast path, it is constant.
--- block/blk-core.c | 14 +++++++------- drivers/scsi/scsi_error.c | 4 ---- 2 files changed, 7 insertions(+), 11 deletions(-)
block/blk-core.c +7 -7
@@ -1333,6 +1333,7 @@ int blk_update_nr_requests(struct request_queue *q, unsigned int nr)* @op: operation and flags * @bio: bio to allocate request for (can be %NULL) * @flags: BLQ_MQ_REQ_* flags +* @gfp_mask: allocator flags * * Get a free request from @q. This function may fail under memory * pressure or if @q is dead.
@@ -1342,7 +1343,7 @@ int blk_update_nr_requests(struct request_queue *q, unsigned int nr)* Returns request pointer on success, with @q->queue_lock *not held*. */ static struct request *__get_request (struct request_list *rl,unsigned int op, -struct bio *bio,blk_mq_req_flags_t flags) +struct bio *bio,blk_mq_req_flags_t flags,gfp_t gfp_mask) {struct request_queue *q = rl->q;struct request *rq;
@@ -1351,8 +1352,6 @@ static struct request *__get_request(struct request_list *rl, unsigned int op,struct io_cq *icq =NULL ;const bool is_sync =op_is_sync (op);int may_queue; -gfp_t gfp_mask = flags &BLK_MQ_REQ_NOWAIT ?GFP_ATOMIC : - __GFP_DIRECT_RECLAIM;req_flags_t rq_flags =RQF_ALLOCED ;lockdep_assert_held (q->queue_lock);
@@ -1516,6 +1515,7 @@ static struct request *__get_request(struct request_list *rl, unsigned int op,* @op: operation and flags * @bio: bio to allocate request for (can be %NULL) * @flags: BLK_MQ_REQ_* flags. +* @gfp: allocator flags * * Get a free request from @q. If %BLK_MQ_REQ_NOWAIT is set in @flags, * this function keeps retrying under memory pressure and fails iff @q is dead.
@@ -1525,7 +1525,7 @@ static struct request *__get_request(struct request_list *rl, unsigned int op,* Returns request pointer on success, with @q->queue_lock *not held*. */ static struct request *get_request (struct request_queue *q,unsigned int op, -struct bio *bio,blk_mq_req_flags_t flags) +struct bio *bio,blk_mq_req_flags_t flags,gfp_t gfp) {const bool is_sync =op_is_sync (op);DEFINE_WAIT (wait);
@@ -1537,7 +1537,7 @@ static struct request *get_request(struct request_queue *q, unsigned int op, rl =blk_get_rl (q, bio);/* transferred to @rq on success */ retry: - rq =__get_request (rl, op, bio, flags); + rq =__get_request (rl, op, bio, flags, gfp);if (!IS_ERR (rq))return rq;
@@ -1591,7 +1591,7 @@ static struct request *blk_old_get_request(struct request_queue *q,if (ret)return ERR_PTR (ret);spin_lock_irq (q->queue_lock); - rq =get_request (q, op,NULL , flags); + rq =get_request (q, op,NULL , flags, gfp_mask);if (IS_ERR (rq)) {spin_unlock_irq (q->queue_lock);blk_queue_exit (q);
@@ -2057,7 +2057,7 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)* Returns with the queue unlocked. */ blk_queue_enter_live (q); - req =get_request (q, bio->bi_opf, bio,0 ); + req =get_request (q, bio->bi_opf, bio,0 , __GFP_DIRECT_RECLAIM);if (IS_ERR (req)) {blk_queue_exit (q);__wbt_done (q->rq_wb, wb_acct);
drivers/scsi/scsi_error.c +0 -4
@@ -1933,10 +1933,6 @@ static void scsi_eh_lock_door(struct scsi_device *sdev)struct request *req;struct scsi_request *rq; -/* -* blk_get_request with GFP_KERNEL (__GFP_RECLAIM) sleeps until a -* request becomes available -*/ req =blk_get_request (sdev->request_queue,REQ_OP_SCSI_IN ,0 );if (IS_ERR (req))return ;
Signature · 1 line
2.16.3
Re: [PATCH 4/7] block: pass explicit gfp_t to get_request
Quoted 9 lines · On Mon, 9 Apr 2018 17:39:13 +0200 Christoph Hellwig <[email protected]> wrote:
blk_old_get_requestalready has it at hand, and inblk_queue_bio, which is the fast path, it is constant.Signed-off-by Christoph Hellwig <[email protected]>--- block/blk-core.c | 14 +++++++------- drivers/scsi/scsi_error.c | 4 ---- 2 files changed, 7 insertions(+), 11 deletions(-)
Cheers,
Hannes
Christoph Hellwig
reviewerPATCH 5/7 block: use GFP_NOIO instead of __GFP_DIRECT_RECLAIM
In reply to Christoph HellwigWe just can't do I/O when doing block layer requests allocations, so use GFP_NOIO instead of the even more limited __GFP_DIRECT_RECLAIM.
--- block/blk-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
block/blk-core.c +2 -3
@@ -1578,8 +1578,7 @@ static struct request *blk_old_get_request(struct request_queue *q, unsigned int op, blk_mq_req_flags_t flags) {struct request *rq; -gfp_t gfp_mask = flags &BLK_MQ_REQ_NOWAIT ?GFP_ATOMIC : - __GFP_DIRECT_RECLAIM; +gfp_t gfp_mask = flags &BLK_MQ_REQ_NOWAIT ?GFP_ATOMIC :GFP_NOIO ;int ret =0 ;WARN_ON_ONCE (q->mq_ops);
@@ -2057,7 +2056,7 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)* Returns with the queue unlocked. */ blk_queue_enter_live (q); - req =get_request (q, bio->bi_opf, bio,0 , __GFP_DIRECT_RECLAIM); + req =get_request (q, bio->bi_opf, bio,0 ,GFP_NOIO );if (IS_ERR (req)) {blk_queue_exit (q);__wbt_done (q->rq_wb, wb_acct);
Signature · 1 line
2.16.3
Re: [PATCH 5/7] block: use GFP_NOIO instead of __GFP_DIRECT_RECLAIM
Quoted 8 lines · On Mon, 9 Apr 2018 17:39:14 +0200 Christoph Hellwig <[email protected]> wrote:
We just can't do I/O when doing block layer requests allocations, so use
GFP_NOIOinstead of the even more limited__GFP_DIRECT_RECLAIM.Signed-off-by Christoph Hellwig <[email protected]>--- block/blk-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Cheers,
Hannes
Christoph Hellwig
reviewerPATCH 6/7 block: consistently use GFP_NOIO instead of __GFP_NORECLAIM
In reply to Christoph HellwigSame numerical value (for now at least), but a much better documentation of intent.
--- block/scsi_ioctl.c | 2 +- drivers/block/drbd/drbd_bitmap.c | 3 ++- drivers/block/pktcdvd.c | 2 +- drivers/ide/ide-tape.c | 2 +- drivers/ide/ide-taskfile.c | 2 +- drivers/scsi/scsi_lib.c | 2 +- fs/direct-io.c | 4 ++-- kernel/power/swap.c | 14 +++++++------- 8 files changed, 16 insertions(+), 15 deletions(-)
block/scsi_ioctl.c +1 -1
@@ -499,7 +499,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,break ; } -if (bytes &&blk_rq_map_kern (q, rq, buffer, bytes, __GFP_RECLAIM)) { +if (bytes &&blk_rq_map_kern (q, rq, buffer, bytes,GFP_NOIO )) { err =DRIVER_ERROR <<24 ; goto error; }
drivers/block/drbd/drbd_bitmap.c +2 -1
@@ -1014,7 +1014,8 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_hobm_set_page_unchanged (b->bm_pages[page_nr]);if (ctx->flags &BM_AIO_COPY_PAGES ) { - page =mempool_alloc (drbd_md_io_page_pool, __GFP_HIGHMEM|__GFP_RECLAIM); + page =mempool_alloc (drbd_md_io_page_pool, +GFP_NOIO | __GFP_HIGHMEM);copy_highpage (page, b->bm_pages[page_nr]);bm_store_page_idx (page, page_nr); }else
drivers/block/pktcdvd.c +1 -1
@@ -710,7 +710,7 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *if (cgc->buflen) { ret =blk_rq_map_kern (q, rq, cgc->buffer, cgc->buflen, - __GFP_RECLAIM); +GFP_NOIO );if (ret) goto out; }
drivers/ide/ide-tape.c +1 -1
@@ -862,7 +862,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size)if (size) { ret =blk_rq_map_kern (drive->queue, rq, tape->buf, size, - __GFP_RECLAIM); +GFP_NOIO );if (ret) goto out_put; }
drivers/ide/ide-taskfile.c +1 -1
@@ -442,7 +442,7 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,*/ if (nsect) { error =blk_rq_map_kern (drive->queue, rq, buf, - nsect *SECTOR_SIZE , __GFP_RECLAIM); + nsect *SECTOR_SIZE ,GFP_NOIO );if (error) goto put_req; }
drivers/scsi/scsi_lib.c +1 -1
@@ -273,7 +273,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, rq =scsi_req (req);if (bufflen &&blk_rq_map_kern (sdev->request_queue, req, - buffer, bufflen, __GFP_RECLAIM)) + buffer, bufflen,GFP_NOIO )) goto out; rq->cmd_len =COMMAND_SIZE (cmd[0 ]);
fs/direct-io.c +2 -2
@@ -432,8 +432,8 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio,struct bio *bio;/* -* bio_alloc() is guaranteed to return a bio when called with -* __GFP_RECLAIM and we request a valid number of vectors. +* bio_alloc() is guaranteed to return a bio when allowed to sleep and +* we request a valid number of vectors. */ bio =bio_alloc (GFP_KERNEL , nr_vecs);
kernel/power/swap.c +7 -7
@@ -269,7 +269,7 @@ static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr,struct bio *bio;int error =0 ; - bio =bio_alloc (__GFP_RECLAIM | __GFP_HIGH,1 ); + bio =bio_alloc (GFP_NOIO | __GFP_HIGH,1 ); bio->bi_iter.bi_sector = page_off * (PAGE_SIZE >>9 );bio_set_dev (bio, hib_resume_bdev);bio_set_op_attrs (bio, op, op_flags);
@@ -376,7 +376,7 @@ static int write_page(void *buf, sector_t offset, struct hib_bio_batch *hb)return -ENOSPC ;if (hb) { - src = (void *)__get_free_page (__GFP_RECLAIM | __GFP_NOWARN | + src = (void *)__get_free_page (GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY);if (src) {copy_page (src, buf);
@@ -384,7 +384,7 @@ static int write_page(void *buf, sector_t offset, struct hib_bio_batch *hb) ret =hib_wait_io (hb);/* Free pages */ if (ret)return ret; - src = (void *)__get_free_page (__GFP_RECLAIM | + src = (void *)__get_free_page (GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY);if (src) {
@@ -691,7 +691,7 @@ static int save_image_lzo(struct swap_map_handle *handle, nr_threads =num_online_cpus () -1 ; nr_threads =clamp_val (nr_threads,1 ,LZO_THREADS ); - page = (void *)__get_free_page (__GFP_RECLAIM | __GFP_HIGH); + page = (void *)__get_free_page (GFP_NOIO | __GFP_HIGH);if (!page) {pr_err ("Failed to allocate LZO page\n" ); ret = -ENOMEM ;
@@ -989,7 +989,7 @@ static int get_swap_reader(struct swap_map_handle *handle, last = tmp; tmp->map = (struct swap_map_page *) -__get_free_page (__GFP_RECLAIM | __GFP_HIGH); +__get_free_page (GFP_NOIO | __GFP_HIGH);if (!tmp->map) {release_swap_reader (handle);return -ENOMEM ;
@@ -1261,8 +1261,8 @@ static int load_image_lzo(struct swap_map_handle *handle,for (i =0 ; i < read_pages; i++) { page[i] = (void *)__get_free_page (i <LZO_CMP_PAGES ? - __GFP_RECLAIM | __GFP_HIGH : - __GFP_RECLAIM | __GFP_NOWARN | +GFP_NOIO | __GFP_HIGH : +GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY);if (!page[i]) {
Signature · 1 line
2.16.3
Re: [PATCH 6/7] block: consistently use GFP_NOIO instead of __GFP_NORECLAIM
block/scsi_ioctl.c int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, · line 502
Quoted 9 lines · Christoph Hellwig
Same numerical value (for now at least), but a much better documentation of intent.
block/scsi_ioctl.c +1
-1@@ -499,7 +499,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,break ; } -if (bytes &&blk_rq_map_kern (q, rq, buffer, bytes, __GFP_RECLAIM)) { +if (bytes &&blk_rq_map_kern (q, rq, buffer, bytes,GFP_NOIO )) {
We don't seem to have grabbed any locks between the line which allocates memory using GFP_USER (line 446) and here, so I don't see why we should prohibit I/O?
Christoph Hellwig
reviewerRe: [PATCH 6/7] block: consistently use GFP_NOIO instead of __GFP_NORECLAIM
Quoted 10 lines · Matthew Wilcox
block/scsi_ioctl.c int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, · line 502
Quoted 6 lines
block/scsi_ioctl.c +1
-1@@ -499,7 +499,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,break ; } -if (bytes &&blk_rq_map_kern (q, rq, buffer, bytes, __GFP_RECLAIM)) { +if (bytes &&blk_rq_map_kern (q, rq, buffer, bytes,GFP_NOIO )) {We don't seem to have grabbed any locks between the line which allocates memory using
GFP_USER(line 446) and here, so I don't see why we should prohibit I/O?
No change of behavior for this patch. If you care deeply about using GFP_KERNEL here send an incremental patch that I can add to the end of the series.
Re: [PATCH 6/7] block: consistently use GFP_NOIO instead of __GFP_NORECLAIM
In reply to Christoph HellwigQuoted 4 lines · On Mon, 9 Apr 2018 17:39:15 +0200 Christoph Hellwig <[email protected]> wrote:
Same numerical value (for now at least), but a much better documentation of intent.
Signed-off-by Christoph Hellwig <[email protected]>
Quoted 11 lines
--- block/scsi_ioctl.c | 2 +- drivers/block/drbd/drbd_bitmap.c | 3 ++- drivers/block/pktcdvd.c | 2 +- drivers/ide/ide-tape.c | 2 +- drivers/ide/ide-taskfile.c | 2 +- drivers/scsi/scsi_lib.c | 2 +- fs/direct-io.c | 4 ++-- kernel/power/swap.c | 14 +++++++------- 8 files changed, 16 insertions(+), 15 deletions(-)
Cheers,
Hannes
Christoph Hellwig
reviewerPATCH 7/7 block: use GFP_KERNEL for allocations from blk_get_request
In reply to Christoph Hellwigblk_get_request is used for pass-through style I/O and thus doesn't need GFP_NOIO.
--- block/blk-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-core.c +1 -1
@@ -1578,7 +1578,7 @@ static struct request *blk_old_get_request(struct request_queue *q, unsigned int op, blk_mq_req_flags_t flags) {struct request *rq; -gfp_t gfp_mask = flags &BLK_MQ_REQ_NOWAIT ?GFP_ATOMIC :GFP_NOIO ; +gfp_t gfp_mask = flags &BLK_MQ_REQ_NOWAIT ?GFP_ATOMIC :GFP_KERNEL ;int ret =0 ;WARN_ON_ONCE (q->mq_ops);
Signature · 1 line
2.16.3
Re: [PATCH 7/7] block: use GFP_KERNEL for allocations from blk_get_request
Quoted 2 lines · Christoph Hellwig
blk_get_requestis used for pass-through style I/O and thus doesn't needGFP_NOIO.
Obviously GFP_KERNEL is a big improvement over GFP_NOIO! But can we take it all the way to GFP_USER, if this is always done in the ioctl path (which it seems to be, except for nfsd, which presumably won't have a cpuset memory allocation policy ... and if it did, the admin might appreciate it honouring said policy).
Quoted 21 lines
Signed-off-by Christoph Hellwig <[email protected]>--- block/blk-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)block/blk-core.c +1
-1@@ -1578,7 +1578,7 @@ static struct request *blk_old_get_request(struct request_queue *q, unsigned int op, blk_mq_req_flags_t flags) {struct request *rq; -gfp_t gfp_mask = flags &BLK_MQ_REQ_NOWAIT ?GFP_ATOMIC :GFP_NOIO ; +gfp_t gfp_mask = flags &BLK_MQ_REQ_NOWAIT ?GFP_ATOMIC :GFP_KERNEL ;int ret =0 ;WARN_ON_ONCE (q->mq_ops);Signature · 1 line
2.16.3
Christoph Hellwig
reviewerRe: [PATCH 7/7] block: use GFP_KERNEL for allocations from blk_get_request
Quoted 9 lines · Matthew Wilcox
Quoted 2 lines · Christoph Hellwig
blk_get_requestis used for pass-through style I/O and thus doesn't needGFP_NOIO.Obviously
GFP_KERNELis a big improvement overGFP_NOIO! But can we take it all the way toGFP_USER, if this is always done in the ioctl path (which it seems to be, except for nfsd, which presumably won't have a cpuset memory allocation policy ... and if it did, the admin might appreciate it honouring said policy).
GFP_USER claims to be for allocations mapped into userspace, and except for a few outliers that is how we use it. I see no reason to change that here.
Re: [PATCH 7/7] block: use GFP_KERNEL for allocations from blk_get_request
In reply to Christoph HellwigQuoted 21 lines · On Mon, 9 Apr 2018 17:39:16 +0200 Christoph Hellwig <[email protected]> wrote:
blk_get_requestis used for pass-through style I/O and thus doesn't needGFP_NOIO.Signed-off-by Christoph Hellwig <[email protected]>--- block/blk-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)block/blk-core.c +1
-1@@ -1578,7 +1578,7 @@ static struct request *blk_old_get_request(struct request_queue *q, unsigned int op, blk_mq_req_flags_t flags) {struct request *rq; -gfp_t gfp_mask = flags &BLK_MQ_REQ_NOWAIT ?GFP_ATOMIC :GFP_NOIO ; +gfp_t gfp_mask = flags &BLK_MQ_REQ_NOWAIT ?GFP_ATOMIC :GFP_KERNEL ;int ret =0 ;
Quoted 1 line
WARN_ON_ONCE(q->mq_ops);
Cheers,
Hannes