Commit 2cd2ef6a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dave Chinner

xfs: rewrite the filestream allocator using the dentry cache

In Linux we will always be able to find a parent inode for file that are
undergoing I/O.  Use this to simply the file stream allocator by only
keeping track of parent inodes.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent f37211c3
This diff is collapsed.
...@@ -20,44 +20,17 @@ ...@@ -20,44 +20,17 @@
struct xfs_mount; struct xfs_mount;
struct xfs_inode; struct xfs_inode;
struct xfs_perag;
struct xfs_bmalloca; struct xfs_bmalloca;
#ifdef XFS_FILESTREAMS_TRACE
#define XFS_FSTRM_KTRACE_INFO 1
#define XFS_FSTRM_KTRACE_AGSCAN 2
#define XFS_FSTRM_KTRACE_AGPICK1 3
#define XFS_FSTRM_KTRACE_AGPICK2 4
#define XFS_FSTRM_KTRACE_UPDATE 5
#define XFS_FSTRM_KTRACE_FREE 6
#define XFS_FSTRM_KTRACE_ITEM_LOOKUP 7
#define XFS_FSTRM_KTRACE_ASSOCIATE 8
#define XFS_FSTRM_KTRACE_MOVEAG 9
#define XFS_FSTRM_KTRACE_ORPHAN 10
#define XFS_FSTRM_KTRACE_SIZE 16384
extern ktrace_t *xfs_filestreams_trace_buf;
#endif
/* allocation selection flags */
typedef enum xfs_fstrm_alloc {
XFS_PICK_USERDATA = 1,
XFS_PICK_LOWSPACE = 2,
} xfs_fstrm_alloc_t;
/* prototypes for filestream.c */
int xfs_filestream_init(void); int xfs_filestream_init(void);
void xfs_filestream_uninit(void); void xfs_filestream_uninit(void);
int xfs_filestream_mount(struct xfs_mount *mp); int xfs_filestream_mount(struct xfs_mount *mp);
void xfs_filestream_unmount(struct xfs_mount *mp); void xfs_filestream_unmount(struct xfs_mount *mp);
xfs_agnumber_t xfs_filestream_lookup_ag(struct xfs_inode *ip);
int xfs_filestream_associate(struct xfs_inode *dip, struct xfs_inode *ip);
void xfs_filestream_deassociate(struct xfs_inode *ip); void xfs_filestream_deassociate(struct xfs_inode *ip);
xfs_agnumber_t xfs_filestream_lookup_ag(struct xfs_inode *ip);
int xfs_filestream_associate(struct xfs_inode *dip);
int xfs_filestream_new_ag(struct xfs_bmalloca *ap, xfs_agnumber_t *agp); int xfs_filestream_new_ag(struct xfs_bmalloca *ap, xfs_agnumber_t *agp);
/* filestreams for the inode? */
static inline int static inline int
xfs_inode_is_filestream( xfs_inode_is_filestream(
struct xfs_inode *ip) struct xfs_inode *ip)
......
...@@ -846,9 +846,9 @@ xfs_ialloc( ...@@ -846,9 +846,9 @@ xfs_ialloc(
/* now we have set up the vfs inode we can associate the filestream */ /* now we have set up the vfs inode we can associate the filestream */
if (filestreams) { if (filestreams) {
error = xfs_filestream_associate(pip, ip); error = xfs_filestream_associate(pip);
if (error < 0) if (error)
return -error; return error;
} }
*ipp = ip; *ipp = ip;
...@@ -1695,16 +1695,6 @@ xfs_release( ...@@ -1695,16 +1695,6 @@ xfs_release(
if (!XFS_FORCED_SHUTDOWN(mp)) { if (!XFS_FORCED_SHUTDOWN(mp)) {
int truncated; int truncated;
/*
* If we are using filestreams, and we have an unlinked
* file that we are processing the last close on, then nothing
* will be able to reopen and write to this file. Purge this
* inode from the filestreams cache so that it doesn't delay
* teardown of the inode.
*/
if ((ip->i_d.di_nlink == 0) && xfs_inode_is_filestream(ip))
xfs_filestream_deassociate(ip);
/* /*
* If we previously truncated this file and removed old data * If we previously truncated this file and removed old data
* in the process, we want to initiate "early" writeout on * in the process, we want to initiate "early" writeout on
...@@ -2661,13 +2651,7 @@ xfs_remove( ...@@ -2661,13 +2651,7 @@ xfs_remove(
if (error) if (error)
goto std_return; goto std_return;
/* if (is_dir && xfs_inode_is_filestream(ip))
* If we are using filestreams, kill the stream association.
* If the file is still open it may get a new one but that
* will get killed on last close in xfs_close() so we don't
* have to worry about that.
*/
if (!is_dir && link_zero && xfs_inode_is_filestream(ip))
xfs_filestream_deassociate(ip); xfs_filestream_deassociate(ip);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment