Skip to contentSkip to conversation

delayed allocation blocks not flushed?

PATCH Bert De Jonghe 2 participants 2 messages May 27, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi,

On an otherwise idle system, create an ext4 filesystem on /dev/sdi, mount it and wait more than dirty_writeback_centisecs.

Then create a small file (echo something > file); wait (dirty_expire_centisecs x 2), expect delayed_allocation_blocks to fall to zero but it remains at 2 over here.

Create another small file (echo something_else > file2); again wait (dirty_expire_centisecs x 2); check delayed_allocation_blocks which is now at 4.

Wait a weekend more:

# date; cat /sys/fs/ext4/sdi/delayed_allocation_blocks Fri May 24 15:33:21 UTC 2013
4

# date; cat /sys/fs/ext4/sdi/delayed_allocation_blocks Mon May 27 07:14:30 UTC 2013
4

Doing a manual sync flushes out all blocks, also adding a sync after mounting solves the not flushing behaviour (possible patch attached).

Has anyone noticed this before and is this expected behaviour? It looks like these blocks are not flushed out to disk thus remain in memory and will be lost upon power failure?

Please Cc on reply as we're not on the list.

Many thanks & best regards,
Bert.

super.c renamed from super.c.org +1 -0
@@ -993,6 +993,7 @@
 		bdev->bd_super = s;
 	}
 
+	sync_filesystem(s); 
 	return dget(s->s_root);
 
 error_s:
#2 lore raw

Hello,

Quoted 2 lines · Bert De Jonghe

On an otherwise idle system, create an ext4 filesystem on /dev/sdi, mount it and wait more than dirty_writeback_centisecs.

What kernel version are you using?

Quoted 18 lines

Then create a small file (echo something > file); wait (dirty_expire_centisecs x 2), expect delayed_allocation_blocks to fall to zero but it remains at 2 over here.

Create another small file (echo something_else > file2); again wait (dirty_expire_centisecs x 2); check delayed_allocation_blocks which is now at 4.

Wait a weekend more:

   # date; cat /sys/fs/ext4/sdi/delayed_allocation_blocks
   Fri May 24 15:33:21 UTC 2013
   4

   # date; cat /sys/fs/ext4/sdi/delayed_allocation_blocks
   Mon May 27 07:14:30 UTC 2013
   4
Quoted 7 lines

Doing a manual sync flushes out all blocks, also adding a sync after mounting solves the not flushing behaviour (possible patch attached).

Has anyone noticed this before and is this expected behaviour? It looks like these blocks are not flushed out to disk thus remain in memory and will be lost upon power failure?

This would be a bug. I have tried to recreate this with my 3.7.10 kernel
but I failed. File gets flushed to disk after 30s or so. What kernel version are you using?

Also I don't see why syncing after mount would help to resolve the problem that files are not flushed to disk in a timely manner...

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR