mkfs: get size of device properly
PATCH 1/1 mkfs: get size of device properly
Ok, one more.
I've been having too many problems w/ xfstests today to have run the last patch through xfstests but should have at least run
032. :(
Anyway, last change wasn't valid to test the size of a device node; total brain fart. After this I'm testing the hell out of the next patch I send, I promise!
--------
Test device node size properly in check_overwrite, st_size is only valid for regular files.
---
mkfs/xfs_mkfs.c +8 -3
@@ -297,18 +297,23 @@ check_overwrite(const char *type;blkid_probe pr =NULL ;int ret; -struct stat statbuf; +int fd; +long long size; +int bsz;if (!device || !*device)return 0 ; ret =-1 ;/* will reset on success of all setup calls */ -if (stat (device, &statbuf) <0 ) + fd =open (device,O_RDONLY ); +if (fd <0 ) goto out; +platform_findsizes (device, fd, &size, &bsz); +close (fd);/* nothing to overwrite on a 0-length device */ -if (statbuf.st_size ==0 ) { +if (size ==0 ) { ret =0 ; goto out; }
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 6 lines · Eric Sandeen
Ok, one more.
I've been having too many problems w/ xfstests today to have run the last patch through xfstests but should have at least run
032. :(
Quoted 8 lines
Anyway, last change wasn't valid to test the size of a device node; total brain fart. After this I'm testing the hell out of the next patch I send, I promise!
--------
Test device node size properly in
check_overwrite,st_sizeis only valid for regular files.
The patch looks correct to me, but it also means we now open the device twice in check_overwrite. We might aswell use it just once and keep the fd for the blkid probe. Anyway, probably better to put this one in ASAP, so:
Any chance you could create a xfstests regression test for this?
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 4 lines · Christoph Hellwig
Reviewed-by: Christoph Hellwig <hch
Any chance you could create a xfstests regression test for this?
Sure - it sorta catches itby failing elsewhere, but not obviously....
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs