Changeset View
Changeset View
Standalone View
Standalone View
sys/ufs/ffs/ffs_alloc.c
Show First 20 Lines • Show All 511 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
ffs_reallocblks(ap) | ffs_reallocblks(ap) | ||||
struct vop_reallocblks_args /* { | struct vop_reallocblks_args /* { | ||||
struct vnode *a_vp; | struct vnode *a_vp; | ||||
struct cluster_save *a_buflist; | struct cluster_save *a_buflist; | ||||
} */ *ap; | } */ *ap; | ||||
{ | { | ||||
struct ufsmount *ump; | struct ufsmount *ump; | ||||
int error; | |||||
/* | /* | ||||
* We used to skip reallocating the blocks of a file into a | * We used to skip reallocating the blocks of a file into a | ||||
* contiguous sequence if the underlying flash device requested | * contiguous sequence if the underlying flash device requested | ||||
* BIO_DELETE notifications, because devices that benefit from | * BIO_DELETE notifications, because devices that benefit from | ||||
* BIO_DELETE also benefit from not moving the data. However, | * BIO_DELETE also benefit from not moving the data. However, | ||||
* the destination for the data is usually moved before the data | * the destination for the data is usually moved before the data | ||||
* is written to the initially allocated location, so we rarely | * is written to the initially allocated location, so we rarely | ||||
Show All 13 Lines | ffs_reallocblks(ap) | ||||
/* | /* | ||||
* We can't wait in softdep prealloc as it may fsync and recurse | * We can't wait in softdep prealloc as it may fsync and recurse | ||||
* here. Instead we simply fail to reallocate blocks if this | * here. Instead we simply fail to reallocate blocks if this | ||||
* rare condition arises. | * rare condition arises. | ||||
*/ | */ | ||||
if (DOINGSUJ(ap->a_vp)) | if (DOINGSUJ(ap->a_vp)) | ||||
if (softdep_prealloc(ap->a_vp, MNT_NOWAIT) != 0) | if (softdep_prealloc(ap->a_vp, MNT_NOWAIT) != 0) | ||||
return (ENOSPC); | return (ENOSPC); | ||||
if (ump->um_fstype == UFS1) | vn_seqc_write_begin(ap->a_vp); | ||||
return (ffs_reallocblks_ufs1(ap)); | error = ump->um_fstype == UFS1 ? ffs_reallocblks_ufs1(ap) : | ||||
return (ffs_reallocblks_ufs2(ap)); | ffs_reallocblks_ufs2(ap); | ||||
vn_seqc_write_end(ap->a_vp); | |||||
return (error); | |||||
} | } | ||||
static int | static int | ||||
ffs_reallocblks_ufs1(ap) | ffs_reallocblks_ufs1(ap) | ||||
struct vop_reallocblks_args /* { | struct vop_reallocblks_args /* { | ||||
struct vnode *a_vp; | struct vnode *a_vp; | ||||
struct cluster_save *a_buflist; | struct cluster_save *a_buflist; | ||||
} */ *ap; | } */ *ap; | ||||
▲ Show 20 Lines • Show All 2,958 Lines • Show Last 20 Lines |