Re: [PATCH 3/3] xfs: add kmem_alloc_io()

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

 



> +	ptr = kmem_alloc(size, flags | KM_MAYFAIL);
> +	if (ptr) {
> +		if (!((uintptr_t)ptr & align_mask))
> +			return ptr;
> +		kfree(ptr);
> +	}
> +	return __kmem_vmalloc(size, flags);

Not that іt really matters, I'd write so that the fast path is the main
return:

	ptr = kmem_alloc(size, flags | KM_MAYFAIL);
	if (unlikely(!ptr || (intptr_t)ptr & align_mask)) {
		kfree(ptr);
		ptr = __kmem_vmalloc(size, flags);
	}
	return ptr;

> +		int align_mask = xfs_buftarg_dma_alignment(bp->b_target);
> +		bp->b_addr = kmem_alloc_io(size, align_mask, KM_NOFS);

The int vs an unsigned type here looks a little odd, but I guess that
just propagates from queue_dma_alignment.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux