279b3b1a2b
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmCeKsMACgkQONu9yGCS
aT4cYhAA0qDTHscvm641m/Dv4U9w3gWh2Fs8oPz43+nJ1/8CTrT/gSWA7IRDDHiV
Dys2canDVLNYTEx1TqwmHbN3R+nvQTpdz2wuJuSf7GKYQj0n3S99BEN6uxod+puu
/M7apBH5npjZKv1DMRUrQ/AUGVUuBQqtN7Hl5hEL8ibI/bsZV8+dhJJ8c8uyJpam
peiP5n2lCz5HZ/K5OyEy1jCmWQLIcRN59SmiARy/xk739igoCMUajkY1mV0WVyks
SKnZEP7tY1mLLYzpW/ZVSkXurx+ZtL1zUctRt5dh5US4uzNt/sfm8oDzyzvGojd/
iWtXefprJXbI9BGyNaBwwNmzjSXabSkoI75wExxsMQKFZpsq12pz97dwy/pZyU+c
NlzbmDQg8+Cs9dKsDw6jUXHYSJ9fb4mk6GOF9u0LXgyq1f15/DzjdzkYLXZ3tTOK
exVFs/CKz7Dg6npdO5kl7mg18AxmVH+OJftltF2+MbUohBs2vRDRr+O4cY8Wlc2Q
AF85uAE3Mo/yL1pi6O7lMW4ic5yJvTRCX/iPsxyDU8LvxM1Kc7u9CzykX3M0WFLz
TsKxfPQvoc6WGf8IWy4j1nXMzXQTHL/6CrfzOSTFngR8eqcsbgU0nkKpZNEtvnxN
k30ID+Mcl4B6k6XTECNJUXjcwg+TR+XtKOjwXAIDaVqwoW759BY=
=25pJ
-----END PGP SIGNATURE-----
Merge 5.4.119 into android11-5.4-lts
Changes in 5.4.119
Bluetooth: verify AMP hci_chan before amp_destroy
hsr: use netdev_err() instead of WARN_ONCE()
bluetooth: eliminate the potential race condition when removing the HCI controller
net/nfc: fix use-after-free llcp_sock_bind/connect
Revert "USB: cdc-acm: fix rounding error in TIOCSSERIAL"
tty: moxa: fix TIOCSSERIAL jiffies conversions
tty: amiserial: fix TIOCSSERIAL permission check
USB: serial: usb_wwan: fix TIOCSSERIAL jiffies conversions
staging: greybus: uart: fix TIOCSSERIAL jiffies conversions
USB: serial: ti_usb_3410_5052: fix TIOCSSERIAL permission check
staging: fwserial: fix TIOCSSERIAL jiffies conversions
tty: moxa: fix TIOCSSERIAL permission check
staging: fwserial: fix TIOCSSERIAL permission check
usb: typec: tcpm: Address incorrect values of tcpm psy for fixed supply
usb: typec: tcpm: Address incorrect values of tcpm psy for pps supply
usb: typec: tcpm: update power supply once partner accepts
usb: xhci-mtk: remove or operator for setting schedule parameters
usb: xhci-mtk: improve bandwidth scheduling with TT
ASoC: samsung: tm2_wm5110: check of of_parse return value
ASoC: Intel: kbl_da7219_max98927: Fix kabylake_ssp_fixup function
MIPS: pci-mt7620: fix PLL lock check
MIPS: pci-rt2880: fix slot 0 configuration
FDDI: defxx: Bail out gracefully with unassigned PCI resource for CSR
PCI: Allow VPD access for QLogic ISP2722
iio:accel:adis16201: Fix wrong axis assignment that prevents loading
misc: lis3lv02d: Fix false-positive WARN on various HP models
misc: vmw_vmci: explicitly initialize vmci_notify_bm_set_msg struct
misc: vmw_vmci: explicitly initialize vmci_datagram payload
md/bitmap: wait for external bitmap writes to complete during tear down
md-cluster: fix use-after-free issue when removing rdev
md: split mddev_find
md: factor out a mddev_find_locked helper from mddev_find
md: md_open returns -EBUSY when entering racing area
md: Fix missing unused status line of /proc/mdstat
ipw2x00: potential buffer overflow in libipw_wx_set_encodeext()
cfg80211: scan: drop entry from hidden_list on overflow
rtw88: Fix array overrun in rtw_get_tx_power_params()
drm/panfrost: Clear MMU irqs before handling the fault
drm/panfrost: Don't try to map pages that are already mapped
drm/radeon: fix copy of uninitialized variable back to userspace
drm/amd/display: Reject non-zero src_y and src_x for video planes
ALSA: hda/realtek: Re-order ALC882 Acer quirk table entries
ALSA: hda/realtek: Re-order ALC882 Sony quirk table entries
ALSA: hda/realtek: Re-order ALC882 Clevo quirk table entries
ALSA: hda/realtek: Re-order ALC269 HP quirk table entries
ALSA: hda/realtek: Re-order ALC269 Acer quirk table entries
ALSA: hda/realtek: Re-order ALC269 Dell quirk table entries
ALSA: hda/realtek: Re-order ALC269 ASUS quirk table entries
ALSA: hda/realtek: Re-order ALC269 Sony quirk table entries
ALSA: hda/realtek: Re-order ALC269 Lenovo quirk table entries
ALSA: hda/realtek: Re-order remaining ALC269 quirk table entries
ALSA: hda/realtek: Re-order ALC662 quirk table entries
ALSA: hda/realtek: Remove redundant entry for ALC861 Haier/Uniwill devices
ALSA: hda/realtek: ALC285 Thinkpad jack pin quirk is unreachable
KVM: s390: split kvm_s390_logical_to_effective
KVM: s390: fix guarded storage control register handling
s390: fix detection of vector enhancements facility 1 vs. vector packed decimal facility
KVM: s390: split kvm_s390_real_to_abs
KVM: nVMX: Truncate bits 63:32 of VMCS field on nested check in !64-bit
KVM: Stop looking for coalesced MMIO zones if the bus is destroyed
Revert "i3c master: fix missing destroy_workqueue() on error in i3c_master_register"
ovl: fix missing revert_creds() on error path
usb: gadget: pch_udc: Revert d3cb25a121
completely
memory: gpmc: fix out of bounds read and dereference on gpmc_cs[]
ARM: dts: exynos: correct fuel gauge interrupt trigger level on Midas family
ARM: dts: exynos: correct MUIC interrupt trigger level on Midas family
ARM: dts: exynos: correct PMIC interrupt trigger level on Midas family
ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid X/U3 family
ARM: dts: exynos: correct PMIC interrupt trigger level on SMDK5250
ARM: dts: exynos: correct PMIC interrupt trigger level on Snow
serial: stm32: fix incorrect characters on console
serial: stm32: fix tx_empty condition
usb: typec: tcpci: Check ROLE_CONTROL while interpreting CC_STATUS
regmap: set debugfs_name to NULL after it is freed
mtd: rawnand: fsmc: Fix error code in fsmc_nand_probe()
mtd: rawnand: brcmnand: fix OOB R/W with Hamming ECC
mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions()
mtd: rawnand: qcom: Return actual error code instead of -ENODEV
arm64: dts: qcom: sm8150: fix number of pins in 'gpio-ranges'
spi: stm32: drop devres version of spi_register_master
arm64: dts: renesas: r8a77980: Fix vin4-7 endpoint binding
x86/microcode: Check for offline CPUs before requesting new microcode
usb: gadget: pch_udc: Replace cpu_to_le32() by lower_32_bits()
usb: gadget: pch_udc: Check if driver is present before calling ->setup()
usb: gadget: pch_udc: Check for DMA mapping error
crypto: qat - don't release uninitialized resources
crypto: qat - ADF_STATUS_PF_RUNNING should be set after adf_dev_init
fotg210-udc: Fix DMA on EP0 for length > max packet size
fotg210-udc: Fix EP0 IN requests bigger than two packets
fotg210-udc: Remove a dubious condition leading to fotg210_done
fotg210-udc: Mask GRP2 interrupts we don't handle
fotg210-udc: Don't DMA more than the buffer can take
fotg210-udc: Complete OUT requests on short packets
mtd: require write permissions for locking and badblock ioctls
bus: qcom: Put child node before return
soundwire: bus: Fix device found flag correctly
phy: marvell: ARMADA375_USBCLUSTER_PHY should not default to y, unconditionally
crypto: qat - fix error path in adf_isr_resource_alloc()
usb: gadget: aspeed: fix dma map failure
USB: gadget: udc: fix wrong pointer passed to IS_ERR() and PTR_ERR()
memory: pl353: fix mask of ECC page_size config register
soundwire: stream: fix memory leak in stream config error path
m68k: mvme147,mvme16x: Don't wipe PCC timer config bits
mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init
irqchip/gic-v3: Fix OF_BAD_ADDR error handling
staging: rtl8192u: Fix potential infinite loop
staging: greybus: uart: fix unprivileged TIOCCSERIAL
PM / devfreq: Use more accurate returned new_freq as resume_freq
spi: Fix use-after-free with devm_spi_alloc_*
soc: qcom: mdt_loader: Validate that p_filesz < p_memsz
soc: qcom: mdt_loader: Detect truncated read of segments
ACPI: CPPC: Replace cppc_attr with kobj_attribute
crypto: qat - Fix a double free in adf_create_ring
cpufreq: armada-37xx: Fix setting TBG parent for load levels
clk: mvebu: armada-37xx-periph: remove .set_parent method for CPU PM clock
cpufreq: armada-37xx: Fix the AVS value for load L1
clk: mvebu: armada-37xx-periph: Fix switching CPU freq from 250 Mhz to 1 GHz
clk: mvebu: armada-37xx-periph: Fix workaround for switching from L1 to L0
cpufreq: armada-37xx: Fix driver cleanup when registration failed
cpufreq: armada-37xx: Fix determining base CPU frequency
spi: fsl-lpspi: Fix PM reference leak in lpspi_prepare_xfer_hardware()
usb: gadget: r8a66597: Add missing null check on return from platform_get_resource
USB: cdc-acm: fix unprivileged TIOCCSERIAL
USB: cdc-acm: fix TIOCGSERIAL implementation
tty: actually undefine superseded ASYNC flags
tty: fix return value for unsupported ioctls
serial: core: return early on unsupported ioctls
firmware: qcom-scm: Fix QCOM_SCM configuration
node: fix device cleanups in error handling code
usbip: vudc: fix missing unlock on error in usbip_sockfd_store()
platform/x86: pmc_atom: Match all Beckhoff Automation baytrail boards with critclk_systems DMI table
x86/platform/uv: Fix !KEXEC build failure
Drivers: hv: vmbus: Increase wait time for VMbus unload
usb: dwc2: Fix host mode hibernation exit with remote wakeup flow.
usb: dwc2: Fix hibernation between host and device modes.
ttyprintk: Add TTY hangup callback.
xen-blkback: fix compatibility bug with single page rings
soc: aspeed: fix a ternary sign expansion bug
media: vivid: fix assignment of dev->fbuf_out_flags
media: omap4iss: return error code when omap4iss_get() failed
media: aspeed: fix clock handling logic
media: platform: sunxi: sun6i-csi: fix error return code of sun6i_video_start_streaming()
media: m88rs6000t: avoid potential out-of-bounds reads on arrays
drm/amdkfd: fix build error with AMD_IOMMU_V2=m
x86/kprobes: Fix to check non boostable prefixes correctly
pata_arasan_cf: fix IRQ check
pata_ipx4xx_cf: fix IRQ check
sata_mv: add IRQ checks
ata: libahci_platform: fix IRQ check
nvme-tcp: block BH in sk state_change sk callback
nvmet-tcp: fix incorrect locking in state_change sk callback
nvme: retrigger ANA log update if group descriptor isn't found
media: v4l2-ctrls.c: fix race condition in hdl->requests list
vfio/mdev: Do not allow a mdev_type to have a NULL parent pointer
clk: zynqmp: move zynqmp_pll_set_mode out of round_rate callback
clk: qcom: a53-pll: Add missing MODULE_DEVICE_TABLE
clk: uniphier: Fix potential infinite loop
scsi: hisi_sas: Fix IRQ checks
scsi: jazz_esp: Add IRQ check
scsi: sun3x_esp: Add IRQ check
scsi: sni_53c710: Add IRQ check
scsi: ibmvfc: Fix invalid state machine BUG_ON()
mfd: stm32-timers: Avoid clearing auto reload register
nvme-pci: don't simple map sgl when sgls are disabled
HSI: core: fix resource leaks in hsi_add_client_from_dt()
x86/events/amd/iommu: Fix sysfs type mismatch
sched/debug: Fix cgroup_path[] serialization
drivers/block/null_blk/main: Fix a double free in null_init.
HID: plantronics: Workaround for double volume key presses
perf symbols: Fix dso__fprintf_symbols_by_name() to return the number of printed chars
net: lapbether: Prevent racing when checking whether the netif is running
powerpc/fadump: Mark fadump_calculate_reserve_size as __init
powerpc/prom: Mark identical_pvr_fixup as __init
inet: use bigger hash table for IP ID generation
powerpc: Fix HAVE_HARDLOCKUP_DETECTOR_ARCH build configuration
ALSA: core: remove redundant spin_lock pair in snd_card_disconnect
bug: Remove redundant condition check in report_bug
nfc: pn533: prevent potential memory corruption
net: hns3: Limiting the scope of vector_ring_chain variable
mips: bmips: fix syscon-reboot nodes
ALSA: usb-audio: Add error checks for usb_driver_claim_interface() calls
ASoC: simple-card: fix possible uninitialized single_cpu local variable
liquidio: Fix unintented sign extension of a left shift of a u16
powerpc/64s: Fix pte update for kernel memory on radix
powerpc/perf: Fix PMU constraint check for EBB events
powerpc: iommu: fix build when neither PCI or IBMVIO is set
mac80211: bail out if cipher schemes are invalid
mt7601u: fix always true expression
KVM: PPC: Book3S HV P9: Restore host CTRL SPR after guest exit
RDMA/qedr: Fix error return code in qedr_iw_connect()
IB/hfi1: Fix error return code in parse_platform_config()
cxgb4: Fix unintentional sign extension issues
net: thunderx: Fix unintentional sign extension issue
RDMA/srpt: Fix error return code in srpt_cm_req_recv()
i2c: img-scb: fix reference leak when pm_runtime_get_sync fails
i2c: imx-lpi2c: fix reference leak when pm_runtime_get_sync fails
i2c: omap: fix reference leak when pm_runtime_get_sync fails
i2c: sprd: fix reference leak when pm_runtime_get_sync fails
i2c: cadence: add IRQ check
i2c: emev2: add IRQ check
i2c: jz4780: add IRQ check
i2c: sh7760: add IRQ check
powerpc/xive: Fix xmon command "dxi"
ASoC: ak5558: correct reset polarity
drm/i915/gvt: Fix error code in intel_gvt_init_device()
perf beauty: Fix fsconfig generator
MIPS: pci-legacy: stop using of_pci_range_to_resource
powerpc/pseries: extract host bridge from pci_bus prior to bus removal
rtlwifi: 8821ae: upgrade PHY and RF parameters
i2c: sh7760: fix IRQ error path
mwl8k: Fix a double Free in mwl8k_probe_hw
vsock/vmci: log once the failed queue pair allocation
gro: fix napi_gro_frags() Fast GRO breakage due to IP alignment check
RDMA/cxgb4: add missing qpid increment
RDMA/i40iw: Fix error unwinding when i40iw_hmc_sd_one fails
ALSA: usb: midi: don't return -ENOMEM when usb_urb_ep_type_check fails
net: davinci_emac: Fix incorrect masking of tx and rx error channel
net: renesas: ravb: Fix a stuck issue when a lot of frames are received
net: phy: intel-xway: enable integrated led functions
ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices
ath10k: Fix ath10k_wmi_tlv_op_pull_peer_stats_info() unlock without lock
powerpc/52xx: Fix an invalid ASM expression ('addi' used instead of 'add')
bnxt_en: fix ternary sign extension bug in bnxt_show_temp()
ARM: dts: uniphier: Change phy-mode to RGMII-ID to enable delay pins for RTL8211E
arm64: dts: uniphier: Change phy-mode to RGMII-ID to enable delay pins for RTL8211E
net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb
selftests: net: mirror_gre_vlan_bridge_1q: Make an FDB entry static
bnxt_en: Fix RX consumer index logic in the error path.
net:emac/emac-mac: Fix a use after free in emac_mac_tx_buf_send
RDMA/siw: Fix a use after free in siw_alloc_mr
RDMA/bnxt_re: Fix a double free in bnxt_qplib_alloc_res
net: bridge: mcast: fix broken length + header check for MRDv6 Adv.
net:nfc:digital: Fix a double free in digital_tg_recv_dep_req
kfifo: fix ternary sign extension bugs
mm/sparse: add the missing sparse_buffer_fini() in error branch
mm/memory-failure: unnecessary amount of unmapping
net: Only allow init netns to set default tcp cong to a restricted algo
smp: Fix smp_call_function_single_async prototype
Revert "net/sctp: fix race condition in sctp_destroy_sock"
sctp: delay auto_asconf init until binding the first addr
Revert "of/fdt: Make sure no-map does not remove already reserved regions"
Revert "fdt: Properly handle "no-map" field in the memory region"
Linux 5.4.119
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I390870da8d51c4180e8808fc457c02e5506865ec
203 lines
5.1 KiB
C
203 lines
5.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/vmalloc.h>
|
|
#include "null_blk.h"
|
|
|
|
#define MB_TO_SECTS(mb) (((sector_t)mb * SZ_1M) >> SECTOR_SHIFT)
|
|
|
|
static inline unsigned int null_zone_no(struct nullb_device *dev, sector_t sect)
|
|
{
|
|
return sect >> ilog2(dev->zone_size_sects);
|
|
}
|
|
|
|
int null_zone_init(struct nullb_device *dev)
|
|
{
|
|
sector_t dev_capacity_sects;
|
|
sector_t sector = 0;
|
|
unsigned int i;
|
|
|
|
if (!is_power_of_2(dev->zone_size)) {
|
|
pr_err("zone_size must be power-of-two\n");
|
|
return -EINVAL;
|
|
}
|
|
if (dev->zone_size > dev->size) {
|
|
pr_err("Zone size larger than device capacity\n");
|
|
return -EINVAL;
|
|
}
|
|
|
|
dev_capacity_sects = MB_TO_SECTS(dev->size);
|
|
dev->zone_size_sects = MB_TO_SECTS(dev->zone_size);
|
|
dev->nr_zones = dev_capacity_sects >> ilog2(dev->zone_size_sects);
|
|
if (dev_capacity_sects & (dev->zone_size_sects - 1))
|
|
dev->nr_zones++;
|
|
|
|
dev->zones = kvmalloc_array(dev->nr_zones, sizeof(struct blk_zone),
|
|
GFP_KERNEL | __GFP_ZERO);
|
|
if (!dev->zones)
|
|
return -ENOMEM;
|
|
|
|
if (dev->zone_nr_conv >= dev->nr_zones) {
|
|
dev->zone_nr_conv = dev->nr_zones - 1;
|
|
pr_info("changed the number of conventional zones to %u",
|
|
dev->zone_nr_conv);
|
|
}
|
|
|
|
for (i = 0; i < dev->zone_nr_conv; i++) {
|
|
struct blk_zone *zone = &dev->zones[i];
|
|
|
|
zone->start = sector;
|
|
zone->len = dev->zone_size_sects;
|
|
zone->wp = zone->start + zone->len;
|
|
zone->type = BLK_ZONE_TYPE_CONVENTIONAL;
|
|
zone->cond = BLK_ZONE_COND_NOT_WP;
|
|
|
|
sector += dev->zone_size_sects;
|
|
}
|
|
|
|
for (i = dev->zone_nr_conv; i < dev->nr_zones; i++) {
|
|
struct blk_zone *zone = &dev->zones[i];
|
|
|
|
zone->start = zone->wp = sector;
|
|
if (zone->start + dev->zone_size_sects > dev_capacity_sects)
|
|
zone->len = dev_capacity_sects - zone->start;
|
|
else
|
|
zone->len = dev->zone_size_sects;
|
|
zone->type = BLK_ZONE_TYPE_SEQWRITE_REQ;
|
|
zone->cond = BLK_ZONE_COND_EMPTY;
|
|
|
|
sector += dev->zone_size_sects;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void null_zone_exit(struct nullb_device *dev)
|
|
{
|
|
kvfree(dev->zones);
|
|
dev->zones = NULL;
|
|
}
|
|
|
|
int null_report_zones(struct gendisk *disk, sector_t sector,
|
|
unsigned int nr_zones, report_zones_cb cb, void *data)
|
|
{
|
|
struct nullb *nullb = disk->private_data;
|
|
struct nullb_device *dev = nullb->dev;
|
|
unsigned int first_zone, i;
|
|
struct blk_zone zone;
|
|
int error;
|
|
|
|
first_zone = null_zone_no(dev, sector);
|
|
if (first_zone >= dev->nr_zones)
|
|
return 0;
|
|
|
|
nr_zones = min(nr_zones, dev->nr_zones - first_zone);
|
|
for (i = 0; i < nr_zones; i++) {
|
|
/*
|
|
* Stacked DM target drivers will remap the zone information by
|
|
* modifying the zone information passed to the report callback.
|
|
* So use a local copy to avoid corruption of the device zone
|
|
* array.
|
|
*/
|
|
memcpy(&zone, &dev->zones[first_zone + i],
|
|
sizeof(struct blk_zone));
|
|
error = cb(&zone, i, data);
|
|
if (error)
|
|
return error;
|
|
}
|
|
|
|
return nr_zones;
|
|
}
|
|
|
|
size_t null_zone_valid_read_len(struct nullb *nullb,
|
|
sector_t sector, unsigned int len)
|
|
{
|
|
struct nullb_device *dev = nullb->dev;
|
|
struct blk_zone *zone = &dev->zones[null_zone_no(dev, sector)];
|
|
unsigned int nr_sectors = len >> SECTOR_SHIFT;
|
|
|
|
/* Read must be below the write pointer position */
|
|
if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL ||
|
|
sector + nr_sectors <= zone->wp)
|
|
return len;
|
|
|
|
if (sector > zone->wp)
|
|
return 0;
|
|
|
|
return (zone->wp - sector) << SECTOR_SHIFT;
|
|
}
|
|
|
|
static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
|
|
unsigned int nr_sectors)
|
|
{
|
|
struct nullb_device *dev = cmd->nq->dev;
|
|
unsigned int zno = null_zone_no(dev, sector);
|
|
struct blk_zone *zone = &dev->zones[zno];
|
|
|
|
switch (zone->cond) {
|
|
case BLK_ZONE_COND_FULL:
|
|
/* Cannot write to a full zone */
|
|
cmd->error = BLK_STS_IOERR;
|
|
return BLK_STS_IOERR;
|
|
case BLK_ZONE_COND_EMPTY:
|
|
case BLK_ZONE_COND_IMP_OPEN:
|
|
/* Writes must be at the write pointer position */
|
|
if (sector != zone->wp)
|
|
return BLK_STS_IOERR;
|
|
|
|
if (zone->cond == BLK_ZONE_COND_EMPTY)
|
|
zone->cond = BLK_ZONE_COND_IMP_OPEN;
|
|
|
|
zone->wp += nr_sectors;
|
|
if (zone->wp == zone->start + zone->len)
|
|
zone->cond = BLK_ZONE_COND_FULL;
|
|
break;
|
|
case BLK_ZONE_COND_NOT_WP:
|
|
break;
|
|
default:
|
|
/* Invalid zone condition */
|
|
return BLK_STS_IOERR;
|
|
}
|
|
return BLK_STS_OK;
|
|
}
|
|
|
|
static blk_status_t null_zone_reset(struct nullb_cmd *cmd, sector_t sector)
|
|
{
|
|
struct nullb_device *dev = cmd->nq->dev;
|
|
struct blk_zone *zone = &dev->zones[null_zone_no(dev, sector)];
|
|
size_t i;
|
|
|
|
switch (req_op(cmd->rq)) {
|
|
case REQ_OP_ZONE_RESET_ALL:
|
|
for (i = 0; i < dev->nr_zones; i++) {
|
|
if (zone[i].type == BLK_ZONE_TYPE_CONVENTIONAL)
|
|
continue;
|
|
zone[i].cond = BLK_ZONE_COND_EMPTY;
|
|
zone[i].wp = zone[i].start;
|
|
}
|
|
break;
|
|
case REQ_OP_ZONE_RESET:
|
|
if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
|
|
return BLK_STS_IOERR;
|
|
|
|
zone->cond = BLK_ZONE_COND_EMPTY;
|
|
zone->wp = zone->start;
|
|
break;
|
|
default:
|
|
return BLK_STS_NOTSUPP;
|
|
}
|
|
return BLK_STS_OK;
|
|
}
|
|
|
|
blk_status_t null_handle_zoned(struct nullb_cmd *cmd, enum req_opf op,
|
|
sector_t sector, sector_t nr_sectors)
|
|
{
|
|
switch (op) {
|
|
case REQ_OP_WRITE:
|
|
return null_zone_write(cmd, sector, nr_sectors);
|
|
case REQ_OP_ZONE_RESET:
|
|
case REQ_OP_ZONE_RESET_ALL:
|
|
return null_zone_reset(cmd, sector);
|
|
default:
|
|
return BLK_STS_OK;
|
|
}
|
|
}
|