Commit 602bcf2
committed
ata: libata: Improve CDL resource management
The ncq_sense_buf buffer field of struct ata_port is allocated and used
only for devices that support the Command Duration Limits (CDL) feature.
However, the cdl buffer of struct ata_device, which is used to cache the
command duration limits log page for devices supporting CDL is always
allocated as part of struct ata_device, which is wasteful of memory for
devices that do not support this feature.
Clean this up by defining both buffers as part of the new ata_cdl
structure and allocating this structure only for devices that support
the CDL feature. This new structure is attached to struct ata_device
using the cdl pointer.
The functions ata_dev_init_cdl_resources() and
ata_dev_cleanup_cdl_resources() are defined to manage this new structure
allocation, initialization and freeing when a port is removed or a
device disabled. ata_dev_init_cdl_resources() is called from
ata_dev_config_cdl() only for devices that support CDL.
ata_dev_cleanup_cdl_resources() is called from ata_dev_free_resources()
to free the ata_cdl structure when a device is being disabled by EH.
Note that the name of the former cdl log buffer of struct ata_device is
changed to desc_log_buf to make it clearer that it is a buffer for the
limit descriptors log page.
This change reduces the size of struct ata_device, thus reducing memory
usage for ATA devices that do not support the CDL feature.
Signed-off-by: Damien Le Moal <[email protected]>
Reviewed-by: Niklas Cassel <[email protected]>1 parent 5f8319c commit 602bcf2
File tree
5 files changed
+57
-30
lines changed- drivers/ata
- include/linux
5 files changed
+57
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2464 | 2464 | | |
2465 | 2465 | | |
2466 | 2466 | | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
2467 | 2496 | | |
2468 | 2497 | | |
2469 | | - | |
2470 | 2498 | | |
2471 | 2499 | | |
2472 | 2500 | | |
| 2501 | + | |
2473 | 2502 | | |
2474 | 2503 | | |
2475 | 2504 | | |
| |||
2564 | 2593 | | |
2565 | 2594 | | |
2566 | 2595 | | |
2567 | | - | |
2568 | | - | |
2569 | | - | |
2570 | | - | |
2571 | | - | |
2572 | | - | |
2573 | | - | |
2574 | | - | |
2575 | | - | |
2576 | | - | |
2577 | | - | |
2578 | | - | |
2579 | | - | |
2580 | | - | |
2581 | | - | |
2582 | | - | |
2583 | | - | |
2584 | | - | |
2585 | | - | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
2586 | 2600 | | |
2587 | 2601 | | |
2588 | 2602 | | |
2589 | | - | |
2590 | 2603 | | |
2591 | 2604 | | |
2592 | 2605 | | |
2593 | 2606 | | |
2594 | 2607 | | |
2595 | 2608 | | |
2596 | | - | |
2597 | | - | |
| 2609 | + | |
2598 | 2610 | | |
2599 | 2611 | | |
2600 | 2612 | | |
| |||
5451 | 5463 | | |
5452 | 5464 | | |
5453 | 5465 | | |
5454 | | - | |
5455 | 5466 | | |
5456 | 5467 | | |
5457 | 5468 | | |
| |||
5989 | 6000 | | |
5990 | 6001 | | |
5991 | 6002 | | |
| 6003 | + | |
| 6004 | + | |
5992 | 6005 | | |
5993 | 6006 | | |
5994 | 6007 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1505 | 1505 | | |
1506 | 1506 | | |
1507 | 1507 | | |
1508 | | - | |
| 1508 | + | |
1509 | 1509 | | |
1510 | 1510 | | |
1511 | 1511 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2248 | 2248 | | |
2249 | 2249 | | |
2250 | 2250 | | |
2251 | | - | |
| 2251 | + | |
2252 | 2252 | | |
2253 | 2253 | | |
2254 | 2254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
703 | 718 | | |
704 | 719 | | |
705 | 720 | | |
| |||
762 | 777 | | |
763 | 778 | | |
764 | 779 | | |
765 | | - | |
766 | | - | |
| 780 | + | |
| 781 | + | |
767 | 782 | | |
768 | 783 | | |
769 | 784 | | |
| |||
917 | 932 | | |
918 | 933 | | |
919 | 934 | | |
920 | | - | |
921 | | - | |
922 | 935 | | |
923 | 936 | | |
924 | 937 | | |
| |||
0 commit comments