X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=fs%2Fntfs%2Flcnalloc.h;h=4cac1c024af60809142a43b6431f380aff3d05ee;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=f9292e882adc5097951a364c58749bed1cab423b;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/fs/ntfs/lcnalloc.h b/fs/ntfs/lcnalloc.h index f9292e882..4cac1c024 100644 --- a/fs/ntfs/lcnalloc.h +++ b/fs/ntfs/lcnalloc.h @@ -28,6 +28,7 @@ #include #include "types.h" +#include "runlist.h" #include "volume.h" typedef enum { @@ -78,6 +79,34 @@ static inline s64 ntfs_cluster_free(struct inode *vi, const VCN start_vcn, return __ntfs_cluster_free(vi, start_vcn, count, FALSE); } +extern int ntfs_cluster_free_from_rl_nolock(ntfs_volume *vol, + const runlist_element *rl); + +/** + * ntfs_cluster_free_from_rl - free clusters from runlist + * @vol: mounted ntfs volume on which to free the clusters + * @rl: runlist describing the clusters to free + * + * Free all the clusters described by the runlist @rl on the volume @vol. In + * the case of an error being returned, at least some of the clusters were not + * freed. + * + * Return 0 on success and -errno on error. + * + * Locking: This function takes the volume lcn bitmap lock for writing and + * modifies the bitmap contents. + */ +static inline int ntfs_cluster_free_from_rl(ntfs_volume *vol, + const runlist_element *rl) +{ + int ret; + + down_write(&vol->lcnbmp_lock); + ret = ntfs_cluster_free_from_rl_nolock(vol, rl); + up_write(&vol->lcnbmp_lock); + return ret; +} + #endif /* NTFS_RW */ #endif /* defined _LINUX_NTFS_LCNALLOC_H */