X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=BgyzJBELawK+Nj5jv1epvfw+qk+YouEEnGFgfOQJrkCJvvmpu8aC6 Y2fQi6bjMLAswVY7uVVtkRhesOzMifZB+EzJJsTDoVClUZKodL/8YQfRSvtsYhai Tp3odfM3dHLxQmEPe80PnOE0oNHBPksVP2Ida6iwsW6vFRcIQbwqyw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=6rkUvZYsPqhd0sZJIydujVnySzo=; b=qsRvl5slUedcuK8I6V3+YczP/7HQ sOGTIiMODIpTLjcCMrVoUmh6UZMjnTxnLVAz2hvY501Os4DkdoMK/W/gUQ9eRS7r Rbxb2k1rU7Z5eaaGymNd8ISjrRwBa/v/YK2zXYWeE4GDPMWWixkq5y/uQtsehCs6 4x1geqrUb2i7138= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-100.3 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_BRBL_LASTEXT,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: drew.franken.de Date: Tue, 19 Dec 2017 19:19:14 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Wrong file position after writing 65537 bytes to block device Message-ID: <20171219181914.GE19986@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20171218131035 DOT GB11285 AT calimero DOT vinschen DOT de> <5a385ced DOT 195b9d0a DOT d434 DOT 5400 AT mx DOT google DOT com> <20171219091431 DOT GF11285 AT calimero DOT vinschen DOT de> <9f29d418-10af-1dc7-2636-89cae1eb16f4 AT redhat DOT com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="k+w/mQv8wyuph6w0" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Dec 19 16:35, Ivan Kozik wrote: > On Tue, Dec 19, 2017 at 4:13 PM, Eric Blake wrote: > > Can block devices report an unaligned offset to lseek()? If not, then = when > > writing an unaligned value to a block device, don't we have to do a > > read-modify-write of the larger aligned cluster, and then put lseek() b= ack > > to the unaligned boundary, and have extra magic in ftell() to track tha= t we > > are at an unaligned position within the block device? But that sounds = like > > a lot of nasty overhead; and that it would be better to make sure that = block > > devices can report unaligned lseek() locations (caveat: I haven't tested > > what Linux does in that regards). >=20 > >From what I observe on Linux, it supports writing at any offset to the > block device because it does a read-modify-write behind the scenes, > with accompanying nasty overhead (e.g. writes going at 64MB/s instead > of an "expected" 180MB/s). That's what Cygwin was trying to emulate as well. Debugging pointed out that it only works for reading, not for writing, because the latter neglected to fix up buffer pointers. Those are used in lseek to report the Linux-like byte-exact file position. I pushed a patch and uploaded new developer snapshots to https://cygwin.com/snapshts/ Please give them a test. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --k+w/mQv8wyuph6w0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJaOVgiAAoJEPU2Bp2uRE+gml0P/j1A4BMhhOmjtwojgcyOZCix ro6cT00ogl1F44W8NFJd+TVY+GWqQ/wPaz73ILr4FYW10T2Nny1oW6Nbybfrr5Oy YdQdHeb9yJ1whYHaknsrFFZnrvQ+SlWkiZAg/uEg6ojfJRoYMwL/+4vmiN2y8ooS 3+lRpsXy8sqiGrYnmfPQvbqVHI8opFss6z4uidOiGJh7zVpHXUr8tK0Tuc4rFUYu 5I07AS8DDSWs85yV61a+bH+GnD96zKsy9tS4XgrKdWqDUkPuVHxSFHVfeXkW0/Mb 9TWXJ7a14Y19GpZYvMBN2ccRs/2aVZNZGUmpIc73Y7yryBTNmCbDFC3E5dPSIoyS Wy0VQrQX4GN515EFF/SZspXr2RWWmGAZBU07wHBqBCR7SI7Y7Af1kxDyAENLAddp AXKZfdtNx0DNMTSHbWaNicEDzxY/SalOh7qWpgn7bihL4YrByOxaQcdYTepW3miM NdTWFrplEXAgEHouImzH8y+gHW/MLWqucY6fui8MZcyrvMXPsvDq/SvAJ6+Elvt6 bZmZxHuzANpRjt+UQSK0/5PyTFNbqMIaol13WM3V+Q2fkfYWoy2kERE9I0xSGkFv cpXUEEiddljGU1D39a1UQOCsl4uIeTT952ibvz/R8PX/QAaUArY3JvcpDJK7igEY tgVxrAgHeiLwmu9kgZ+a =VxcU -----END PGP SIGNATURE----- --k+w/mQv8wyuph6w0--