Re: [PATCH] target/file: Add WRITE_SAME w/ UNMAP=1 emulation support

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

 



On Wed, 2013-02-20 at 22:24 -0800, Andy Grover wrote:
> On 02/20/2013 09:57 PM, Asias He wrote:
> > This patch adds support for emulation of WRITE_SAME w/ UNMAP=1 within
> > fd_execute_write_same_unmap() backend code.
> >
> > If the FILEIO backend is normal file, the emulation uses fallocate to
> > punch hole to reclaim the free space used by the file. If the FILEIO
> > backend is block device, the emulation uses blkdev_issue_discard().
> >
> > Tested with 512, 1k, 2k, and 4k block_sizes.
> 
> > +	if (S_ISBLK(inode->i_mode)) {
> > +		/* The backend is block device, use discard */
> > +		struct block_device *bdev = inode->i_bdev;
> > +
> > +		ret = blkdev_issue_discard(bdev, cmd->t_task_lba,
> > +				nolb, GFP_KERNEL, 0);
> > +		if (ret < 0) {
> > +			pr_warn("FILEIO: blkdev_issue_discard() failed: %d\n",
> > +				ret);
> > +			return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
> > +		}
> > +	} else {
> 
> Nothing wrong with this patch as far as I can see... but I'd like to 
> reiterate my belief that we'd probably be happier if the fileio backend 
> didn't also support block devices.
> 

Not exactly.  Some people still want/need buffered FILEIO access to an
underlying block_device for performance reasons.  Given that there is no
functional equivalent with IBLOCK, dis-allowing struct block_device
export via FILEIO is not an option.

--nab

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


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux