aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2013-08-28 19:05:07 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-08-28 19:05:07 -0400
commitad4eec613536dc7e5ea0c6e59849e6edca634d8b (patch)
tree12481650ae957d60cebed50ee142c3cf159cad9a /include
parentbdfb6ff4a255dcebeb09a901250e13a97eff75af (diff)
ext4: allow specifying external journal by pathname mount option
It's always been a hassle that if an external journal's device number changes, the filesystem won't mount. And since boot-time enumeration can change, device number changes aren't unusual. The current mechanism to update the journal location is by passing in a mount option w/ a new devnum, but that's a hassle; it's a manual approach, fixing things after the fact. Adding a mount option, "-o journal_path=/dev/$DEVICE" would help, since then we can do i.e. # mount -o journal_path=/dev/disk/by-label/$JOURNAL_LABEL ... and it'll mount even if the devnum has changed, as shown here: # losetup /dev/loop0 journalfile # mke2fs -L mylabel-journal -O journal_dev /dev/loop0 # mkfs.ext4 -L mylabel -J device=/dev/loop0 /dev/sdb1 Change the journal device number: # losetup -d /dev/loop0 # losetup /dev/loop1 journalfile And today it will fail: # mount /dev/sdb1 /mnt/test mount: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so # dmesg | tail -n 1 [17343.240702] EXT4-fs (sdb1): error: couldn't read superblock of external journal But with this new mount option, we can specify the new path: # mount -o journal_path=/dev/loop1 /dev/sdb1 /mnt/test # (which does update the encoded device number, incidentally): # umount /dev/sdb1 # dumpe2fs -h /dev/sdb1 | grep "Journal device" dumpe2fs 1.41.12 (17-May-2010) Journal device: 0x0701 But best of all we can just always mount by journal-path, and it'll always work: # mount -o journal_path=/dev/disk/by-label/mylabel-journal /dev/sdb1 /mnt/test # So the journal_path option can be specified in fstab, and as long as the disk is available somewhere, and findable by label (or by UUID), we can mount. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
(sock), MECR_BSIO_SHIFT, MECR_BS_MASK) #define MECR_BSA_SET(mecr, sock, bs) \ MECR_SET((mecr), (sock), MECR_BSA_SHIFT, MECR_BS_MASK, (bs)) #define MECR_BSA_GET(mecr, sock) \ MECR_GET((mecr), (sock), MECR_BSA_SHIFT, MECR_BS_MASK) #define MECR_BSM_SET(mecr, sock, bs) \ MECR_SET((mecr), (sock), MECR_BSM_SHIFT, MECR_BS_MASK, (bs)) #define MECR_BSM_GET(mecr, sock) \ MECR_GET((mecr), (sock), MECR_BSM_SHIFT, MECR_BS_MASK) #define MECR_FAST_SET(mecr, sock, fast) \ MECR_SET((mecr), (sock), MECR_FAST_SHIFT, MECR_FAST_MODE_MASK, (fast)) #define MECR_FAST_GET(mecr, sock) \ MECR_GET((mecr), (sock), MECR_FAST_SHIFT, MECR_FAST_MODE_MASK) /* This function implements the BS value calculation for setting the MECR * using integer arithmetic: */ static inline unsigned int sa1100_pcmcia_mecr_bs(unsigned int pcmcia_cycle_ns, unsigned int cpu_clock_khz){ unsigned int t = ((pcmcia_cycle_ns * cpu_clock_khz) / 6) - 1000000; return (t / 1000000) + (((t % 1000000) == 0) ? 0 : 1); } /* This function returns the (approximate) command assertion period, in * nanoseconds, for a given CPU clock frequency and MECR BS value: */ static inline unsigned int sa1100_pcmcia_cmd_time(unsigned int cpu_clock_khz, unsigned int pcmcia_mecr_bs){ return (((10000000 * 2) / cpu_clock_khz) * (3 * (pcmcia_mecr_bs + 1))) / 10; } extern int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr); #endif /* !defined(_PCMCIA_SA1100_H) */