search for: blksszget

Displaying 20 results from an estimated 25 matches for "blksszget".

2018 Aug 02
2
Re: [PATCH 3/3] file: Zero for block devices on old kernels
...> +static bool > +is_aligned(struct handle *h, uint64_t n) > +{ > + return n % h->sector_size == 0; Since we know (but the compiler doesn't) that sector_size is a power of 2, it is slightly faster to use bitwise math: return !(n & (h->sector_size - 1)) > +#ifdef BLKSSZGET > + if (h->is_block_device) { > + if (ioctl (h->fd, BLKSSZGET, &h->sector_size)) { > + nbdkit_error ("ioctl(BLKSSZGET): %s: %m", filename); > + free (h); > + return NULL; If the ioctl() fails, would it be better to just fall back... > +...
2018 Aug 02
0
Re: [PATCH 3/3] file: Zero for block devices on old kernels
...*h, uint64_t n) > > +{ > > + return n % h->sector_size == 0; > > Since we know (but the compiler doesn't) that sector_size is a power of > 2, it is slightly faster to use bitwise math: > return !(n & (h->sector_size - 1)) > Right > > > +#ifdef BLKSSZGET > > + if (h->is_block_device) { > > + if (ioctl (h->fd, BLKSSZGET, &h->sector_size)) { > > + nbdkit_error ("ioctl(BLKSSZGET): %s: %m", filename); > > + free (h); > > + return NULL; > > If the ioctl() fails, would it be be...
2020 Feb 10
2
Re: [RFC] lib: allow to specify physical/logical block size for disks
...the BLKPBSZGET ioctl and describes the disk's hardware sector size which can be relevant for the alignment of disk data. We don't have an API to get this one. logical_block_size: The logical block size the disk will report to the guest OS. For Linux this would be the value returned by the BLKSSZGET ioctl and describes the smallest units for disk I/O. We have blockdev-getsz API to get this value. How do they use. If your HDD has physical block size = 4096 you might want make I/O request equals to (or multiple) this value. Otherwise you might hit performance penalty. I think, the same is valid...
2018 Aug 02
0
[PATCH 3/3] file: Zero for block devices on old kernels
...= malloc (sizeof *h); @@ -150,6 +160,26 @@ file_open (int readonly) return NULL; } + if (fstat (h->fd, &statbuf) == -1) { + nbdkit_error ("fstat: %s: %m", filename); + free (h); + return NULL; + } + + h->is_block_device = S_ISBLK(statbuf.st_mode); + +#ifdef BLKSSZGET + if (h->is_block_device) { + if (ioctl (h->fd, BLKSSZGET, &h->sector_size)) { + nbdkit_error ("ioctl(BLKSSZGET): %s: %m", filename); + free (h); + return NULL; + } + } +#else + h->sector_size = 4096; /* Safe guess */ +#endif + #ifdef FALLOC_FL_PU...
2020 Feb 10
0
Re: [RFC] lib: allow to specify physical/logical block size for disks
...describes the disk's hardware sector size which > can be relevant for the alignment of disk data. We don't have an API > to get this one. > > logical_block_size: The logical block size the disk will report to the > guest OS. For Linux this would be the value returned by the BLKSSZGET > ioctl and describes the smallest units for disk I/O. We have > blockdev-getsz API to get this value. Interestingly parted uses BLKSSZGET (logical_block_size), but does not use BLKPBSZGET (physical_block_size), so I guess that fits with my observations. > How do they use. If your HDD ha...
2018 Aug 19
0
[PATCH v4 4/4] file: Zero for block devices on old kernels
...readonly) return NULL; } + if (fstat (h->fd, &statbuf) == -1) { + nbdkit_error ("fstat: %s: %m", filename); + free (h); + return NULL; + } + + h->is_block_device = S_ISBLK(statbuf.st_mode); + h->sector_size = 4096; /* Start with safe guess */ + +#ifdef BLKSSZGET + if (h->is_block_device) { + if (ioctl (h->fd, BLKSSZGET, &h->sector_size)) + nbdkit_debug ("cannot get sector size: %s: %m", filename); + } +#endif + #ifdef FALLOC_FL_PUNCH_HOLE h->can_punch_hole = true; #else @@ -163,6 +190,7 @@ file_open (int readonly)...
2018 Aug 03
0
[PATCH v2 4/4] file: Zero for block devices on old kernels
...readonly) return NULL; } + if (fstat (h->fd, &statbuf) == -1) { + nbdkit_error ("fstat: %s: %m", filename); + free (h); + return NULL; + } + + h->is_block_device = S_ISBLK(statbuf.st_mode); + h->sector_size = 4096; /* Start with safe guess */ + +#ifdef BLKSSZGET + if (h->is_block_device) { + if (ioctl (h->fd, BLKSSZGET, &h->sector_size)) + nbdkit_debug ("cannot get sector size: %s: %m", filename); + } +#endif + #ifdef FALLOC_FL_PUNCH_HOLE h->can_punch_hole = true; #else @@ -163,6 +190,7 @@ file_open (int readonly)...
2020 Apr 09
0
[PATCH nbdkit v2 1/3] file: Move file operators to a new common/fileops mini-library.
...s refactoring commit creates a new mini-library called fileops, and uses it to implement the file plugin. Note that the name or prefix "file" leaks into fileops in a few places: the debug option is still called ‘-D file.zero=1’ and the nbdkit --dump-plugin output will still contain ‘file_blksszget’ etc. However I think that is fine as it should make usage more consistent across future file-like plugins. --- configure.ac | 1 + Makefile.am | 1 + common/fileops/Makefile.am | 45 +++ plugins/file/Makefile.am | 2 + common/fileops/fileops.h | 158 +++++++...
2020 Apr 09
1
[PATCH nbdkit PRELIMINARY] file: Move file operators to a new fileops mini-library
There's a lot of code in nbdkit-file-plugin which it would be nice to reuse elsewhere. One possible approach (as outlined here) is simply to move the file callbacks (like file.pread, file.pwrite, file.zero etc) to a new mini-library. They can then be consumed by other plugins fairly easily by doing: static void * foo_open (int readonly) { struct fileops *fops; int fd, flags; /*
2018 Aug 02
10
[PATCH 0/3] file: Zero for block devices and older file systems
This is the second version to support efficient zero for block devices on older kernels (e.g. RHEL 7.5), and file systems that do not support yet FALLOC_FS_ZERO_RANGE (e.g. NFS 4.2). Changes since v1: - Split to smaller patches - Skip linux only includes on other systems - Skip code using BLKZEROOUT if the macro is not defined - Try BLKZEROOUT only if the offset and count are aligned to device
2005 Jul 12
1
problem mounting ocfs2: heartbeat
When attempting to mount the OCFS2 file system I'm getting the following error message: ocfs2_hb_ctl: Internal logic failure while starting heartbeat mount.ocfs2: Error when attempting to run /sbin/ocfs2_hb_ctl: "Operation not permitted" I followed the steps given in the users_guide: modprobe ocfs2_dlmfs mount -t configfs none /config mount -t ocfs2_dlmfs none /dlm o2cb_ctl
2020 Aug 07
0
[nbdkit PATCH 1/4] file: Forbid non-regular, non-block file names
...ue; + else if (S_ISREG (statbuf.st_mode)) + h->is_block_device = false; + else { + nbdkit_error ("file is not regular or block device: %s", filename); + close (h->fd); + free (h); + return NULL; + } h->sector_size = 4096; /* Start with safe guess */ #ifdef BLKSSZGET -- 2.28.0
2020 Aug 07
0
[nbdkit PATCH 2/4] file: Add .list_exports support
...nbdkit_error ("file is not regular or block device: %s", filename); + nbdkit_error ("file is not regular or block device: %s", h->file); + free (h->file); close (h->fd); free (h); return NULL; @@ -204,7 +287,7 @@ file_open (int readonly) #ifdef BLKSSZGET if (h->is_block_device) { if (ioctl (h->fd, BLKSSZGET, &h->sector_size)) - nbdkit_debug ("cannot get sector size: %s: %m", filename); + nbdkit_debug ("cannot get sector size: %s: %m", h->file); } #endif @@ -232,6 +315,7 @@ file_close (void...
2020 Apr 09
6
[PATCH nbdkit v2 0/3] Implement fileops.
Needs some work still, see in particular the commit message for patch 3. Rich.
2018 Aug 18
7
[PATCH v3 0/4] file: Zero for block devices and older file systems
This version addresses some of the comments on v2. Changes since v2: - file_zero: Add missing space in function call - is_aligned: Assert that align is indeed a power of 2 - Spelling in commit message Not changed: - Eric commented that spacing was off: https://www.redhat.com/archives/libguestfs/2018-August/msg00113.html but I could not find anything wrong. - Eric asked if ioctl.h will cause
2018 Aug 19
9
[PATCH v3 0/4] file: Zero for block devices and older file systems
This version addresses comments on v3. Changes since v3: - Finally got spacing right (Eric) - Reorder includes (Richard) - Return 0 or -1 instead of r (Richard) - Add common/include/isaligned.h to Makefile.am (Richard) v3 was here: https://www.redhat.com/archives/libguestfs/2018-August/msg00177.html Nir Soffer (4): file: Avoid unsupported fallocate() calls file: Support zero without
2020 Aug 07
8
[nbdkit PATCH 0/4] More .list_exports uses
Here's changes to the file plugin (which I'm happy with) and a new exportname filter (which is still at RFC stage; I need to finish implementing strict mode in .open, and add tests). I also discovered that we really want .list_exports and .open to know when they are used on plaintext vs. tls clients for --tls=on, and we may want to split out a new .default_export callback rather than
2020 Feb 10
1
[PATCH] lib: allow to specify physical/logical block size for disks
...e disk will report to the libguestfs appliance. + +Physical block size would be the value returned by the C<BLKPBSZGET> ioctl and +describes the disk's hardware sector size which can be relevant for the +alignment of disk data. + +Logical block size would be the value returned by the C<BLKSSZGET> ioctl and +describes the smallest units for disk I/O. (C<guestfs_blockdev_getss> API call +will return this value). + +Possible values for C<blocksize> parameter are 0, 512 and 4096. F<0> is a +special value which instructs libguestfs to do nothing special and it is up to +t...
2018 Aug 03
10
[PATCH v2 0/4] file: Zero for block devices and older file systems
This is the third version to support efficient zero for block devices on older kernels (e.g. RHEL 7.5), and file systems that do not support yet FALLOC_FS_ZERO_RANGE (e.g. NFS 4.2). Changes since v2: - Revert file_can_trim change, since it is too late to change the value after negotiation. Changing the capability dinamically may be useful internally, but it should be done via other means. -
2012 Aug 02
0
[PATCH 1/3] ALPHA: make sector size dynamic in extlinux
.../* diff --git a/extlinux/main.c b/extlinux/main.c index f0d8e11..e40b4d7 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -95,6 +95,18 @@ static uint64_t get_size(int devfd) } /* + * Get sector size + */ +static unsigned get_sector_size(int devfd) +{ + int size; + + if (!ioctl(devfd, BLKSSZGET, &size)) + return size; + return SECTOR_SIZE; +} + +/* * Get device geometry and partition offset */ struct geometry_table { @@ -145,7 +157,7 @@ static const struct geometry_table standard_geometries[] = { {0, {0, 0, 0, 0}} }; -int get_geometry(int devfd, uint64_t totalbytes, st...