ld_pd_map.c revision 2ffc8bca2d4d633ffdea78ed925cd1ca63584844
/*
* **********************************************************************
*
*
* Solaris MegaRAID device driver for SAS2.0 controllers
* Copyright (c) 2008-2012, LSI Logic Corporation.
* All rights reserved.
*
* Version:
* Author:
* Swaminathan K S
* Arun Chandrashekhar
* Manju R
* Rasheed
* Shakeel Bukhari
*
*
* This module contains functions for device drivers
* to get pd-ld mapping information.
*
* **********************************************************************
*/
#include "mr_sas.h"
#include "ld_pd_map.h"
/*
* This function will check if FAST IO is possible on this logical drive
* by checking the EVENT information available in the driver
*/
#define MR_LD_STATE_OPTIMAL 3
#define ABS_DIFF(a, b) (((a) > (b)) ? ((a) - (b)) : ((b) - (a)))
static void mr_update_load_balance_params(MR_FW_RAID_MAP_ALL *,
#define FALSE 0
#define TRUE 1
typedef U64 REGION_KEY;
typedef U32 REGION_LEN;
extern int debug_level_g;
{
}
{
}
static MR_SPAN_BLOCK_INFO *
{
}
static U8
{
}
static U16
{
}
static U16
{
}
static U16
{
}
{
}
{
if (ld >= MAX_LOGICAL_DRIVES) {
return (FALSE);
}
}
static MR_LD_SPAN *
{
}
/*
* This function will validate Map info data provided by FW
*/
{
"map info structure size 0x%x is "
"not matching with ld count\n", fwsize));
/* sizeof (foo) returns size_t, which is *LONG*. */
return (0);
}
return (1);
}
int *div_error)
{
*div_error = 1;
return (span);
}
}
return (span);
}
}
}
return (span);
}
/*
* *************************************************************
*
* This routine calculates the arm, span and block for
* the specified stripe and reference in stripe.
*
* Inputs :
*
* ld - Logical drive number
* stripRow - Stripe number
* stripRef - Reference in stripe
*
* Outputs :
*
* span - Span number
* block - Absolute Block number in the physical disk
*/
{
int error_code = 0;
return (FALSE);
}
} else {
return (FALSE);
}
span = 0;
} else
if (error_code == 1)
return (FALSE);
/* Get the array on which this span is present. */
/* Get the Pd. */
/* Get dev handle from Pd. */
if (pd != MR_PD_INVALID) {
} else {
/* Get Alternate Pd. */
/* Get dev handle from Pd. */
if (pd != MR_PD_INVALID)
}
}
return (retval);
}
/*
* ***********************************************************************
*
* MR_BuildRaidContext function
*
* information is calculated then the lock is acquired.
* This function will return 0 if region lock
* was acquired OR return num strips ???
*/
{
return (FALSE);
}
if (ld >= MAX_LOGICAL_DRIVES) {
return (FALSE);
}
/*
* calculate starting row and stripe, and number of strips and rows
*/
/* Check to make sure is not dividing by zero */
if (raid->rowDataSize == 0)
return (FALSE);
/* get the row count */
/*
* calculate region info.
*/
/* Check if we can send this I/O via FastPath */
if (isRead) {
((num_strips == 1) ||
} else {
((num_strips == 1) ||
}
} else
/*
* Check for DIF support
*/
} else {
}
if (numRows == 1) {
if (num_strips == 1) {
}
} else {
}
if (numRows > 2) {
}
} else {
}
}
} else {
}
/*
* Get Phy Params only if FP capable,
* or else leave it to MR firmware to do the calculation.
*/
/* if fast path possible then get the physical parameters */
/* If IO on an invalid Pd, then FP is not possible. */
return (retval);
} else if (isRead) {
pRAID_Context, map)) {
return (TRUE);
}
}
}
return (TRUE);
}
void
{
int ldCount;
if (ld >= MAX_LOGICAL_DRIVES) {
continue;
}
/* Two drive Optimal RAID 1 */
/* Get the array on which this span is present. */
/* Get dev handle from Pd. */
/* Get dev handle from Pd. */
"mrsas: ld=%d load balancing enabled \n", ldCount));
} else {
}
}
}
{
/* get the pending cmds for the data and mirror arms */
/* Determine the disk whose head is nearer to the req. block */
bestArm ^= 1;
}
/* Update the last accessed block on the correct pd */
return (bestArm);
}
struct IO_REQUEST_INFO *io_info)
{
/* get best new arm */
return (devHandle);
}