468
469void
470xfs_filestream_flush(
471 xfs_mount_t *mp)
472{
473 xfs_mru_cache_flush(mp->m_filestream);
474}
475
476
477
478
479
480xfs_agnumber_t
481xfs_filestream_lookup_ag(
482 xfs_inode_t *ip)
483{
484 xfs_mru_cache_t *cache;
485 fstrm_item_t *item;
486 xfs_agnumber_t ag;
487 int ref;
488
489 if (!(ip->i_d.di_mode & (S_IFREG | S_IFDIR))) {
490 ASSERT(0);
491 return NULLAGNUMBER;
492 }
493
494 cache = ip->i_mount->m_filestream;
495 item = xfs_mru_cache_lookup(cache, ip->i_ino);
496 if (!item) {
497 TRACE_LOOKUP(ip->i_mount, ip, NULL, NULLAGNUMBER, 0);
498 return NULLAGNUMBER;
499 }
500
501 ASSERT(ip == item->ip);
502 ag = item->ag;
503 ref = xfs_filestream_peek_ag(ip->i_mount, ag);
504 xfs_mru_cache_done(cache);
505
506 TRACE_LOOKUP(ip->i_mount, ip, item->pip, ag, ref);
507 return ag;
508}