inode.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305
  1. /*
  2. * Copyright (C) 2005, 2006
  3. * Avishay Traeger (avishay@gmail.com)
  4. * Copyright (C) 2008, 2009
  5. * Boaz Harrosh <bharrosh@panasas.com>
  6. *
  7. * Copyrights for code taken from ext2:
  8. * Copyright (C) 1992, 1993, 1994, 1995
  9. * Remy Card (card@masi.ibp.fr)
  10. * Laboratoire MASI - Institut Blaise Pascal
  11. * Universite Pierre et Marie Curie (Paris VI)
  12. * from
  13. * linux/fs/minix/inode.c
  14. * Copyright (C) 1991, 1992 Linus Torvalds
  15. *
  16. * This file is part of exofs.
  17. *
  18. * exofs is free software; you can redistribute it and/or modify
  19. * it under the terms of the GNU General Public License as published by
  20. * the Free Software Foundation. Since it is based on ext2, and the only
  21. * valid version of GPL for the Linux kernel is version 2, the only valid
  22. * version of GPL for exofs is version 2.
  23. *
  24. * exofs is distributed in the hope that it will be useful,
  25. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  27. * GNU General Public License for more details.
  28. *
  29. * You should have received a copy of the GNU General Public License
  30. * along with exofs; if not, write to the Free Software
  31. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  32. */
  33. #include <linux/writeback.h>
  34. #include <linux/buffer_head.h>
  35. #include <scsi/scsi_device.h>
  36. #include "exofs.h"
  37. #ifdef CONFIG_EXOFS_DEBUG
  38. # define EXOFS_DEBUG_OBJ_ISIZE 1
  39. #endif
  40. #define EXOFS_DBGMSG2(M...) do {} while (0)
  41. struct page_collect {
  42. struct exofs_sb_info *sbi;
  43. struct request_queue *req_q;
  44. struct inode *inode;
  45. unsigned expected_pages;
  46. struct bio *bio;
  47. unsigned nr_pages;
  48. unsigned long length;
  49. loff_t pg_first; /* keep 64bit also in 32-arches */
  50. };
  51. static void _pcol_init(struct page_collect *pcol, unsigned expected_pages,
  52. struct inode *inode)
  53. {
  54. struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
  55. pcol->sbi = sbi;
  56. pcol->req_q = osd_request_queue(sbi->s_dev);
  57. pcol->inode = inode;
  58. pcol->expected_pages = expected_pages;
  59. pcol->bio = NULL;
  60. pcol->nr_pages = 0;
  61. pcol->length = 0;
  62. pcol->pg_first = -1;
  63. EXOFS_DBGMSG("_pcol_init ino=0x%lx expected_pages=%u\n", inode->i_ino,
  64. expected_pages);
  65. }
  66. static void _pcol_reset(struct page_collect *pcol)
  67. {
  68. pcol->expected_pages -= min(pcol->nr_pages, pcol->expected_pages);
  69. pcol->bio = NULL;
  70. pcol->nr_pages = 0;
  71. pcol->length = 0;
  72. pcol->pg_first = -1;
  73. EXOFS_DBGMSG("_pcol_reset ino=0x%lx expected_pages=%u\n",
  74. pcol->inode->i_ino, pcol->expected_pages);
  75. /* this is probably the end of the loop but in writes
  76. * it might not end here. don't be left with nothing
  77. */
  78. if (!pcol->expected_pages)
  79. pcol->expected_pages = 128;
  80. }
  81. static int pcol_try_alloc(struct page_collect *pcol)
  82. {
  83. int pages = min_t(unsigned, pcol->expected_pages, BIO_MAX_PAGES);
  84. for (; pages; pages >>= 1) {
  85. pcol->bio = bio_alloc(GFP_KERNEL, pages);
  86. if (likely(pcol->bio))
  87. return 0;
  88. }
  89. EXOFS_ERR("Failed to kcalloc expected_pages=%u\n",
  90. pcol->expected_pages);
  91. return -ENOMEM;
  92. }
  93. static void pcol_free(struct page_collect *pcol)
  94. {
  95. bio_put(pcol->bio);
  96. pcol->bio = NULL;
  97. }
  98. static int pcol_add_page(struct page_collect *pcol, struct page *page,
  99. unsigned len)
  100. {
  101. int added_len = bio_add_pc_page(pcol->req_q, pcol->bio, page, len, 0);
  102. if (unlikely(len != added_len))
  103. return -ENOMEM;
  104. ++pcol->nr_pages;
  105. pcol->length += len;
  106. return 0;
  107. }
  108. static int update_read_page(struct page *page, int ret)
  109. {
  110. if (ret == 0) {
  111. /* Everything is OK */
  112. SetPageUptodate(page);
  113. if (PageError(page))
  114. ClearPageError(page);
  115. } else if (ret == -EFAULT) {
  116. /* In this case we were trying to read something that wasn't on
  117. * disk yet - return a page full of zeroes. This should be OK,
  118. * because the object should be empty (if there was a write
  119. * before this read, the read would be waiting with the page
  120. * locked */
  121. clear_highpage(page);
  122. SetPageUptodate(page);
  123. if (PageError(page))
  124. ClearPageError(page);
  125. ret = 0; /* recovered error */
  126. EXOFS_DBGMSG("recovered read error\n");
  127. } else /* Error */
  128. SetPageError(page);
  129. return ret;
  130. }
  131. static void update_write_page(struct page *page, int ret)
  132. {
  133. if (ret) {
  134. mapping_set_error(page->mapping, ret);
  135. SetPageError(page);
  136. }
  137. end_page_writeback(page);
  138. }
  139. /* Called at the end of reads, to optionally unlock pages and update their
  140. * status.
  141. */
  142. static int __readpages_done(struct osd_request *or, struct page_collect *pcol,
  143. bool do_unlock)
  144. {
  145. struct bio_vec *bvec;
  146. int i;
  147. u64 resid;
  148. u64 good_bytes;
  149. u64 length = 0;
  150. int ret = exofs_check_ok_resid(or, &resid, NULL);
  151. osd_end_request(or);
  152. if (likely(!ret))
  153. good_bytes = pcol->length;
  154. else if (!resid)
  155. good_bytes = 0;
  156. else
  157. good_bytes = pcol->length - resid;
  158. EXOFS_DBGMSG("readpages_done(0x%lx) good_bytes=0x%llx"
  159. " length=0x%lx nr_pages=%u\n",
  160. pcol->inode->i_ino, _LLU(good_bytes), pcol->length,
  161. pcol->nr_pages);
  162. __bio_for_each_segment(bvec, pcol->bio, i, 0) {
  163. struct page *page = bvec->bv_page;
  164. struct inode *inode = page->mapping->host;
  165. int page_stat;
  166. if (inode != pcol->inode)
  167. continue; /* osd might add more pages at end */
  168. if (likely(length < good_bytes))
  169. page_stat = 0;
  170. else
  171. page_stat = ret;
  172. EXOFS_DBGMSG2(" readpages_done(0x%lx, 0x%lx) %s\n",
  173. inode->i_ino, page->index,
  174. page_stat ? "bad_bytes" : "good_bytes");
  175. ret = update_read_page(page, page_stat);
  176. if (do_unlock)
  177. unlock_page(page);
  178. length += bvec->bv_len;
  179. }
  180. pcol_free(pcol);
  181. EXOFS_DBGMSG("readpages_done END\n");
  182. return ret;
  183. }
  184. /* callback of async reads */
  185. static void readpages_done(struct osd_request *or, void *p)
  186. {
  187. struct page_collect *pcol = p;
  188. __readpages_done(or, pcol, true);
  189. atomic_dec(&pcol->sbi->s_curr_pending);
  190. kfree(p);
  191. }
  192. static void _unlock_pcol_pages(struct page_collect *pcol, int ret, int rw)
  193. {
  194. struct bio_vec *bvec;
  195. int i;
  196. __bio_for_each_segment(bvec, pcol->bio, i, 0) {
  197. struct page *page = bvec->bv_page;
  198. if (rw == READ)
  199. update_read_page(page, ret);
  200. else
  201. update_write_page(page, ret);
  202. unlock_page(page);
  203. }
  204. pcol_free(pcol);
  205. }
  206. static int read_exec(struct page_collect *pcol, bool is_sync)
  207. {
  208. struct exofs_i_info *oi = exofs_i(pcol->inode);
  209. struct osd_obj_id obj = {pcol->sbi->s_pid,
  210. pcol->inode->i_ino + EXOFS_OBJ_OFF};
  211. struct osd_request *or = NULL;
  212. struct page_collect *pcol_copy = NULL;
  213. loff_t i_start = pcol->pg_first << PAGE_CACHE_SHIFT;
  214. int ret;
  215. if (!pcol->bio)
  216. return 0;
  217. /* see comment in _readpage() about sync reads */
  218. WARN_ON(is_sync && (pcol->nr_pages != 1));
  219. or = osd_start_request(pcol->sbi->s_dev, GFP_KERNEL);
  220. if (unlikely(!or)) {
  221. ret = -ENOMEM;
  222. goto err;
  223. }
  224. osd_req_read(or, &obj, i_start, pcol->bio, pcol->length);
  225. if (is_sync) {
  226. exofs_sync_op(or, pcol->sbi->s_timeout, oi->i_cred);
  227. return __readpages_done(or, pcol, false);
  228. }
  229. pcol_copy = kmalloc(sizeof(*pcol_copy), GFP_KERNEL);
  230. if (!pcol_copy) {
  231. ret = -ENOMEM;
  232. goto err;
  233. }
  234. *pcol_copy = *pcol;
  235. ret = exofs_async_op(or, readpages_done, pcol_copy, oi->i_cred);
  236. if (unlikely(ret))
  237. goto err;
  238. atomic_inc(&pcol->sbi->s_curr_pending);
  239. EXOFS_DBGMSG("read_exec obj=0x%llx start=0x%llx length=0x%lx\n",
  240. obj.id, _LLU(i_start), pcol->length);
  241. /* pages ownership was passed to pcol_copy */
  242. _pcol_reset(pcol);
  243. return 0;
  244. err:
  245. if (!is_sync)
  246. _unlock_pcol_pages(pcol, ret, READ);
  247. else /* Pages unlocked by caller in sync mode only free bio */
  248. pcol_free(pcol);
  249. kfree(pcol_copy);
  250. if (or)
  251. osd_end_request(or);
  252. return ret;
  253. }
  254. /* readpage_strip is called either directly from readpage() or by the VFS from
  255. * within read_cache_pages(), to add one more page to be read. It will try to
  256. * collect as many contiguous pages as posible. If a discontinuity is
  257. * encountered, or it runs out of resources, it will submit the previous segment
  258. * and will start a new collection. Eventually caller must submit the last
  259. * segment if present.
  260. */
  261. static int readpage_strip(void *data, struct page *page)
  262. {
  263. struct page_collect *pcol = data;
  264. struct inode *inode = pcol->inode;
  265. struct exofs_i_info *oi = exofs_i(inode);
  266. loff_t i_size = i_size_read(inode);
  267. pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
  268. size_t len;
  269. int ret;
  270. /* FIXME: Just for debugging, will be removed */
  271. if (PageUptodate(page))
  272. EXOFS_ERR("PageUptodate(0x%lx, 0x%lx)\n", pcol->inode->i_ino,
  273. page->index);
  274. if (page->index < end_index)
  275. len = PAGE_CACHE_SIZE;
  276. else if (page->index == end_index)
  277. len = i_size & ~PAGE_CACHE_MASK;
  278. else
  279. len = 0;
  280. if (!len || !obj_created(oi)) {
  281. /* this will be out of bounds, or doesn't exist yet.
  282. * Current page is cleared and the request is split
  283. */
  284. clear_highpage(page);
  285. SetPageUptodate(page);
  286. if (PageError(page))
  287. ClearPageError(page);
  288. unlock_page(page);
  289. EXOFS_DBGMSG("readpage_strip(0x%lx, 0x%lx) empty page,"
  290. " splitting\n", inode->i_ino, page->index);
  291. return read_exec(pcol, false);
  292. }
  293. try_again:
  294. if (unlikely(pcol->pg_first == -1)) {
  295. pcol->pg_first = page->index;
  296. } else if (unlikely((pcol->pg_first + pcol->nr_pages) !=
  297. page->index)) {
  298. /* Discontinuity detected, split the request */
  299. ret = read_exec(pcol, false);
  300. if (unlikely(ret))
  301. goto fail;
  302. goto try_again;
  303. }
  304. if (!pcol->bio) {
  305. ret = pcol_try_alloc(pcol);
  306. if (unlikely(ret))
  307. goto fail;
  308. }
  309. if (len != PAGE_CACHE_SIZE)
  310. zero_user(page, len, PAGE_CACHE_SIZE - len);
  311. EXOFS_DBGMSG2(" readpage_strip(0x%lx, 0x%lx) len=0x%zx\n",
  312. inode->i_ino, page->index, len);
  313. ret = pcol_add_page(pcol, page, len);
  314. if (ret) {
  315. EXOFS_DBGMSG2("Failed pcol_add_page pages[i]=%p "
  316. "this_len=0x%zx nr_pages=%u length=0x%lx\n",
  317. page, len, pcol->nr_pages, pcol->length);
  318. /* split the request, and start again with current page */
  319. ret = read_exec(pcol, false);
  320. if (unlikely(ret))
  321. goto fail;
  322. goto try_again;
  323. }
  324. return 0;
  325. fail:
  326. /* SetPageError(page); ??? */
  327. unlock_page(page);
  328. return ret;
  329. }
  330. static int exofs_readpages(struct file *file, struct address_space *mapping,
  331. struct list_head *pages, unsigned nr_pages)
  332. {
  333. struct page_collect pcol;
  334. int ret;
  335. _pcol_init(&pcol, nr_pages, mapping->host);
  336. ret = read_cache_pages(mapping, pages, readpage_strip, &pcol);
  337. if (ret) {
  338. EXOFS_ERR("read_cache_pages => %d\n", ret);
  339. return ret;
  340. }
  341. return read_exec(&pcol, false);
  342. }
  343. static int _readpage(struct page *page, bool is_sync)
  344. {
  345. struct page_collect pcol;
  346. int ret;
  347. _pcol_init(&pcol, 1, page->mapping->host);
  348. /* readpage_strip might call read_exec(,async) inside at several places
  349. * but this is safe for is_async=0 since read_exec will not do anything
  350. * when we have a single page.
  351. */
  352. ret = readpage_strip(&pcol, page);
  353. if (ret) {
  354. EXOFS_ERR("_readpage => %d\n", ret);
  355. return ret;
  356. }
  357. return read_exec(&pcol, is_sync);
  358. }
  359. /*
  360. * We don't need the file
  361. */
  362. static int exofs_readpage(struct file *file, struct page *page)
  363. {
  364. return _readpage(page, false);
  365. }
  366. /* Callback for osd_write. All writes are asynchronouse */
  367. static void writepages_done(struct osd_request *or, void *p)
  368. {
  369. struct page_collect *pcol = p;
  370. struct bio_vec *bvec;
  371. int i;
  372. u64 resid;
  373. u64 good_bytes;
  374. u64 length = 0;
  375. int ret = exofs_check_ok_resid(or, NULL, &resid);
  376. osd_end_request(or);
  377. atomic_dec(&pcol->sbi->s_curr_pending);
  378. if (likely(!ret))
  379. good_bytes = pcol->length;
  380. else if (!resid)
  381. good_bytes = 0;
  382. else
  383. good_bytes = pcol->length - resid;
  384. EXOFS_DBGMSG("writepages_done(0x%lx) good_bytes=0x%llx"
  385. " length=0x%lx nr_pages=%u\n",
  386. pcol->inode->i_ino, _LLU(good_bytes), pcol->length,
  387. pcol->nr_pages);
  388. __bio_for_each_segment(bvec, pcol->bio, i, 0) {
  389. struct page *page = bvec->bv_page;
  390. struct inode *inode = page->mapping->host;
  391. int page_stat;
  392. if (inode != pcol->inode)
  393. continue; /* osd might add more pages to a bio */
  394. if (likely(length < good_bytes))
  395. page_stat = 0;
  396. else
  397. page_stat = ret;
  398. update_write_page(page, page_stat);
  399. unlock_page(page);
  400. EXOFS_DBGMSG2(" writepages_done(0x%lx, 0x%lx) status=%d\n",
  401. inode->i_ino, page->index, page_stat);
  402. length += bvec->bv_len;
  403. }
  404. pcol_free(pcol);
  405. kfree(pcol);
  406. EXOFS_DBGMSG("writepages_done END\n");
  407. }
  408. static int write_exec(struct page_collect *pcol)
  409. {
  410. struct exofs_i_info *oi = exofs_i(pcol->inode);
  411. struct osd_obj_id obj = {pcol->sbi->s_pid,
  412. pcol->inode->i_ino + EXOFS_OBJ_OFF};
  413. struct osd_request *or = NULL;
  414. struct page_collect *pcol_copy = NULL;
  415. loff_t i_start = pcol->pg_first << PAGE_CACHE_SHIFT;
  416. int ret;
  417. if (!pcol->bio)
  418. return 0;
  419. or = osd_start_request(pcol->sbi->s_dev, GFP_KERNEL);
  420. if (unlikely(!or)) {
  421. EXOFS_ERR("write_exec: Faild to osd_start_request()\n");
  422. ret = -ENOMEM;
  423. goto err;
  424. }
  425. pcol_copy = kmalloc(sizeof(*pcol_copy), GFP_KERNEL);
  426. if (!pcol_copy) {
  427. EXOFS_ERR("write_exec: Faild to kmalloc(pcol)\n");
  428. ret = -ENOMEM;
  429. goto err;
  430. }
  431. *pcol_copy = *pcol;
  432. pcol_copy->bio->bi_rw |= (1 << BIO_RW); /* FIXME: bio_set_dir() */
  433. osd_req_write(or, &obj, i_start, pcol_copy->bio, pcol_copy->length);
  434. ret = exofs_async_op(or, writepages_done, pcol_copy, oi->i_cred);
  435. if (unlikely(ret)) {
  436. EXOFS_ERR("write_exec: exofs_async_op() Faild\n");
  437. goto err;
  438. }
  439. atomic_inc(&pcol->sbi->s_curr_pending);
  440. EXOFS_DBGMSG("write_exec(0x%lx, 0x%llx) start=0x%llx length=0x%lx\n",
  441. pcol->inode->i_ino, pcol->pg_first, _LLU(i_start),
  442. pcol->length);
  443. /* pages ownership was passed to pcol_copy */
  444. _pcol_reset(pcol);
  445. return 0;
  446. err:
  447. _unlock_pcol_pages(pcol, ret, WRITE);
  448. kfree(pcol_copy);
  449. if (or)
  450. osd_end_request(or);
  451. return ret;
  452. }
  453. /* writepage_strip is called either directly from writepage() or by the VFS from
  454. * within write_cache_pages(), to add one more page to be written to storage.
  455. * It will try to collect as many contiguous pages as possible. If a
  456. * discontinuity is encountered or it runs out of resources it will submit the
  457. * previous segment and will start a new collection.
  458. * Eventually caller must submit the last segment if present.
  459. */
  460. static int writepage_strip(struct page *page,
  461. struct writeback_control *wbc_unused, void *data)
  462. {
  463. struct page_collect *pcol = data;
  464. struct inode *inode = pcol->inode;
  465. struct exofs_i_info *oi = exofs_i(inode);
  466. loff_t i_size = i_size_read(inode);
  467. pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
  468. size_t len;
  469. int ret;
  470. BUG_ON(!PageLocked(page));
  471. ret = wait_obj_created(oi);
  472. if (unlikely(ret))
  473. goto fail;
  474. if (page->index < end_index)
  475. /* in this case, the page is within the limits of the file */
  476. len = PAGE_CACHE_SIZE;
  477. else {
  478. len = i_size & ~PAGE_CACHE_MASK;
  479. if (page->index > end_index || !len) {
  480. /* in this case, the page is outside the limits
  481. * (truncate in progress)
  482. */
  483. ret = write_exec(pcol);
  484. if (unlikely(ret))
  485. goto fail;
  486. if (PageError(page))
  487. ClearPageError(page);
  488. unlock_page(page);
  489. return 0;
  490. }
  491. }
  492. try_again:
  493. if (unlikely(pcol->pg_first == -1)) {
  494. pcol->pg_first = page->index;
  495. } else if (unlikely((pcol->pg_first + pcol->nr_pages) !=
  496. page->index)) {
  497. /* Discontinuity detected, split the request */
  498. ret = write_exec(pcol);
  499. if (unlikely(ret))
  500. goto fail;
  501. goto try_again;
  502. }
  503. if (!pcol->bio) {
  504. ret = pcol_try_alloc(pcol);
  505. if (unlikely(ret))
  506. goto fail;
  507. }
  508. EXOFS_DBGMSG2(" writepage_strip(0x%lx, 0x%lx) len=0x%zx\n",
  509. inode->i_ino, page->index, len);
  510. ret = pcol_add_page(pcol, page, len);
  511. if (unlikely(ret)) {
  512. EXOFS_DBGMSG("Failed pcol_add_page "
  513. "nr_pages=%u total_length=0x%lx\n",
  514. pcol->nr_pages, pcol->length);
  515. /* split the request, next loop will start again */
  516. ret = write_exec(pcol);
  517. if (unlikely(ret)) {
  518. EXOFS_DBGMSG("write_exec faild => %d", ret);
  519. goto fail;
  520. }
  521. goto try_again;
  522. }
  523. BUG_ON(PageWriteback(page));
  524. set_page_writeback(page);
  525. return 0;
  526. fail:
  527. set_bit(AS_EIO, &page->mapping->flags);
  528. unlock_page(page);
  529. return ret;
  530. }
  531. static int exofs_writepages(struct address_space *mapping,
  532. struct writeback_control *wbc)
  533. {
  534. struct page_collect pcol;
  535. long start, end, expected_pages;
  536. int ret;
  537. start = wbc->range_start >> PAGE_CACHE_SHIFT;
  538. end = (wbc->range_end == LLONG_MAX) ?
  539. start + mapping->nrpages :
  540. wbc->range_end >> PAGE_CACHE_SHIFT;
  541. if (start || end)
  542. expected_pages = min(end - start + 1, 32L);
  543. else
  544. expected_pages = mapping->nrpages;
  545. EXOFS_DBGMSG("inode(0x%lx) wbc->start=0x%llx wbc->end=0x%llx"
  546. " m->nrpages=%lu start=0x%lx end=0x%lx\n",
  547. mapping->host->i_ino, wbc->range_start, wbc->range_end,
  548. mapping->nrpages, start, end);
  549. _pcol_init(&pcol, expected_pages, mapping->host);
  550. ret = write_cache_pages(mapping, wbc, writepage_strip, &pcol);
  551. if (ret) {
  552. EXOFS_ERR("write_cache_pages => %d\n", ret);
  553. return ret;
  554. }
  555. return write_exec(&pcol);
  556. }
  557. static int exofs_writepage(struct page *page, struct writeback_control *wbc)
  558. {
  559. struct page_collect pcol;
  560. int ret;
  561. _pcol_init(&pcol, 1, page->mapping->host);
  562. ret = writepage_strip(page, NULL, &pcol);
  563. if (ret) {
  564. EXOFS_ERR("exofs_writepage => %d\n", ret);
  565. return ret;
  566. }
  567. return write_exec(&pcol);
  568. }
  569. int exofs_write_begin(struct file *file, struct address_space *mapping,
  570. loff_t pos, unsigned len, unsigned flags,
  571. struct page **pagep, void **fsdata)
  572. {
  573. int ret = 0;
  574. struct page *page;
  575. page = *pagep;
  576. if (page == NULL) {
  577. ret = simple_write_begin(file, mapping, pos, len, flags, pagep,
  578. fsdata);
  579. if (ret) {
  580. EXOFS_DBGMSG("simple_write_begin faild\n");
  581. return ret;
  582. }
  583. page = *pagep;
  584. }
  585. /* read modify write */
  586. if (!PageUptodate(page) && (len != PAGE_CACHE_SIZE)) {
  587. ret = _readpage(page, true);
  588. if (ret) {
  589. /*SetPageError was done by _readpage. Is it ok?*/
  590. unlock_page(page);
  591. EXOFS_DBGMSG("__readpage_filler faild\n");
  592. }
  593. }
  594. return ret;
  595. }
  596. static int exofs_write_begin_export(struct file *file,
  597. struct address_space *mapping,
  598. loff_t pos, unsigned len, unsigned flags,
  599. struct page **pagep, void **fsdata)
  600. {
  601. *pagep = NULL;
  602. return exofs_write_begin(file, mapping, pos, len, flags, pagep,
  603. fsdata);
  604. }
  605. const struct address_space_operations exofs_aops = {
  606. .readpage = exofs_readpage,
  607. .readpages = exofs_readpages,
  608. .writepage = exofs_writepage,
  609. .writepages = exofs_writepages,
  610. .write_begin = exofs_write_begin_export,
  611. .write_end = simple_write_end,
  612. };
  613. /******************************************************************************
  614. * INODE OPERATIONS
  615. *****************************************************************************/
  616. /*
  617. * Test whether an inode is a fast symlink.
  618. */
  619. static inline int exofs_inode_is_fast_symlink(struct inode *inode)
  620. {
  621. struct exofs_i_info *oi = exofs_i(inode);
  622. return S_ISLNK(inode->i_mode) && (oi->i_data[0] != 0);
  623. }
  624. /*
  625. * get_block_t - Fill in a buffer_head
  626. * An OSD takes care of block allocation so we just fake an allocation by
  627. * putting in the inode's sector_t in the buffer_head.
  628. * TODO: What about the case of create==0 and @iblock does not exist in the
  629. * object?
  630. */
  631. static int exofs_get_block(struct inode *inode, sector_t iblock,
  632. struct buffer_head *bh_result, int create)
  633. {
  634. map_bh(bh_result, inode->i_sb, iblock);
  635. return 0;
  636. }
  637. const struct osd_attr g_attr_logical_length = ATTR_DEF(
  638. OSD_APAGE_OBJECT_INFORMATION, OSD_ATTR_OI_LOGICAL_LENGTH, 8);
  639. /*
  640. * Truncate a file to the specified size - all we have to do is set the size
  641. * attribute. We make sure the object exists first.
  642. */
  643. void exofs_truncate(struct inode *inode)
  644. {
  645. struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
  646. struct exofs_i_info *oi = exofs_i(inode);
  647. struct osd_obj_id obj = {sbi->s_pid, inode->i_ino + EXOFS_OBJ_OFF};
  648. struct osd_request *or;
  649. struct osd_attr attr;
  650. loff_t isize = i_size_read(inode);
  651. __be64 newsize;
  652. int ret;
  653. if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)
  654. || S_ISLNK(inode->i_mode)))
  655. return;
  656. if (exofs_inode_is_fast_symlink(inode))
  657. return;
  658. if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
  659. return;
  660. inode->i_mtime = inode->i_ctime = CURRENT_TIME;
  661. nobh_truncate_page(inode->i_mapping, isize, exofs_get_block);
  662. or = osd_start_request(sbi->s_dev, GFP_KERNEL);
  663. if (unlikely(!or)) {
  664. EXOFS_ERR("ERROR: exofs_truncate: osd_start_request failed\n");
  665. goto fail;
  666. }
  667. osd_req_set_attributes(or, &obj);
  668. newsize = cpu_to_be64((u64)isize);
  669. attr = g_attr_logical_length;
  670. attr.val_ptr = &newsize;
  671. osd_req_add_set_attr_list(or, &attr, 1);
  672. /* if we are about to truncate an object, and it hasn't been
  673. * created yet, wait
  674. */
  675. if (unlikely(wait_obj_created(oi)))
  676. goto fail;
  677. ret = exofs_sync_op(or, sbi->s_timeout, oi->i_cred);
  678. osd_end_request(or);
  679. if (ret)
  680. goto fail;
  681. out:
  682. mark_inode_dirty(inode);
  683. return;
  684. fail:
  685. make_bad_inode(inode);
  686. goto out;
  687. }
  688. /*
  689. * Set inode attributes - just call generic functions.
  690. */
  691. int exofs_setattr(struct dentry *dentry, struct iattr *iattr)
  692. {
  693. struct inode *inode = dentry->d_inode;
  694. int error;
  695. error = inode_change_ok(inode, iattr);
  696. if (error)
  697. return error;
  698. error = inode_setattr(inode, iattr);
  699. return error;
  700. }
  701. /*
  702. * Read an inode from the OSD, and return it as is. We also return the size
  703. * attribute in the 'sanity' argument if we got compiled with debugging turned
  704. * on.
  705. */
  706. static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
  707. struct exofs_fcb *inode, uint64_t *sanity)
  708. {
  709. struct exofs_sb_info *sbi = sb->s_fs_info;
  710. struct osd_request *or;
  711. struct osd_attr attr;
  712. struct osd_obj_id obj = {sbi->s_pid,
  713. oi->vfs_inode.i_ino + EXOFS_OBJ_OFF};
  714. int ret;
  715. exofs_make_credential(oi->i_cred, &obj);
  716. or = osd_start_request(sbi->s_dev, GFP_KERNEL);
  717. if (unlikely(!or)) {
  718. EXOFS_ERR("exofs_get_inode: osd_start_request failed.\n");
  719. return -ENOMEM;
  720. }
  721. osd_req_get_attributes(or, &obj);
  722. /* we need the inode attribute */
  723. osd_req_add_get_attr_list(or, &g_attr_inode_data, 1);
  724. #ifdef EXOFS_DEBUG_OBJ_ISIZE
  725. /* we get the size attributes to do a sanity check */
  726. osd_req_add_get_attr_list(or, &g_attr_logical_length, 1);
  727. #endif
  728. ret = exofs_sync_op(or, sbi->s_timeout, oi->i_cred);
  729. if (ret)
  730. goto out;
  731. attr = g_attr_inode_data;
  732. ret = extract_attr_from_req(or, &attr);
  733. if (ret) {
  734. EXOFS_ERR("exofs_get_inode: extract_attr_from_req failed\n");
  735. goto out;
  736. }
  737. WARN_ON(attr.len != EXOFS_INO_ATTR_SIZE);
  738. memcpy(inode, attr.val_ptr, EXOFS_INO_ATTR_SIZE);
  739. #ifdef EXOFS_DEBUG_OBJ_ISIZE
  740. attr = g_attr_logical_length;
  741. ret = extract_attr_from_req(or, &attr);
  742. if (ret) {
  743. EXOFS_ERR("ERROR: extract attr from or failed\n");
  744. goto out;
  745. }
  746. *sanity = get_unaligned_be64(attr.val_ptr);
  747. #endif
  748. out:
  749. osd_end_request(or);
  750. return ret;
  751. }
  752. /*
  753. * Fill in an inode read from the OSD and set it up for use
  754. */
  755. struct inode *exofs_iget(struct super_block *sb, unsigned long ino)
  756. {
  757. struct exofs_i_info *oi;
  758. struct exofs_fcb fcb;
  759. struct inode *inode;
  760. uint64_t uninitialized_var(sanity);
  761. int ret;
  762. inode = iget_locked(sb, ino);
  763. if (!inode)
  764. return ERR_PTR(-ENOMEM);
  765. if (!(inode->i_state & I_NEW))
  766. return inode;
  767. oi = exofs_i(inode);
  768. /* read the inode from the osd */
  769. ret = exofs_get_inode(sb, oi, &fcb, &sanity);
  770. if (ret)
  771. goto bad_inode;
  772. init_waitqueue_head(&oi->i_wq);
  773. set_obj_created(oi);
  774. /* copy stuff from on-disk struct to in-memory struct */
  775. inode->i_mode = le16_to_cpu(fcb.i_mode);
  776. inode->i_uid = le32_to_cpu(fcb.i_uid);
  777. inode->i_gid = le32_to_cpu(fcb.i_gid);
  778. inode->i_nlink = le16_to_cpu(fcb.i_links_count);
  779. inode->i_ctime.tv_sec = (signed)le32_to_cpu(fcb.i_ctime);
  780. inode->i_atime.tv_sec = (signed)le32_to_cpu(fcb.i_atime);
  781. inode->i_mtime.tv_sec = (signed)le32_to_cpu(fcb.i_mtime);
  782. inode->i_ctime.tv_nsec =
  783. inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = 0;
  784. oi->i_commit_size = le64_to_cpu(fcb.i_size);
  785. i_size_write(inode, oi->i_commit_size);
  786. inode->i_blkbits = EXOFS_BLKSHIFT;
  787. inode->i_generation = le32_to_cpu(fcb.i_generation);
  788. #ifdef EXOFS_DEBUG_OBJ_ISIZE
  789. if ((inode->i_size != sanity) &&
  790. (!exofs_inode_is_fast_symlink(inode))) {
  791. EXOFS_ERR("WARNING: Size of inode=%llu != object=%llu\n",
  792. inode->i_size, _LLU(sanity));
  793. }
  794. #endif
  795. oi->i_dir_start_lookup = 0;
  796. if ((inode->i_nlink == 0) && (inode->i_mode == 0)) {
  797. ret = -ESTALE;
  798. goto bad_inode;
  799. }
  800. if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
  801. if (fcb.i_data[0])
  802. inode->i_rdev =
  803. old_decode_dev(le32_to_cpu(fcb.i_data[0]));
  804. else
  805. inode->i_rdev =
  806. new_decode_dev(le32_to_cpu(fcb.i_data[1]));
  807. } else {
  808. memcpy(oi->i_data, fcb.i_data, sizeof(fcb.i_data));
  809. }
  810. if (S_ISREG(inode->i_mode)) {
  811. inode->i_op = &exofs_file_inode_operations;
  812. inode->i_fop = &exofs_file_operations;
  813. inode->i_mapping->a_ops = &exofs_aops;
  814. } else if (S_ISDIR(inode->i_mode)) {
  815. inode->i_op = &exofs_dir_inode_operations;
  816. inode->i_fop = &exofs_dir_operations;
  817. inode->i_mapping->a_ops = &exofs_aops;
  818. } else if (S_ISLNK(inode->i_mode)) {
  819. if (exofs_inode_is_fast_symlink(inode))
  820. inode->i_op = &exofs_fast_symlink_inode_operations;
  821. else {
  822. inode->i_op = &exofs_symlink_inode_operations;
  823. inode->i_mapping->a_ops = &exofs_aops;
  824. }
  825. } else {
  826. inode->i_op = &exofs_special_inode_operations;
  827. if (fcb.i_data[0])
  828. init_special_inode(inode, inode->i_mode,
  829. old_decode_dev(le32_to_cpu(fcb.i_data[0])));
  830. else
  831. init_special_inode(inode, inode->i_mode,
  832. new_decode_dev(le32_to_cpu(fcb.i_data[1])));
  833. }
  834. unlock_new_inode(inode);
  835. return inode;
  836. bad_inode:
  837. iget_failed(inode);
  838. return ERR_PTR(ret);
  839. }
  840. int __exofs_wait_obj_created(struct exofs_i_info *oi)
  841. {
  842. if (!obj_created(oi)) {
  843. BUG_ON(!obj_2bcreated(oi));
  844. wait_event(oi->i_wq, obj_created(oi));
  845. }
  846. return unlikely(is_bad_inode(&oi->vfs_inode)) ? -EIO : 0;
  847. }
  848. /*
  849. * Callback function from exofs_new_inode(). The important thing is that we
  850. * set the obj_created flag so that other methods know that the object exists on
  851. * the OSD.
  852. */
  853. static void create_done(struct osd_request *or, void *p)
  854. {
  855. struct inode *inode = p;
  856. struct exofs_i_info *oi = exofs_i(inode);
  857. struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
  858. int ret;
  859. ret = exofs_check_ok(or);
  860. osd_end_request(or);
  861. atomic_dec(&sbi->s_curr_pending);
  862. if (unlikely(ret)) {
  863. EXOFS_ERR("object=0x%llx creation faild in pid=0x%llx",
  864. _LLU(sbi->s_pid), _LLU(inode->i_ino + EXOFS_OBJ_OFF));
  865. make_bad_inode(inode);
  866. } else
  867. set_obj_created(oi);
  868. atomic_dec(&inode->i_count);
  869. wake_up(&oi->i_wq);
  870. }
  871. /*
  872. * Set up a new inode and create an object for it on the OSD
  873. */
  874. struct inode *exofs_new_inode(struct inode *dir, int mode)
  875. {
  876. struct super_block *sb;
  877. struct inode *inode;
  878. struct exofs_i_info *oi;
  879. struct exofs_sb_info *sbi;
  880. struct osd_request *or;
  881. struct osd_obj_id obj;
  882. int ret;
  883. sb = dir->i_sb;
  884. inode = new_inode(sb);
  885. if (!inode)
  886. return ERR_PTR(-ENOMEM);
  887. oi = exofs_i(inode);
  888. init_waitqueue_head(&oi->i_wq);
  889. set_obj_2bcreated(oi);
  890. sbi = sb->s_fs_info;
  891. sb->s_dirt = 1;
  892. inode->i_uid = current->cred->fsuid;
  893. if (dir->i_mode & S_ISGID) {
  894. inode->i_gid = dir->i_gid;
  895. if (S_ISDIR(mode))
  896. mode |= S_ISGID;
  897. } else {
  898. inode->i_gid = current->cred->fsgid;
  899. }
  900. inode->i_mode = mode;
  901. inode->i_ino = sbi->s_nextid++;
  902. inode->i_blkbits = EXOFS_BLKSHIFT;
  903. inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
  904. oi->i_commit_size = inode->i_size = 0;
  905. spin_lock(&sbi->s_next_gen_lock);
  906. inode->i_generation = sbi->s_next_generation++;
  907. spin_unlock(&sbi->s_next_gen_lock);
  908. insert_inode_hash(inode);
  909. mark_inode_dirty(inode);
  910. obj.partition = sbi->s_pid;
  911. obj.id = inode->i_ino + EXOFS_OBJ_OFF;
  912. exofs_make_credential(oi->i_cred, &obj);
  913. or = osd_start_request(sbi->s_dev, GFP_KERNEL);
  914. if (unlikely(!or)) {
  915. EXOFS_ERR("exofs_new_inode: osd_start_request failed\n");
  916. return ERR_PTR(-ENOMEM);
  917. }
  918. osd_req_create_object(or, &obj);
  919. /* increment the refcount so that the inode will still be around when we
  920. * reach the callback
  921. */
  922. atomic_inc(&inode->i_count);
  923. ret = exofs_async_op(or, create_done, inode, oi->i_cred);
  924. if (ret) {
  925. atomic_dec(&inode->i_count);
  926. osd_end_request(or);
  927. return ERR_PTR(-EIO);
  928. }
  929. atomic_inc(&sbi->s_curr_pending);
  930. return inode;
  931. }
  932. /*
  933. * struct to pass two arguments to update_inode's callback
  934. */
  935. struct updatei_args {
  936. struct exofs_sb_info *sbi;
  937. struct exofs_fcb fcb;
  938. };
  939. /*
  940. * Callback function from exofs_update_inode().
  941. */
  942. static void updatei_done(struct osd_request *or, void *p)
  943. {
  944. struct updatei_args *args = p;
  945. osd_end_request(or);
  946. atomic_dec(&args->sbi->s_curr_pending);
  947. kfree(args);
  948. }
  949. /*
  950. * Write the inode to the OSD. Just fill up the struct, and set the attribute
  951. * synchronously or asynchronously depending on the do_sync flag.
  952. */
  953. static int exofs_update_inode(struct inode *inode, int do_sync)
  954. {
  955. struct exofs_i_info *oi = exofs_i(inode);
  956. struct super_block *sb = inode->i_sb;
  957. struct exofs_sb_info *sbi = sb->s_fs_info;
  958. struct osd_obj_id obj = {sbi->s_pid, inode->i_ino + EXOFS_OBJ_OFF};
  959. struct osd_request *or;
  960. struct osd_attr attr;
  961. struct exofs_fcb *fcb;
  962. struct updatei_args *args;
  963. int ret;
  964. args = kzalloc(sizeof(*args), GFP_KERNEL);
  965. if (!args)
  966. return -ENOMEM;
  967. fcb = &args->fcb;
  968. fcb->i_mode = cpu_to_le16(inode->i_mode);
  969. fcb->i_uid = cpu_to_le32(inode->i_uid);
  970. fcb->i_gid = cpu_to_le32(inode->i_gid);
  971. fcb->i_links_count = cpu_to_le16(inode->i_nlink);
  972. fcb->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
  973. fcb->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
  974. fcb->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
  975. oi->i_commit_size = i_size_read(inode);
  976. fcb->i_size = cpu_to_le64(oi->i_commit_size);
  977. fcb->i_generation = cpu_to_le32(inode->i_generation);
  978. if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
  979. if (old_valid_dev(inode->i_rdev)) {
  980. fcb->i_data[0] =
  981. cpu_to_le32(old_encode_dev(inode->i_rdev));
  982. fcb->i_data[1] = 0;
  983. } else {
  984. fcb->i_data[0] = 0;
  985. fcb->i_data[1] =
  986. cpu_to_le32(new_encode_dev(inode->i_rdev));
  987. fcb->i_data[2] = 0;
  988. }
  989. } else
  990. memcpy(fcb->i_data, oi->i_data, sizeof(fcb->i_data));
  991. or = osd_start_request(sbi->s_dev, GFP_KERNEL);
  992. if (unlikely(!or)) {
  993. EXOFS_ERR("exofs_update_inode: osd_start_request failed.\n");
  994. ret = -ENOMEM;
  995. goto free_args;
  996. }
  997. osd_req_set_attributes(or, &obj);
  998. attr = g_attr_inode_data;
  999. attr.val_ptr = fcb;
  1000. osd_req_add_set_attr_list(or, &attr, 1);
  1001. if (!obj_created(oi)) {
  1002. EXOFS_DBGMSG("!obj_created\n");
  1003. BUG_ON(!obj_2bcreated(oi));
  1004. wait_event(oi->i_wq, obj_created(oi));
  1005. EXOFS_DBGMSG("wait_event done\n");
  1006. }
  1007. if (do_sync) {
  1008. ret = exofs_sync_op(or, sbi->s_timeout, oi->i_cred);
  1009. osd_end_request(or);
  1010. goto free_args;
  1011. } else {
  1012. args->sbi = sbi;
  1013. ret = exofs_async_op(or, updatei_done, args, oi->i_cred);
  1014. if (ret) {
  1015. osd_end_request(or);
  1016. goto free_args;
  1017. }
  1018. atomic_inc(&sbi->s_curr_pending);
  1019. goto out; /* deallocation in updatei_done */
  1020. }
  1021. free_args:
  1022. kfree(args);
  1023. out:
  1024. EXOFS_DBGMSG("ret=>%d\n", ret);
  1025. return ret;
  1026. }
  1027. int exofs_write_inode(struct inode *inode, int wait)
  1028. {
  1029. return exofs_update_inode(inode, wait);
  1030. }
  1031. /*
  1032. * Callback function from exofs_delete_inode() - don't have much cleaning up to
  1033. * do.
  1034. */
  1035. static void delete_done(struct osd_request *or, void *p)
  1036. {
  1037. struct exofs_sb_info *sbi;
  1038. osd_end_request(or);
  1039. sbi = p;
  1040. atomic_dec(&sbi->s_curr_pending);
  1041. }
  1042. /*
  1043. * Called when the refcount of an inode reaches zero. We remove the object
  1044. * from the OSD here. We make sure the object was created before we try and
  1045. * delete it.
  1046. */
  1047. void exofs_delete_inode(struct inode *inode)
  1048. {
  1049. struct exofs_i_info *oi = exofs_i(inode);
  1050. struct super_block *sb = inode->i_sb;
  1051. struct exofs_sb_info *sbi = sb->s_fs_info;
  1052. struct osd_obj_id obj = {sbi->s_pid, inode->i_ino + EXOFS_OBJ_OFF};
  1053. struct osd_request *or;
  1054. int ret;
  1055. truncate_inode_pages(&inode->i_data, 0);
  1056. if (is_bad_inode(inode))
  1057. goto no_delete;
  1058. mark_inode_dirty(inode);
  1059. exofs_update_inode(inode, inode_needs_sync(inode));
  1060. inode->i_size = 0;
  1061. if (inode->i_blocks)
  1062. exofs_truncate(inode);
  1063. clear_inode(inode);
  1064. or = osd_start_request(sbi->s_dev, GFP_KERNEL);
  1065. if (unlikely(!or)) {
  1066. EXOFS_ERR("exofs_delete_inode: osd_start_request failed\n");
  1067. return;
  1068. }
  1069. osd_req_remove_object(or, &obj);
  1070. /* if we are deleting an obj that hasn't been created yet, wait */
  1071. if (!obj_created(oi)) {
  1072. BUG_ON(!obj_2bcreated(oi));
  1073. wait_event(oi->i_wq, obj_created(oi));
  1074. }
  1075. ret = exofs_async_op(or, delete_done, sbi, oi->i_cred);
  1076. if (ret) {
  1077. EXOFS_ERR(
  1078. "ERROR: @exofs_delete_inode exofs_async_op failed\n");
  1079. osd_end_request(or);
  1080. return;
  1081. }
  1082. atomic_inc(&sbi->s_curr_pending);
  1083. return;
  1084. no_delete:
  1085. clear_inode(inode);
  1086. }