RE: [RFCv2 2/3] block: add helper for setting and clearing S_DAX on inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: linux-block-owner@xxxxxxxxxxxxxxx [mailto:linux-block-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Jon Derrick
> Sent: Friday, May 13, 2016 7:03 PM
...
> Subject: [RFCv2 2/3] block: add helper for setting and clearing S_DAX on
> inode
> 
> inode->i_flags locking rules suggest using the i_mutex lock. This patch
> adds a helper to do the locking and setting of S_DAX on the block device
> inode.
...
> +static void bd_set_dax(struct block_device *bdev, bool enabled)
> +{
> +	struct inode *inode = bdev->bd_inode;
> +
> +	inode_lock(inode);
> +	if (enabled)
> +		inode->i_flags = S_DAX;
> +	else
> +		inode->i_flags &= ~S_DAX;
> +	inode_unlock(inode);
> +}

This is not symmetric - setting wipes out any other bits, but
clearing only clears the S_DAX bit. That seems confusing for
a helper function.

Using |= would be symmetric, but wouldn't replace what 
__blkdev_get does (if what it does is appropriate).

> @@ -1206,9 +1218,9 @@ static int __blkdev_get(struct block_device *bdev,
> fmode_t mode, int for_part)
>  		bdev->bd_queue = disk->queue;
>  		bdev->bd_contains = bdev;
>  		if (IS_ENABLED(CONFIG_BLK_DEV_DAX) && disk->fops-
> >direct_access)
> -			bdev->bd_inode->i_flags = S_DAX;
> +			bd_set_dax(bdev, 1);
>  		else
> -			bdev->bd_inode->i_flags &= ~S_DAX;
> +			bd_set_dax(bdev, 0);

--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux