]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: record disk LBA size
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 17 Oct 2019 02:35:26 +0000 (22:35 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 17 Oct 2019 02:35:26 +0000 (22:35 -0400)
Remember the size (in bytes) of a logical block on the disk.  We'll use
this in subsequent patches to improve the ability of media scans to
report on which files are corrupt.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/disk.c
scrub/disk.h

index dcdd5ba83ed87836fb83e428fbf34333eaebec34..d2101cc6ac05e22c5bb610efca48c68b76745f45 100644 (file)
@@ -193,7 +193,6 @@ disk_open(
 #endif
        struct disk             *disk;
        bool                    suspicious_disk = false;
-       int                     lba_sz;
        int                     error;
 
        disk = calloc(1, sizeof(struct disk));
@@ -205,10 +204,10 @@ disk_open(
                goto out_free;
 
        /* Try to get LBA size. */
-       error = ioctl(disk->d_fd, BLKSSZGET, &lba_sz);
+       error = ioctl(disk->d_fd, BLKSSZGET, &disk->d_lbasize);
        if (error)
-               lba_sz = 512;
-       disk->d_lbalog = log2_roundup(lba_sz);
+               disk->d_lbasize = 512;
+       disk->d_lbalog = log2_roundup(disk->d_lbasize);
 
        /* Obtain disk's stat info. */
        error = fstat(disk->d_fd, &disk->d_sb);
index 74a26d9801c48a0e031bcf29d6126280f450a281..36bfb8263d1015bd66a95ae88e518fb4f07d2951 100644 (file)
@@ -10,7 +10,8 @@
 struct disk {
        struct stat     d_sb;
        int             d_fd;
-       int             d_lbalog;
+       unsigned int    d_lbalog;
+       unsigned int    d_lbasize;      /* bytes */
        unsigned int    d_flags;
        unsigned int    d_blksize;      /* bytes */
        uint64_t        d_size;         /* bytes */