tree: https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android14-5.15 head: d701aaaeb47ec3b6b50cff1366769f7243830848 commit: 33aea9741e00d2f1a9b907bd75f3a60ee41b4bcc [3/4] ANDROID: scsi: Retry unaligned zoned writes config: x86_64-defconfig compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce (this is a W=1 build): # https://github.com/ammarfaizi2/linux-block/commit/33aea9741e00d2f1a9b907bd75f3a60ee41b4bcc git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android14-5.15 git checkout 33aea9741e00d2f1a9b907bd75f3a60ee41b4bcc # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=x86_64 olddefconfig make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): drivers/scsi/sd.c: In function 'sd_setup_read_write_cmnd': >> drivers/scsi/sd.c:1308:13: error: implicit declaration of function 'blk_rq_is_seq_zone_write' [-Werror=implicit-function-declaration] 1308 | blk_rq_is_seq_zone_write(rq)) | ^~~~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/blk_rq_is_seq_zone_write +1308 drivers/scsi/sd.c 1214 1215 static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd) 1216 { 1217 struct request *rq = scsi_cmd_to_rq(cmd); 1218 struct scsi_device *sdp = cmd->device; 1219 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); 1220 sector_t lba = sectors_to_logical(sdp, blk_rq_pos(rq)); 1221 sector_t threshold; 1222 unsigned int nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq)); 1223 unsigned int mask = logical_to_sectors(sdp, 1) - 1; 1224 bool write = rq_data_dir(rq) == WRITE; 1225 unsigned char protect, fua; 1226 blk_status_t ret; 1227 unsigned int dif; 1228 bool dix; 1229 1230 ret = scsi_alloc_sgtables(cmd); 1231 if (ret != BLK_STS_OK) 1232 return ret; 1233 1234 ret = BLK_STS_IOERR; 1235 if (!scsi_device_online(sdp) || sdp->changed) { 1236 scmd_printk(KERN_ERR, cmd, "device offline or changed\n"); 1237 goto fail; 1238 } 1239 1240 if (blk_rq_pos(rq) + blk_rq_sectors(rq) > get_capacity(rq->rq_disk)) { 1241 scmd_printk(KERN_ERR, cmd, "access beyond end of device\n"); 1242 goto fail; 1243 } 1244 1245 if ((blk_rq_pos(rq) & mask) || (blk_rq_sectors(rq) & mask)) { 1246 scmd_printk(KERN_ERR, cmd, "request not aligned to the logical block size\n"); 1247 goto fail; 1248 } 1249 1250 /* 1251 * Some SD card readers can't handle accesses which touch the 1252 * last one or two logical blocks. Split accesses as needed. 1253 */ 1254 threshold = sdkp->capacity - SD_LAST_BUGGY_SECTORS; 1255 1256 if (unlikely(sdp->last_sector_bug && lba + nr_blocks > threshold)) { 1257 if (lba < threshold) { 1258 /* Access up to the threshold but not beyond */ 1259 nr_blocks = threshold - lba; 1260 } else { 1261 /* Access only a single logical block */ 1262 nr_blocks = 1; 1263 } 1264 } 1265 1266 if (req_op(rq) == REQ_OP_ZONE_APPEND) { 1267 ret = sd_zbc_prepare_zone_append(cmd, &lba, nr_blocks); 1268 if (ret) 1269 goto fail; 1270 } 1271 1272 fua = rq->cmd_flags & REQ_FUA ? 0x8 : 0; 1273 dix = scsi_prot_sg_count(cmd); 1274 dif = scsi_host_dif_capable(cmd->device->host, sdkp->protection_type); 1275 1276 if (dif || dix) 1277 protect = sd_setup_protect_cmnd(cmd, dix, dif); 1278 else 1279 protect = 0; 1280 1281 if (protect && sdkp->protection_type == T10_PI_TYPE2_PROTECTION) { 1282 ret = sd_setup_rw32_cmnd(cmd, write, lba, nr_blocks, 1283 protect | fua); 1284 } else if (sdp->use_16_for_rw || (nr_blocks > 0xffff)) { 1285 ret = sd_setup_rw16_cmnd(cmd, write, lba, nr_blocks, 1286 protect | fua); 1287 } else if ((nr_blocks > 0xff) || (lba > 0x1fffff) || 1288 sdp->use_10_for_rw || protect) { 1289 ret = sd_setup_rw10_cmnd(cmd, write, lba, nr_blocks, 1290 protect | fua); 1291 } else { 1292 ret = sd_setup_rw6_cmnd(cmd, write, lba, nr_blocks, 1293 protect | fua); 1294 } 1295 1296 if (unlikely(ret != BLK_STS_OK)) 1297 goto fail; 1298 1299 /* 1300 * We shouldn't disconnect in the middle of a sector, so with a dumb 1301 * host adapter, it's safe to assume that we can at least transfer 1302 * this many bytes between each connect / disconnect. 1303 */ 1304 cmd->transfersize = sdp->sector_size; 1305 cmd->underflow = nr_blocks << 9; 1306 cmd->allowed = sdkp->max_retries; 1307 if (blk_queue_pipeline_zoned_writes(rq->q) && > 1308 blk_rq_is_seq_zone_write(rq)) 1309 cmd->allowed += rq->q->nr_requests; 1310 cmd->sdb.length = nr_blocks * sdp->sector_size; 1311 1312 SCSI_LOG_HLQUEUE(1, 1313 scmd_printk(KERN_INFO, cmd, 1314 "%s: block=%llu, count=%d\n", __func__, 1315 (unsigned long long)blk_rq_pos(rq), 1316 blk_rq_sectors(rq))); 1317 SCSI_LOG_HLQUEUE(2, 1318 scmd_printk(KERN_INFO, cmd, 1319 "%s %d/%u 512 byte blocks.\n", 1320 write ? "writing" : "reading", nr_blocks, 1321 blk_rq_sectors(rq))); 1322 1323 /* 1324 * This indicates that the command is ready from our end to be queued. 1325 */ 1326 return BLK_STS_OK; 1327 fail: 1328 scsi_free_sgtables(cmd); 1329 return ret; 1330 } 1331 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests