[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH for-2.10 07/16] block/file-posix: G
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH for-2.10 07/16] block/file-posix: Generalize raw_regular_truncate |
Date: |
Thu, 23 Mar 2017 16:13:33 +0000 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
On Wed, Mar 22, 2017 at 05:53:00PM +0100, Max Reitz wrote:
> On 22.03.2017 17:44, Stefan Hajnoczi wrote:
> > On Mon, Mar 20, 2017 at 04:11:24PM +0100, Max Reitz wrote:
> >> On 20.03.2017 12:00, Stefan Hajnoczi wrote:
> >>> On Mon, Mar 13, 2017 at 10:40:36PM +0100, Max Reitz wrote:
> >>>> +static int raw_regular_truncate(int fd, BlockDriverState *bs, int64_t
> >>>> offset,
> >>>
> >>> The presence of both a file descriptor and a BlockDriverState (actually
> >>> it must be a BDRVRawState) arguments is unusual. It seems bs is needed
> >>> for bdrv_getlength().
> >>>
> >>> How about using fstat(fd, &st) and then dropping bs and create?
> >>
> >> Well, I could do that, but bdrv_getlength() is a bit simpler and I don't
> >> see much of an issue with specifying both an fd and a bs.
> >
> > Arguments that provide overlapping information make the function harder
> > to understand and use correctly (there are combinations of these
> > arguments that are invalid or don't make sense). Saving a few lines of
> > code in the function implementation is a poor trade-off IMO.
>
> My brain likes to agree but for some reason my heart really prefers
> block layer functions (where I know what can go wrong) over POSIX
> functions (where I always have the feeling of maybe not having though of
> everything).
>
> I guess I'll have to silence my heart for a bit, then.
In matters of the heart I cannot give advice on this mailing list,
sorry.
Stefan
signature.asc
Description: PGP signature
- Re: [Qemu-block] [Qemu-devel] [PATCH for-2.10 04/16] qemu-img: Expose PreallocMode for resizing, (continued)
- [Qemu-block] [PATCH for-2.10 05/16] block/file-posix: Small fixes in raw_create(), Max Reitz, 2017/03/13
- [Qemu-block] [PATCH for-2.10 06/16] block/file-posix: Extract raw_regular_truncate(), Max Reitz, 2017/03/13
- [Qemu-block] [PATCH for-2.10 07/16] block/file-posix: Generalize raw_regular_truncate, Max Reitz, 2017/03/13
- [Qemu-block] [PATCH for-2.10 08/16] block/file-posix: Preallocation for truncate, Max Reitz, 2017/03/13
- [Qemu-block] [PATCH for-2.10 09/16] block/qcow2: Generalize preallocate(), Max Reitz, 2017/03/13
- [Qemu-block] [PATCH for-2.10 10/16] block/qcow2: Lock s->lock in preallocate(), Max Reitz, 2017/03/13
- [Qemu-block] [PATCH for-2.10 11/16] block/qcow2: Metadata preallocation for truncate, Max Reitz, 2017/03/13
- [Qemu-block] [PATCH for-2.10 12/16] block/qcow2: Extract qcow2_calc_size_usage(), Max Reitz, 2017/03/13