From: Jeff Moyer <jmoyer@redhat.com>
To: Lukas Czerner <lczerner@redhat.com>
Cc: linux-kernel@vger.kernel.org, achender@linux.vnet.ibm.com,
Jens Axboe <jaxboe@fusionio.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] loop: add discard support for loop devices
Date: Thu, 18 Aug 2011 11:33:22 -0400 [thread overview]
Message-ID: <x497h6aspj1.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1108171511070.3699@dhcp-27-109.brq.redhat.com> (Lukas Czerner's message of "Wed, 17 Aug 2011 15:13:31 +0200 (CEST)")
Lukas Czerner <lczerner@redhat.com> writes:
>> @@ -484,6 +485,29 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio)
>> }
>> }
>>
>> + /*
>> + * We use punch hole to reclaim the free space used by the
>> + * image a.k.a. discard. However we do support discard if
>> + * encryption is enabled, because it may give an attacker
>> + * useful information.
>> + */
>> + if (bio->bi_rw & REQ_DISCARD) {
>> + struct file *file = lo->lo_backing_file;
>> + int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
>> +
>> + if ((!file->f_op->fallocate) ||
>> + lo->lo_encrypt_key_size) {
>> + ret = -EOPNOTSUPP;
>> + goto out;
>> + }
>> + ret = file->f_op->fallocate(file, mode, pos,
>> + bio->bi_size);
>> + if (unlikely(ret && ret != -EINVAL &&
>> + ret != -EOPNOTSUPP))
>> + ret = -EIO;
>> + goto out;
>> + }
>> +
Seems you missed the bizarre case of configuring a loop device over top
of a block device.
Cheers,
Jeff
next prev parent reply other threads:[~2011-08-18 15:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1313063143-14473-1-git-send-email-lczerner@redhat.com>
2011-08-17 13:13 ` [PATCH] loop: add discard support for loop devices Lukas Czerner
2011-08-18 15:33 ` Jeff Moyer [this message]
2011-08-18 15:49 ` Lukas Czerner
2011-08-18 18:59 ` Milan Broz
2011-08-18 19:08 ` Lukas Czerner
2011-08-18 19:12 ` Jens Axboe
2011-08-18 19:20 ` Lukas Czerner
2011-08-18 19:24 ` Jens Axboe
2011-08-18 19:23 ` Jeff Moyer
2011-08-18 19:26 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=x497h6aspj1.fsf@segfault.boston.devel.redhat.com \
--to=jmoyer@redhat.com \
--cc=achender@linux.vnet.ibm.com \
--cc=jaxboe@fusionio.com \
--cc=lczerner@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).