api.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. /*
  2. * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /************************************************************************/
  18. /* */
  19. /* PROJECT : exFAT & FAT12/16/32 File System */
  20. /* FILE : sdfat_api.c */
  21. /* PURPOSE : sdFAT volume lock layer */
  22. /* */
  23. /************************************************************************/
  24. #include <linux/version.h>
  25. #include <linux/module.h>
  26. #include <linux/init.h>
  27. #include <linux/mutex.h>
  28. #include "version.h"
  29. #include "config.h"
  30. #include "sdfat.h"
  31. #include "core.h"
  32. /*----------------------------------------------------------------------*/
  33. /* Internal structures */
  34. /*----------------------------------------------------------------------*/
  35. /*----------------------------------------------------------------------*/
  36. /* Constant & Macro Definitions */
  37. /*----------------------------------------------------------------------*/
  38. static DEFINE_MUTEX(_lock_core);
  39. /*----------------------------------------------------------------------*/
  40. /* Global Variable Definitions */
  41. /*----------------------------------------------------------------------*/
  42. /*----------------------------------------------------------------------*/
  43. /* Local Variable Definitions */
  44. /*----------------------------------------------------------------------*/
  45. /*----------------------------------------------------------------------*/
  46. /* Local Function Declarations */
  47. /*----------------------------------------------------------------------*/
  48. /*======================================================================*/
  49. /* Global Function Definitions */
  50. /* - All functions for global use have same return value format, */
  51. /* that is, 0 on success and minus error number on */
  52. /* various error condition. */
  53. /*======================================================================*/
  54. /*----------------------------------------------------------------------*/
  55. /* sdFAT Filesystem Init & Exit Functions */
  56. /*----------------------------------------------------------------------*/
  57. s32 fsapi_init(void)
  58. {
  59. return fscore_init();
  60. }
  61. s32 fsapi_shutdown(void)
  62. {
  63. return fscore_shutdown();
  64. }
  65. /*----------------------------------------------------------------------*/
  66. /* Volume Management Functions */
  67. /*----------------------------------------------------------------------*/
  68. /* mount the file system volume */
  69. s32 fsapi_mount(struct super_block *sb)
  70. {
  71. s32 err;
  72. /* acquire the core lock for file system ccritical section */
  73. mutex_lock(&_lock_core);
  74. err = meta_cache_init(sb);
  75. if (err)
  76. goto out;
  77. err = fscore_mount(sb);
  78. out:
  79. if (err)
  80. meta_cache_shutdown(sb);
  81. /* release the core lock for file system critical section */
  82. mutex_unlock(&_lock_core);
  83. return err;
  84. }
  85. EXPORT_SYMBOL(fsapi_mount);
  86. /* unmount the file system volume */
  87. s32 fsapi_umount(struct super_block *sb)
  88. {
  89. s32 err;
  90. /* acquire the core lock for file system ccritical section */
  91. mutex_lock(&_lock_core);
  92. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  93. err = fscore_umount(sb);
  94. meta_cache_shutdown(sb);
  95. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  96. /* release the core lock for file system critical section */
  97. mutex_unlock(&_lock_core);
  98. return err;
  99. }
  100. EXPORT_SYMBOL(fsapi_umount);
  101. /* get the information of a file system volume */
  102. s32 fsapi_statfs(struct super_block *sb, VOL_INFO_T *info)
  103. {
  104. FS_INFO_T *fsi = &(SDFAT_SB(sb)->fsi);
  105. /* check the validity of pointer parameters */
  106. ASSERT(info);
  107. if (fsi->used_clusters == (u32) ~0) {
  108. s32 err;
  109. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  110. err = fscore_statfs(sb, info);
  111. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  112. return err;
  113. }
  114. info->FatType = fsi->vol_type;
  115. info->ClusterSize = fsi->cluster_size;
  116. info->NumClusters = fsi->num_clusters - 2; /* clu 0 & 1 */
  117. info->UsedClusters = fsi->used_clusters + fsi->reserved_clusters;
  118. info->FreeClusters = info->NumClusters - info->UsedClusters;
  119. return 0;
  120. }
  121. EXPORT_SYMBOL(fsapi_statfs);
  122. /* synchronize a file system volume */
  123. s32 fsapi_sync_fs(struct super_block *sb, s32 do_sync)
  124. {
  125. s32 err;
  126. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  127. err = fscore_sync_fs(sb, do_sync);
  128. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  129. return err;
  130. }
  131. EXPORT_SYMBOL(fsapi_sync_fs);
  132. s32 fsapi_set_vol_flags(struct super_block *sb, u16 new_flag, s32 always_sync)
  133. {
  134. s32 err;
  135. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  136. err = fscore_set_vol_flags(sb, new_flag, always_sync);
  137. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  138. return err;
  139. }
  140. EXPORT_SYMBOL(fsapi_set_vol_flags);
  141. /*----------------------------------------------------------------------*/
  142. /* File Operation Functions */
  143. /*----------------------------------------------------------------------*/
  144. /* lookup */
  145. s32 fsapi_lookup(struct inode *inode, u8 *path, FILE_ID_T *fid)
  146. {
  147. s32 err;
  148. struct super_block *sb = inode->i_sb;
  149. /* check the validity of pointer parameters */
  150. ASSERT(fid && path);
  151. if (unlikely(!strlen(path)))
  152. return -EINVAL;
  153. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  154. err = fscore_lookup(inode, path, fid);
  155. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  156. return err;
  157. }
  158. EXPORT_SYMBOL(fsapi_lookup);
  159. /* create a file */
  160. s32 fsapi_create(struct inode *inode, u8 *path, u8 mode, FILE_ID_T *fid)
  161. {
  162. s32 err;
  163. struct super_block *sb = inode->i_sb;
  164. /* check the validity of pointer parameters */
  165. ASSERT(fid && path);
  166. if (unlikely(!strlen(path)))
  167. return -EINVAL;
  168. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  169. err = fscore_create(inode, path, mode, fid);
  170. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  171. return err;
  172. }
  173. EXPORT_SYMBOL(fsapi_create);
  174. /* read the target string of symlink */
  175. s32 fsapi_read_link(struct inode *inode, FILE_ID_T *fid, void *buffer, u64 count, u64 *rcount)
  176. {
  177. s32 err;
  178. struct super_block *sb = inode->i_sb;
  179. /* check the validity of pointer parameters */
  180. ASSERT(fid && buffer);
  181. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  182. err = fscore_read_link(inode, fid, buffer, count, rcount);
  183. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  184. return err;
  185. }
  186. EXPORT_SYMBOL(fsapi_read_link);
  187. /* write the target string of symlink */
  188. s32 fsapi_write_link(struct inode *inode, FILE_ID_T *fid, void *buffer, u64 count, u64 *wcount)
  189. {
  190. s32 err;
  191. struct super_block *sb = inode->i_sb;
  192. /* check the validity of pointer parameters */
  193. ASSERT(fid && buffer);
  194. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  195. err = fscore_write_link(inode, fid, buffer, count, wcount);
  196. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  197. return err;
  198. }
  199. EXPORT_SYMBOL(fsapi_write_link);
  200. /* resize the file length */
  201. s32 fsapi_truncate(struct inode *inode, u64 old_size, u64 new_size)
  202. {
  203. s32 err;
  204. struct super_block *sb = inode->i_sb;
  205. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  206. TMSG("%s entered (inode %p size %llu)\n", __func__, inode, new_size);
  207. err = fscore_truncate(inode, old_size, new_size);
  208. TMSG("%s exitted (%d)\n", __func__, err);
  209. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  210. return err;
  211. }
  212. EXPORT_SYMBOL(fsapi_truncate);
  213. /* rename or move a old file into a new file */
  214. s32 fsapi_rename(struct inode *old_parent_inode, FILE_ID_T *fid,
  215. struct inode *new_parent_inode, struct dentry *new_dentry)
  216. {
  217. s32 err;
  218. struct super_block *sb = old_parent_inode->i_sb;
  219. /* check the validity of pointer parameters */
  220. ASSERT(fid);
  221. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  222. err = fscore_rename(old_parent_inode, fid, new_parent_inode, new_dentry);
  223. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  224. return err;
  225. }
  226. EXPORT_SYMBOL(fsapi_rename);
  227. /* remove a file */
  228. s32 fsapi_remove(struct inode *inode, FILE_ID_T *fid)
  229. {
  230. s32 err;
  231. struct super_block *sb = inode->i_sb;
  232. /* check the validity of pointer parameters */
  233. ASSERT(fid);
  234. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  235. err = fscore_remove(inode, fid);
  236. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  237. return err;
  238. }
  239. EXPORT_SYMBOL(fsapi_remove);
  240. /* get the information of a given file */
  241. s32 fsapi_read_inode(struct inode *inode, DIR_ENTRY_T *info)
  242. {
  243. s32 err;
  244. struct super_block *sb = inode->i_sb;
  245. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  246. TMSG("%s entered (inode %p info %p\n", __func__, inode, info);
  247. err = fscore_read_inode(inode, info);
  248. TMSG("%s exited (err:%d)\n", __func__, err);
  249. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  250. return err;
  251. }
  252. EXPORT_SYMBOL(fsapi_read_inode);
  253. /* set the information of a given file */
  254. s32 fsapi_write_inode(struct inode *inode, DIR_ENTRY_T *info, int sync)
  255. {
  256. s32 err;
  257. struct super_block *sb = inode->i_sb;
  258. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  259. TMSG("%s entered (inode %p info %p sync:%d\n",
  260. __func__, inode, info, sync);
  261. err = fscore_write_inode(inode, info, sync);
  262. TMSG("%s exited (err:%d)\n", __func__, err);
  263. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  264. return err;
  265. }
  266. EXPORT_SYMBOL(fsapi_write_inode);
  267. /* return the cluster number in the given cluster offset */
  268. s32 fsapi_map_clus(struct inode *inode, u32 clu_offset, u32 *clu, int dest)
  269. {
  270. s32 err;
  271. struct super_block *sb = inode->i_sb;
  272. /* check the validity of pointer parameters */
  273. ASSERT(clu);
  274. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  275. TMSG("%s entered (inode:%p clus:%08x dest:%d\n",
  276. __func__, inode, *clu, dest);
  277. err = fscore_map_clus(inode, clu_offset, clu, dest);
  278. TMSG("%s exited (clu:%08x err:%d)\n", __func__, *clu, err);
  279. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  280. return err;
  281. }
  282. EXPORT_SYMBOL(fsapi_map_clus);
  283. /* reserve a cluster */
  284. s32 fsapi_reserve_clus(struct inode *inode)
  285. {
  286. s32 err;
  287. struct super_block *sb = inode->i_sb;
  288. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  289. TMSG("%s entered (inode:%p)\n", __func__, inode);
  290. err = fscore_reserve_clus(inode);
  291. TMSG("%s exited (err:%d)\n", __func__, err);
  292. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  293. return err;
  294. }
  295. EXPORT_SYMBOL(fsapi_reserve_clus);
  296. /*----------------------------------------------------------------------*/
  297. /* Directory Operation Functions */
  298. /*----------------------------------------------------------------------*/
  299. /* create(make) a directory */
  300. s32 fsapi_mkdir(struct inode *inode, u8 *path, FILE_ID_T *fid)
  301. {
  302. s32 err;
  303. struct super_block *sb = inode->i_sb;
  304. /* check the validity of pointer parameters */
  305. ASSERT(fid && path);
  306. if (unlikely(!strlen(path)))
  307. return -EINVAL;
  308. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  309. err = fscore_mkdir(inode, path, fid);
  310. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  311. return err;
  312. }
  313. EXPORT_SYMBOL(fsapi_mkdir);
  314. /* read a directory entry from the opened directory */
  315. s32 fsapi_readdir(struct inode *inode, DIR_ENTRY_T *dir_entry)
  316. {
  317. s32 err;
  318. struct super_block *sb = inode->i_sb;
  319. /* check the validity of pointer parameters */
  320. ASSERT(dir_entry);
  321. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  322. err = fscore_readdir(inode, dir_entry);
  323. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  324. return err;
  325. }
  326. EXPORT_SYMBOL(fsapi_readdir);
  327. /* remove a directory */
  328. s32 fsapi_rmdir(struct inode *inode, FILE_ID_T *fid)
  329. {
  330. s32 err;
  331. struct super_block *sb = inode->i_sb;
  332. /* check the validity of pointer parameters */
  333. ASSERT(fid);
  334. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  335. err = fscore_rmdir(inode, fid);
  336. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  337. return err;
  338. }
  339. EXPORT_SYMBOL(fsapi_rmdir);
  340. /* unlink a file.
  341. * that is, remove an entry from a directory. BUT don't truncate
  342. */
  343. s32 fsapi_unlink(struct inode *inode, FILE_ID_T *fid)
  344. {
  345. s32 err;
  346. struct super_block *sb = inode->i_sb;
  347. /* check the validity of pointer parameters */
  348. ASSERT(fid);
  349. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  350. err = fscore_unlink(inode, fid);
  351. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  352. return err;
  353. }
  354. EXPORT_SYMBOL(fsapi_unlink);
  355. /* reflect the internal dirty flags to VFS bh dirty flags */
  356. s32 fsapi_cache_flush(struct super_block *sb, int do_sync)
  357. {
  358. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  359. fcache_flush(sb, do_sync);
  360. dcache_flush(sb, do_sync);
  361. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  362. return 0;
  363. }
  364. EXPORT_SYMBOL(fsapi_cache_flush);
  365. /* release FAT & buf cache */
  366. s32 fsapi_cache_release(struct super_block *sb)
  367. {
  368. #ifdef CONFIG_SDFAT_DEBUG
  369. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  370. fcache_release_all(sb);
  371. dcache_release_all(sb);
  372. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  373. #endif /* CONFIG_SDFAT_DEBUG */
  374. return 0;
  375. }
  376. EXPORT_SYMBOL(fsapi_cache_release);
  377. u32 fsapi_get_au_stat(struct super_block *sb, s32 mode)
  378. {
  379. /* volume lock is not required */
  380. return fscore_get_au_stat(sb, mode);
  381. }
  382. EXPORT_SYMBOL(fsapi_get_au_stat);
  383. /* clear extent cache */
  384. void fsapi_invalidate_extent(struct inode *inode)
  385. {
  386. /* Volume lock is not required,
  387. * because it is only called by evict_inode.
  388. * If any other function can call it,
  389. * you should check whether volume lock is needed or not.
  390. */
  391. extent_cache_inval_inode(inode);
  392. }
  393. EXPORT_SYMBOL(fsapi_invalidate_extent);
  394. /* check device is ejected */
  395. s32 fsapi_check_bdi_valid(struct super_block *sb)
  396. {
  397. return fscore_check_bdi_valid(sb);
  398. }
  399. EXPORT_SYMBOL(fsapi_check_bdi_valid);
  400. #ifdef CONFIG_SDFAT_DFR
  401. /*----------------------------------------------------------------------*/
  402. /* Defragmentation related */
  403. /*----------------------------------------------------------------------*/
  404. s32 fsapi_dfr_get_info(struct super_block *sb, void *arg)
  405. {
  406. /* volume lock is not required */
  407. return defrag_get_info(sb, (struct defrag_info_arg *)arg);
  408. }
  409. EXPORT_SYMBOL(fsapi_dfr_get_info);
  410. s32 fsapi_dfr_scan_dir(struct super_block *sb, void *args)
  411. {
  412. s32 err;
  413. /* check the validity of pointer parameters */
  414. ASSERT(args);
  415. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  416. err = defrag_scan_dir(sb, (struct defrag_trav_arg *)args);
  417. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  418. return err;
  419. }
  420. EXPORT_SYMBOL(fsapi_dfr_scan_dir);
  421. s32 fsapi_dfr_validate_clus(struct inode *inode, void *chunk, int skip_prev)
  422. {
  423. s32 err;
  424. struct super_block *sb = inode->i_sb;
  425. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  426. err = defrag_validate_cluster(inode,
  427. (struct defrag_chunk_info *)chunk, skip_prev);
  428. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  429. return err;
  430. }
  431. EXPORT_SYMBOL(fsapi_dfr_validate_clus);
  432. s32 fsapi_dfr_reserve_clus(struct super_block *sb, s32 nr_clus)
  433. {
  434. s32 err;
  435. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  436. err = defrag_reserve_clusters(sb, nr_clus);
  437. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  438. return err;
  439. }
  440. EXPORT_SYMBOL(fsapi_dfr_reserve_clus);
  441. s32 fsapi_dfr_mark_ignore(struct super_block *sb, unsigned int clus)
  442. {
  443. /* volume lock is not required */
  444. return defrag_mark_ignore(sb, clus);
  445. }
  446. EXPORT_SYMBOL(fsapi_dfr_mark_ignore);
  447. void fsapi_dfr_unmark_ignore_all(struct super_block *sb)
  448. {
  449. /* volume lock is not required */
  450. defrag_unmark_ignore_all(sb);
  451. }
  452. EXPORT_SYMBOL(fsapi_dfr_unmark_ignore_all);
  453. s32 fsapi_dfr_map_clus(struct inode *inode, u32 clu_offset, u32 *clu)
  454. {
  455. s32 err;
  456. struct super_block *sb = inode->i_sb;
  457. /* check the validity of pointer parameters */
  458. ASSERT(clu);
  459. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  460. err = defrag_map_cluster(inode, clu_offset, clu);
  461. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  462. return err;
  463. }
  464. EXPORT_SYMBOL(fsapi_dfr_map_clus);
  465. void fsapi_dfr_writepage_endio(struct page *page)
  466. {
  467. /* volume lock is not required */
  468. defrag_writepage_end_io(page);
  469. }
  470. EXPORT_SYMBOL(fsapi_dfr_writepage_endio);
  471. void fsapi_dfr_update_fat_prev(struct super_block *sb, int force)
  472. {
  473. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  474. defrag_update_fat_prev(sb, force);
  475. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  476. }
  477. EXPORT_SYMBOL(fsapi_dfr_update_fat_prev);
  478. void fsapi_dfr_update_fat_next(struct super_block *sb)
  479. {
  480. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  481. defrag_update_fat_next(sb);
  482. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  483. }
  484. EXPORT_SYMBOL(fsapi_dfr_update_fat_next);
  485. void fsapi_dfr_check_discard(struct super_block *sb)
  486. {
  487. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  488. defrag_check_discard(sb);
  489. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  490. }
  491. EXPORT_SYMBOL(fsapi_dfr_check_discard);
  492. void fsapi_dfr_free_clus(struct super_block *sb, u32 clus)
  493. {
  494. mutex_lock(&(SDFAT_SB(sb)->s_vlock));
  495. defrag_free_cluster(sb, clus);
  496. mutex_unlock(&(SDFAT_SB(sb)->s_vlock));
  497. }
  498. EXPORT_SYMBOL(fsapi_dfr_free_clus);
  499. s32 fsapi_dfr_check_dfr_required(struct super_block *sb, int *totalau, int *cleanau, int *fullau)
  500. {
  501. /* volume lock is not required */
  502. return defrag_check_defrag_required(sb, totalau, cleanau, fullau);
  503. }
  504. EXPORT_SYMBOL(fsapi_dfr_check_dfr_required);
  505. s32 fsapi_dfr_check_dfr_on(struct inode *inode, loff_t start, loff_t end, s32 cancel, const char *caller)
  506. {
  507. /* volume lock is not required */
  508. return defrag_check_defrag_on(inode, start, end, cancel, caller);
  509. }
  510. EXPORT_SYMBOL(fsapi_dfr_check_dfr_on);
  511. #ifdef CONFIG_SDFAT_DFR_DEBUG
  512. void fsapi_dfr_spo_test(struct super_block *sb, int flag, const char *caller)
  513. {
  514. /* volume lock is not required */
  515. defrag_spo_test(sb, flag, caller);
  516. }
  517. EXPORT_SYMBOL(fsapi_dfr_spo_test);
  518. #endif
  519. #endif /* CONFIG_SDFAT_DFR */
  520. /* end of sdfat_api.c */