diff mbox

skd: remove broken discard support

Message ID x49inz52vie.fsf@segfault.boston.devel.redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Moyer April 25, 2016, 10:06 p.m. UTC
Simply creating a file system on an skd device, followed by mount and
fstrim will result in errors in the logs and then a BUG().  Let's remove
discard support from that driver.  As far as I can tell, it hasn't
worked right since it was merged.  This patch also has a side-effect of
cleaning up an unintentional shadowed declaration inside of
skd_end_request.

I tested to ensure that I can still do I/O to the device using xfstests
./check -g quick.  I didn't do anything more extensive than that,
though.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

---
[ 1205.622119] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.629245] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=160 count=0 id=0x1439
[ 1205.637490] blk_update_request: 177 callbacks suppressed
[ 1205.642787] blk_update_request: I/O error, dev skd0, sector 160
[ 1205.648696] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.655813] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=8388752 count=0 id=0x540b
[ 1205.664402] blk_update_request: I/O error, dev skd0, sector 8388752
[ 1205.670654] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.677771] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=16777344 count=0 id=0x741c
[ 1205.686448] blk_update_request: I/O error, dev skd0, sector 16777344
[ 1205.692787] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.699904] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=25165936 count=0 id=0x2c0a
[ 1205.708579] blk_update_request: I/O error, dev skd0, sector 25165936
[ 1205.714947] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.722065] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=33554528 count=0 id=0x5414
[ 1205.730741] blk_update_request: I/O error, dev skd0, sector 33554528
[ 1205.737080] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.744197] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=41943120 count=0 id=0x7409
[ 1205.752872] blk_update_request: I/O error, dev skd0, sector 41943120
[ 1205.759209] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.766326] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=50331712 count=0 id=0x42c
[ 1205.774916] blk_update_request: I/O error, dev skd0, sector 50331712
[ 1205.781252] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.788369] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=58720304 count=0 id=0x142b
[ 1205.797045] blk_update_request: I/O error, dev skd0, sector 58720304
[ 1205.803383] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.810500] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=67108896 count=0 id=0x243c
[ 1205.819176] blk_update_request: I/O error, dev skd0, sector 67108896
[ 1205.825513] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.832630] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=75497488 count=0 id=0x5408
[ 1205.841306] blk_update_request: I/O error, dev skd0, sector 75497488
[ 1205.847643] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.854759] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=83886080 count=0 id=0xec27
[ 1205.863435] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.870552] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=92274672 count=0 id=0x7c11
[ 1205.879231] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.886349] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=100663264 count=0 id=0x2c21
[ 1205.895112] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.902231] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=109051856 count=0 id=0x41d
[ 1205.910910] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.918026] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=117440448 count=0 id=0xe42d
[ 1205.926791] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.933908] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=125829040 count=0 id=0xac16
[ 1205.942673] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.949789] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=134217632 count=0 id=0x343b
[ 1205.958553] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.965669] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=142606224 count=0 id=0x8c0e
[ 1205.974433] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.981550] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=150994816 count=0 id=0xb43e
[ 1205.990313] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1205.997430] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=159383408 count=0 id=0x6c33
[ 1206.006195] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.013312] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=167772000 count=0 id=0x6425
[ 1206.022075] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.029192] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=176160592 count=0 id=0x641f
[ 1206.037956] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.045074] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=184549184 count=0 id=0xdc01
[ 1206.053837] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.060960] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=192937776 count=0 id=0x2c12
[ 1206.069723] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.076841] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=201326368 count=0 id=0x1c2a
[ 1206.085605] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.092722] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=209714960 count=0 id=0x541e
[ 1206.101486] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.108603] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=218103552 count=0 id=0x6c26
[ 1206.117367] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.124485] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=226492144 count=0 id=0x3c36
[ 1206.133249] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.140366] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=234880736 count=0 id=0x5c02
[ 1206.149129] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.156247] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=243269328 count=0 id=0x6c34
[ 1206.165010] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.172127] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=251657920 count=0 id=0x1c1a
[ 1206.180891] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.188008] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=260046512 count=0 id=0x9c00
[ 1206.196771] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.203888] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=268435104 count=0 id=0xdc07
[ 1206.212652] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.219769] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=276823696 count=0 id=0xbc3a
[ 1206.228532] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.235649] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=285212288 count=0 id=0xa410
[ 1206.244413] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.251532] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=293600880 count=0 id=0x2c20
[ 1206.260296] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.267412] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=301989472 count=0 id=0x140c
[ 1206.276177] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.283293] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=310378064 count=0 id=0x4c29
[ 1206.292058] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.299176] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=318766656 count=0 id=0x2c30
[ 1206.307941] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.315057] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=327155248 count=0 id=0x9c24
[ 1206.323822] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.330940] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=335543840 count=0 id=0xac18
[ 1206.339703] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.346820] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=343932432 count=0 id=0x2c2f
[ 1206.355583] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.362701] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=352321024 count=0 id=0x9437
[ 1206.371466] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.378583] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=360709616 count=0 id=0xcc2e
[ 1206.387348] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.394465] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=369098208 count=0 id=0x2417
[ 1206.403229] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.410345] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=377486800 count=0 id=0x4c15
[ 1206.419109] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.426226] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=385875392 count=0 id=0x6423
[ 1206.435223] (skd0:STM0001716EB:[0000:04:00.0]): key/asc/ascq/fruc 05/26/00/00
[ 1206.442346] (skd0:STM0001716EB:[0000:04:00.0]): Error cmd=write sect=390759496 count=0 id=0x6c23
[ 1206.451113] request botched: dev skd0: type=1, flags=244d0081
[ 1206.456843]   sector 390759496, nr/cnr 0/16
[ 1206.461014]   bio ffff880098f70700, biotail ffff880098f70700, len 0
[ 1206.467292] ------------[ cut here ]------------
[ 1206.471924] kernel BUG at block/blk-core.c:2934!
[ 1206.476551] invalid opcode: 0000 [#1] SMP 
[ 1206.480673] Modules linked in: skd(E) ipt_MASQUERADE
nf_nat_masquerade_ipv4 xt_CHECKSUM ip6t_rpfilter ip6t_REJECT
nf_reject_ipv6 cfg80211 ipt_REJECT nf_reject_ipv4 rfkill xt_conntrack
ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables
ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6
ip6table_mangle ip6table_security ip6table_raw ip6table_filter
ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4
nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw
iptable_filter ip_tables sg ext4 jbd2 mbcache dm_mirror dm_region_hash
dm_log iTCO_wdt iTCO_vendor_support dcdbas coretemp kvm_intel kvm
ipmi_devintf ses irqbypass enclosure crc32c_intel mtip32xx lpc_ich
mfd_core scsi_transport_sas ipmi_si ipmi_msghandler pcspkr serio_raw
acpi_power_meter i7core_edac acpi_cpufreq shpchp edac_core nfsd
auth_rpcgss nfs_acl lockd grace dm_multipath uinput dm_mod sunrpc xfs
libcrc32c sr_mod cdrom sd_mod ata_generic pata_acpi mgag200
i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sata_sil24
sysimgblt ata_piix fb_sys_fops ttm nvme drm i2c_core libata nvme_core
megaraid_sas bnx2
[ 1206.579798] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G          I E   4.6.0-rc2+ #37
[ 1206.587383] Hardware name: Dell Inc. PowerEdge R710/00NH4P, BIOS 2.1.9 05/21/2010
[ 1206.594881] task: ffff8801abb81480 ti: ffff8801abb88000 task.ti: ffff8801abb88000
[ 1206.602380] RIP: 0010:[<ffffffff8131263a>]  [<ffffffff8131263a>] __blk_end_request_all+0x2a/0x30
[ 1206.611198] RSP: 0018:ffff8800bca03d28  EFLAGS: 00010002
[ 1206.616518] RAX: 0000000000000001 RBX: ffff8800bc237068 RCX: 0000000000000006
[ 1206.623668] RDX: 0000000000000001 RSI: ffff880098f70700 RDI: 0000000000000000
[ 1206.630817] RBP: ffff8800bca03d28 R08: 00000000fffffffe R09: 0000000000000000
[ 1206.637966] R10: 0000000000000005 R11: 00000000000007f8 R12: 00000000fffffffb
[ 1206.645114] R13: ffffffffa06cbdb8 R14: ffff8801aa46d400 R15: 00000000174a8448
[ 1206.652264] FS:  0000000000000000(0000) GS:ffff8800bca00000(0000) knlGS:0000000000000000
[ 1206.660369] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1206.666126] CR2: 000000000060415c CR3: 0000000001c06000 CR4: 00000000000006e0
[ 1206.673275] Stack:
[ 1206.675290]  ffff8800bca03d70 ffffffffa06c15fe d933828b3469f7b9 00006c2300000000
[ 1206.682742]  ffff8801aa46d400 ffff8800bc237068 ffffffffa06cf16c 0000000000000002
[ 1206.690192]  0000000000000000 ffff8800bca03e50 ffffffffa06c83eb ffffffff810b499c
[ 1206.697641] Call Trace:
[ 1206.700091]  <IRQ> 
[ 1206.702028]  [<ffffffffa06c15fe>] skd_end_request+0x4e/0x140 [skd]
[ 1206.708409]  [<ffffffffa06c83eb>] skd_isr_completion_posted.isra.43+0x6eb/0xe40 [skd]
[ 1206.716258]  [<ffffffff810b499c>] ? __enqueue_entity+0x6c/0x70
[ 1206.722101]  [<ffffffff810ba9dd>] ? enqueue_entity+0x42d/0x920
[ 1206.727948]  [<ffffffff810baf5c>] ? enqueue_task_fair+0x8c/0x830
[ 1206.733969]  [<ffffffff81037eb9>] ? sched_clock+0x9/0x10
[ 1206.739295]  [<ffffffffa06c9d08>] skd_isr+0x108/0x1e0 [skd]
[ 1206.744880]  [<ffffffff810acb29>] ? ttwu_do_wakeup+0x19/0xd0
[ 1206.750554]  [<ffffffff810dba21>] handle_irq_event_percpu+0x41/0x1c0
[ 1206.756922]  [<ffffffff810dbbdb>] handle_irq_event+0x3b/0x60
[ 1206.762594]  [<ffffffff810df21d>] handle_edge_irq+0x8d/0x130
[ 1206.768268]  [<ffffffff8103110b>] handle_irq+0xab/0x130
[ 1206.774751]  [<ffffffff810a2aaa>] ? atomic_notifier_call_chain+0x1a/0x20
[ 1206.782672]  [<ffffffff816c6bdd>] do_IRQ+0x4d/0xd0
[ 1206.788699]  [<ffffffff816c4a8c>] common_interrupt+0x8c/0x8c
[ 1206.795554]  <EOI> 
[ 1206.797485]  [<ffffffff81568ed2>] ? cpuidle_enter_state+0xd2/0x250
[ 1206.806232]  [<ffffffff81568eb1>] ? cpuidle_enter_state+0xb1/0x250
[ 1206.813601]  [<ffffffff81569087>] cpuidle_enter+0x17/0x20
[ 1206.820189]  [<ffffffff810c6db1>] cpu_startup_entry+0x2d1/0x3c0
[ 1206.827270]  [<ffffffff81052375>] start_secondary+0x165/0x1a0
[ 1206.834143] Code: 00 66 66 66 66 90 48 8b 87 68 01 00 00 55 48 89
e5 48 85 c0 75 10 31 c9 8b 57 5c e8 e1 fe ff ff 84 c0 75 07 5d c3 8b
48 5c eb ed <0f> 0b 0f 1f 40 00 66 66 66 66 90 55 48 89 e5 41 57 41 56
41 be
[ 1206.855972] RIP  [<ffffffff8131263a>] __blk_end_request_all+0x2a/0x30
[ 1206.863530]  RSP <ffff8800bca03d28>
[ 1206.872571] ---[ end trace f5555c38f16ef20d ]---
[ 1206.879118] Kernel panic - not syncing: Fatal exception in interrupt
[ 1206.886738] Kernel Offset: disabled
[ 1206.897051] ---[ end Kernel panic - not syncing: Fatal exception in interrupt


--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jens Axboe April 26, 2016, 1:54 a.m. UTC | #1
> On Apr 25, 2016, at 4:06 PM, Jeff Moyer <jmoyer@redhat.com> wrote:
> 
> Simply creating a file system on an skd device, followed by mount and
> fstrim will result in errors in the logs and then a BUG().  Let's remove
> discard support from that driver.  As far as I can tell, it hasn't
> worked right since it was merged.  This patch also has a side-effect of
> cleaning up an unintentional shadowed declaration inside of
> skd_end_request.
> 
> I tested to ensure that I can still do I/O to the device using xfstests
> ./check -g quick.  I didn't do anything more extensive than that,
> though.

Applied, thanks Jeff.
diff mbox

Patch

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 586f916..9e37c2b 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -133,7 +133,6 @@  MODULE_VERSION(DRV_VERSION "-" DRV_BUILD_ID);
 #define SKD_TIMER_MINUTES(minutes) ((minutes) * (60))
 
 #define INQ_STD_NBYTES 36
-#define SKD_DISCARD_CDB_LENGTH	24
 
 enum skd_drvr_state {
 	SKD_DRVR_STATE_LOAD,
@@ -212,7 +211,6 @@  struct skd_request_context {
 
 	struct request *req;
 	u8 flush_cmd;
-	u8 discard_page;
 
 	u32 timeout_stamp;
 	u8 sg_data_dir;
@@ -230,7 +228,6 @@  struct skd_request_context {
 };
 #define SKD_DATA_DIR_HOST_TO_CARD       1
 #define SKD_DATA_DIR_CARD_TO_HOST       2
-#define SKD_DATA_DIR_NONE		3	/* especially for DISCARD requests. */
 
 struct skd_special_context {
 	struct skd_request_context req;
@@ -540,31 +537,6 @@  skd_prep_zerosize_flush_cdb(struct skd_scsi_request *scsi_req,
 	scsi_req->cdb[9] = 0;
 }
 
-static void
-skd_prep_discard_cdb(struct skd_scsi_request *scsi_req,
-		     struct skd_request_context *skreq,
-		     struct page *page,
-		     u32 lba, u32 count)
-{
-	char *buf;
-	unsigned long len;
-	struct request *req;
-
-	buf = page_address(page);
-	len = SKD_DISCARD_CDB_LENGTH;
-
-	scsi_req->cdb[0] = UNMAP;
-	scsi_req->cdb[8] = len;
-
-	put_unaligned_be16(6 + 16, &buf[0]);
-	put_unaligned_be16(16, &buf[2]);
-	put_unaligned_be64(lba, &buf[8]);
-	put_unaligned_be32(count, &buf[16]);
-
-	req = skreq->req;
-	blk_add_request_payload(req, page, len);
-}
-
 static void skd_request_fn_not_online(struct request_queue *q);
 
 static void skd_request_fn(struct request_queue *q)
@@ -575,7 +547,6 @@  static void skd_request_fn(struct request_queue *q)
 	struct skd_request_context *skreq;
 	struct request *req = NULL;
 	struct skd_scsi_request *scsi_req;
-	struct page *page;
 	unsigned long io_flags;
 	int error;
 	u32 lba;
@@ -669,7 +640,6 @@  static void skd_request_fn(struct request_queue *q)
 		skreq->flush_cmd = 0;
 		skreq->n_sg = 0;
 		skreq->sg_byte_count = 0;
-		skreq->discard_page = 0;
 
 		/*
 		 * OK to now dequeue request from q.
@@ -735,18 +705,7 @@  static void skd_request_fn(struct request_queue *q)
 		else
 			skreq->sg_data_dir = SKD_DATA_DIR_HOST_TO_CARD;
 
-		if (io_flags & REQ_DISCARD) {
-			page = alloc_page(GFP_ATOMIC | __GFP_ZERO);
-			if (!page) {
-				pr_err("request_fn:Page allocation failed.\n");
-				skd_end_request(skdev, skreq, -ENOMEM);
-				break;
-			}
-			skreq->discard_page = 1;
-			req->completion_data = page;
-			skd_prep_discard_cdb(scsi_req, skreq, page, lba, count);
-
-		} else if (flush == SKD_FLUSH_ZERO_SIZE_FIRST) {
+		if (flush == SKD_FLUSH_ZERO_SIZE_FIRST) {
 			skd_prep_zerosize_flush_cdb(scsi_req, skreq);
 			SKD_ASSERT(skreq->flush_cmd == 1);
 
@@ -851,16 +810,6 @@  skip_sg:
 static void skd_end_request(struct skd_device *skdev,
 			    struct skd_request_context *skreq, int error)
 {
-	struct request *req = skreq->req;
-	unsigned int io_flags = req->cmd_flags;
-
-	if ((io_flags & REQ_DISCARD) &&
-		(skreq->discard_page == 1)) {
-		pr_debug("%s:%s:%d, free the page!",
-			 skdev->name, __func__, __LINE__);
-		__free_page(req->completion_data);
-	}
-
 	if (unlikely(error)) {
 		struct request *req = skreq->req;
 		char *cmd = (rq_data_dir(req) == READ) ? "read" : "write";
@@ -4419,12 +4368,6 @@  static int skd_cons_disk(struct skd_device *skdev)
 	/* set sysfs ptimal_io_size to 8K */
 	blk_queue_io_opt(q, 8192);
 
-	/* DISCARD Flag initialization. */
-	q->limits.discard_granularity = 8192;
-	q->limits.discard_alignment = 0;
-	blk_queue_max_discard_sectors(q, UINT_MAX >> 9);
-	q->limits.discard_zeroes_data = 1;
-	queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
 	queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
 	queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, q);