Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void ata_rw_virt(struct queue_item *q)
- {
- struct device *const dev = q->dev;
- if (G_UNLIKELY(q->ata_hdr.nsect > max_sect_nr(q->iface)))
- {
- devlog(dev, LOG_ERR, "Request too large (%d)", q->ata_hdr.nsect);
- return finish_ata(q, ATA_ABORTED, ATA_DRDY | ATA_ERR);
- }
- if (G_UNLIKELY(q->is_write && q->length < (unsigned)q->ata_hdr.nsect << 9))
- {
- devlog(dev, LOG_ERR, "Short write request (have %u, requested %u)",
- q->length, (unsigned)q->ata_hdr.nsect << 9);
- return finish_ata(q, ATA_ABORTED, ATA_DRDY | ATA_ERR);
- }
- q->length = (unsigned)q->ata_hdr.nsect << 9;
- q->is_ata = TRUE;
- if (q->is_write)
- {
- struct cs_netlist *nl = dev->dppolicy.encode(q);
- struct cs_netlist *nl_tmp = nl;
- unsigned long long tmp_offset = q->offset;
- while(nl_tmp)
- {
- int osds[nl_tmp->count];
- /*make outputs for one block*/
- block_to_nodes(nl_tmp->count, tmp_offset,
- 1,//TODO to have more then virtual disk we must calculate fo wwn's unique int's and hash
- osds, NULL); // get list of outputs
- int i;
- for(i = 0; i < nl_tmp->count; i++){
- printf("osds[%d] = %d\n", i, osds[i]);
- device_macs_t *dev_macs = devices_macs;
- while (dev_macs)
- {
- if (dev_macs->device_id == osds[i])
- {
- printf("aoecmd_ata_rw(buf, %d, %d, %d, %d, %d, %d)\n",
- nl_tmp->length,
- dev_macs->shelf,
- dev_macs->slot,
- nl_tmp->writebit,
- nl_tmp->extbit,
- nl_tmp->offset
- );
- nl_tmp->shelf = dev_macs->shelf;
- nl_tmp->slot = dev_macs->slot;
- //aoecmd_ata_rw(nl_tmp->buf, nl_tmp->length, dev_macs->shelf, dev_macs->slot, nl_tmp->writebit, nl_tmp->extbit, nl_tmp->offset);
- aoecmd_ata_rw(nl_tmp);
- break;
- }
- dev_macs=dev_macs->nxt;
- }
- }
- tmp_offset += nl_tmp->length;
- nl_tmp = nl_tmp->next;
- }
- dev->stats.write_bytes += q->length;
- ++dev->stats.write_cnt;
- }
- else
- {
- //struct cs_netlist *nl = NULL;
- /*TODO!!! CRUCH*/
- /*TODO!!! NetWork*/
- /*
- int err = dev->dppolicy.decode(q, nl);
- if(err)
- {
- devlog(dev, LOG_ERR, "Can not decode request");
- return finish_ata(q, ATA_ABORTED, ATA_DRDY | ATA_ERR);
- }
- */
- dev->stats.read_bytes += q->length;
- ++dev->stats.read_cnt;
- }
- /* If there are any deferred requests, then mark the device as active
- * to ensure run_queue() will get called */
- g_ptr_array_add(dev->deferred, q);
- activate_dev(dev);
- }
- static struct cs_netlist* cs_mirror_dppolicy_encode(struct queue_item *q)
- {
- struct device *const dev = q->dev;
- struct cs_netlist *nl_item;
- if ((nl_item = malloc(sizeof(struct cs_netlist))) == NULL)
- return NULL;
- nl_item->buf = q->buf;
- nl_item->length = q->length;
- nl_item->count = dev->dppolicy.k + dev->dppolicy.m;
- memcpy(nl_item->wwn, dev->cfg.wwn, WWN_ALEN);
- nl_item->offset = q->offset;
- nl_item->writebit = q->is_write;
- nl_item->next = NULL;
- return nl_item;
- }
Add Comment
Please, Sign In to add comment