bmask = block_size(rdev->bdev)-1; 
bmask = queue_hardsect_size(rdev->bdev->bd_disk->queue)-1; 
static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version){	struct mdp_superblock_1 *sb;	int ret;	sector_t sb_offset;	char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE];	int bmask;	/*	 * Calculate the position of the superblock.	 * It is always aligned to a 4K boundary and	 * depeding on minor_version, it can be:	 * 0: At least 8K, but less than 12K, from end of device	 * 1: At start of device	 * 2: 4K from start of device.	 */	switch(minor_version) {	case 0:		sb_offset = rdev->bdev->bd_inode->i_size >> 9;		sb_offset -= 8*2;		sb_offset &= ~(sector_t)(4*2-1);		/* convert from sectors to K */		sb_offset /= 2;		break;	case 1:		sb_offset = 0;		break;	case 2:		sb_offset = 4;		break;	default:		return -EINVAL;	}	rdev->sb_offset = sb_offset;	/* superblock is rarely larger than 1K, but it can be larger,	 * and it is safe to read 4k, so we do that	 */	ret = read_disk_sb(rdev, 4096);	if (ret) return ret;	sb = (struct mdp_superblock_1*)page_address(rdev->sb_page);	if (sb->magic != cpu_to_le32(MD_SB_MAGIC) ||	    sb->major_version != cpu_to_le32(1) ||	    le32_to_cpu(sb->max_dev) > (4096-256)/2 ||	    le64_to_cpu(sb->super_offset) != (rdev->sb_offset<<1) ||	    (le32_to_cpu(sb->feature_map) & ~MD_FEATURE_ALL) != 0)		return -EINVAL;	if (calc_sb_1_csum(sb) != sb->sb_csum) {		printk("md: invalid superblock checksum on %s\n",			bdevname(rdev->bdev,b));		return -EINVAL;	}	if (le64_to_cpu(sb->data_size) < 10) {		printk("md: data_size too small on %s\n",		       bdevname(rdev->bdev,b));		return -EINVAL;	}	rdev->preferred_minor = 0xffff;	rdev->data_offset = le64_to_cpu(sb->data_offset);	rdev->sb_size = le32_to_cpu(sb->max_dev) * 2 + 256;	bmask = block_size(rdev->bdev)-1;	if (rdev->sb_size & bmask)		rdev-> sb_size = (rdev->sb_size | bmask)+1;	if (refdev == 0)		return 1;	else {		__u64 ev1, ev2;		struct mdp_superblock_1 *refsb = 			(struct mdp_superblock_1*)page_address(refdev->sb_page);		if (memcmp(sb->set_uuid, refsb->set_uuid, 16) != 0 ||		    sb->level != refsb->level ||		    sb->layout != refsb->layout ||		    sb->chunksize != refsb->chunksize) {			printk(KERN_WARNING "md: %s has strangely different"				" superblock to %s\n",				bdevname(rdev->bdev,b),				bdevname(refdev->bdev,b2));			return -EINVAL;		}		ev1 = le64_to_cpu(sb->events);		ev2 = le64_to_cpu(refsb->events);		if (ev1 > ev2)			return 1;	}	if (minor_version) 		rdev->size = ((rdev->bdev->bd_inode->i_size>>9) - le64_to_cpu(sb->data_offset)) / 2;	else		rdev->size = rdev->sb_offset;	if (rdev->size < le64_to_cpu(sb->data_size)/2)		return -EINVAL;	rdev->size = le64_to_cpu(sb->data_size)/2;	if (le32_to_cpu(sb->chunksize))		rdev->size &= ~((sector_t)le32_to_cpu(sb->chunksize)/2 - 1);	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/720a3dc39b030e273bc955641f2517874fd38fc5/md.c/clean/drivers/md/md.c