diff options
author | imp <imp@FreeBSD.org> | 2014-04-18 17:03:35 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2014-04-18 17:03:35 +0000 |
commit | dc1d630338e8d8a813fdacbb556799df5848769f (patch) | |
tree | 24e84b99523987d4a513aaac339ae3d299645197 /sys/fs/nandfs/nandfs_vfsops.c | |
parent | 60d8af5ab8dbbf78749c82867d7dff8923b733ed (diff) | |
download | FreeBSD-src-dc1d630338e8d8a813fdacbb556799df5848769f.zip FreeBSD-src-dc1d630338e8d8a813fdacbb556799df5848769f.tar.gz |
More properly account for free/reserved segments to avoid deadlock or
worse when filling up a device and then trying to erase files to make
space. Without enough space, you can't do that. Also, ensure that the
metadata writes don't generate ENOSPC. They will be retried later
since the buffers are still dirty...
Submitted by: mjg@
Diffstat (limited to 'sys/fs/nandfs/nandfs_vfsops.c')
-rw-r--r-- | sys/fs/nandfs/nandfs_vfsops.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/fs/nandfs/nandfs_vfsops.c b/sys/fs/nandfs/nandfs_vfsops.c index fd9b0c9..33b7564 100644 --- a/sys/fs/nandfs/nandfs_vfsops.c +++ b/sys/fs/nandfs/nandfs_vfsops.c @@ -718,15 +718,24 @@ nandfs_mount_base(struct nandfs_device *nandfsdev, struct mount *mp, nandfsdev->nd_ts.tv_sec = nandfsdev->nd_last_segsum.ss_create; nandfsdev->nd_last_cno = nandfsdev->nd_super.s_last_cno; nandfsdev->nd_fakevblk = 1; + /* + * FIXME: bogus calculation. Should use actual number of usable segments + * instead of total amount. + */ + nandfsdev->nd_segs_reserved = + nandfsdev->nd_fsdata.f_nsegments * + nandfsdev->nd_fsdata.f_r_segments_percentage / 100; nandfsdev->nd_last_ino = NANDFS_USER_INO; DPRINTF(VOLUMES, ("%s: last_pseg %#jx last_cno %#jx last_seq %#jx\n" - "fsdev: last_seg: seq %#jx num %#jx, next_seg_num %#jx\n", + "fsdev: last_seg: seq %#jx num %#jx, next_seg_num %#jx " + "segs_reserved %#jx\n", __func__, (uintmax_t)nandfsdev->nd_last_pseg, (uintmax_t)nandfsdev->nd_last_cno, (uintmax_t)nandfsdev->nd_seg_sequence, (uintmax_t)nandfsdev->nd_seg_sequence, (uintmax_t)nandfsdev->nd_seg_num, - (uintmax_t)nandfsdev->nd_next_seg_num)); + (uintmax_t)nandfsdev->nd_next_seg_num, + (uintmax_t)nandfsdev->nd_segs_reserved)); DPRINTF(VOLUMES, ("nandfs_mount: accepted super root\n")); |