Hi folks,

I’m having a doubt in the mounting of floppy in my application.

mount(“/dev/sdc”(source dir), ”/fdHD/0/”(Our dest dir) "vfat", l_uReadWrite | MS_SYNCHRONOUS, NULL);

This is the system call which we are using to mount to mount he floppy to our desired folder. When I use this system call it is taking much time in linux 2.6. But we are using the same code in Linux 2.4, at that time the mount operation is happening very fast.

So what I did I replaced the mount system call by system(“mount –t vfat /dev/sdc /fdHD/0/”) . Now when we transfer, the operation is happening very fast. So what is did I removed the MS_SYNCHRONOUS flag from the mount system call. So now it is working fine in 2.6 kernel.

Now my doubt is what the use of MS_SYNCHRONOUS flag is? Why removing the flag making the transfer operation very fast? whatis the effect of this flag in mounting?

What might be the reason for this? Please help me friends?

Dani AI

Generated

Short answer for : the MS_SYNCHRONOUS mount flag requests that the filesystem perform writes synchronously (i.e., as if O_SYNC were used for file opens). On very slow, mechanical media (floppy) every metadata/data write will block until the device acknowledges it, so operations that were fast with asynchronous buffering become slow when MS_SYNCHRONOUS is set. See the mount(2) manual for the flag description. (man7.org)

What you observed with system("mount -t vfat ...") matches that: the mount utility does not pass "sync" by default, so the vfat filesystem runs with normal buffered (async) I/O unless you explicitly request -o sync. The generic sync/async mount options and which filesystems honor them (vfat does) are documented by mount(8). Removing MS_SYNCHRONOUS therefore lets the kernel buffer writes and makes transfers much faster. (linuxman7.org)

Kernel internals: MS_SYNCHRONOUS is a mount flag that the VFS/filesystem code checks (superblock/inode sync flags — IS_SYNC/SB_SYNCHRONOUS) so the actual behavior depends on the filesystem driver and kernel code path in your kernel build. Different kernel versions or driver changes can alter how strictly that flag is enforced, which explains why behavior could differ between 2.4 and 2.6. The relevant VFS/superblock macros are in the kernel headers. (linux.googlesource.com)

Practical guidance: don’t set MS_SYNCHRONOUS for a floppy unless you need every write to be durable immediately — instead mount normally and explicitly flush only what you must (use fsync() on important files or sync/umount before removing media). To diagnose where the delay occurs, run the mounter under strace and look for blocking syscalls (example below). Also compare /proc/mounts or findmnt to see the actual mount options in effect. (man7.org)

strace -f -tt -T -o /tmp/strace.mount mount -t vfat /dev/sdc /fdHD/0

(Other posts in this thread about downloading kernel 2.6.38.1 are unrelated to the MS_SYNCHRONOUS question.)

i have extracted file kernel in linux but i am unable to install it on my system

hi,

hi,
how i can download kernel rpm

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.