Skip to contentSkip to conversation

mkfs: fix mkfs when blkid fails

PATCH In review Eric Sandeen 2 participants 2 messages Jan 14, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkfs: fix mkfs when blkid fails

When trying to mkfs something that blkid doesn't grok:

# mkfs.xfs fsfile 
warning: unable to probe device toplology for device fsfile
illegal sector size 0
Usage: mkfs.xfs
...

mkfs fails. :(

Brown-paper-bag: Eric Sandeen <[email protected]>

---

mkfs/xfs_mkfs.c +1 -1
index 9a8eff3..faaafed 100644
@@ -1574,7 +1574,7 @@ main(
 		 * Unless specified manually on the command line use the
 		 * advertised sector size of the device.
 		 */
-		sectorsize = ft.sectorsize;
+		sectorsize = ft.sectorsize ? ft.sectorsize : XFS_MIN_SECTORSIZE;
 	}
 
 	if (ft.sectoralign || !ssflag) {

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eric Sandeen

When trying to mkfs something that blkid doesn't grok:

# mkfs.xfs fsfile
warning: unable to probe device toplology for device fsfile
illegal sector size 0
Usage: mkfs.xfs
...

mkfs fails. :(

The fix looks good.

Quoted 3 lines

Brown-paper-bag: Eric Sandeen <[email protected]>

---

Quoted 14 lines
mkfs/xfs_mkfs.c +1 -1
index 9a8eff3..faaafed 100644
@@ -1574,7 +1574,7 @@ main(
 		 * Unless specified manually on the command line use the
 		 * advertised sector size of the device.
 		 */
-		sectorsize = ft.sectorsize;
+		sectorsize = ft.sectorsize ? ft.sectorsize : XFS_MIN_SECTORSIZE;
 	}
 
 	if (ft.sectoralign || !ssflag) {
Quoted 4 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs