log.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. /*
  2. * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  3. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
  4. *
  5. * This copyrighted material is made available to anyone wishing to use,
  6. * modify, copy, or redistribute it subject to the terms and conditions
  7. * of the GNU General Public License v.2.
  8. */
  9. #include <linux/sched.h>
  10. #include <linux/slab.h>
  11. #include <linux/spinlock.h>
  12. #include <linux/completion.h>
  13. #include <linux/buffer_head.h>
  14. #include <linux/gfs2_ondisk.h>
  15. #include <linux/crc32.h>
  16. #include "gfs2.h"
  17. #include "lm_interface.h"
  18. #include "incore.h"
  19. #include "bmap.h"
  20. #include "glock.h"
  21. #include "log.h"
  22. #include "lops.h"
  23. #include "meta_io.h"
  24. #include "util.h"
  25. #include "dir.h"
  26. #define PULL 1
  27. /**
  28. * gfs2_struct2blk - compute stuff
  29. * @sdp: the filesystem
  30. * @nstruct: the number of structures
  31. * @ssize: the size of the structures
  32. *
  33. * Compute the number of log descriptor blocks needed to hold a certain number
  34. * of structures of a certain size.
  35. *
  36. * Returns: the number of blocks needed (minimum is always 1)
  37. */
  38. unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
  39. unsigned int ssize)
  40. {
  41. unsigned int blks;
  42. unsigned int first, second;
  43. blks = 1;
  44. first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) /
  45. ssize;
  46. if (nstruct > first) {
  47. second = (sdp->sd_sb.sb_bsize -
  48. sizeof(struct gfs2_meta_header)) / ssize;
  49. blks += DIV_ROUND_UP(nstruct - first, second);
  50. }
  51. return blks;
  52. }
  53. void gfs2_ail1_start(struct gfs2_sbd *sdp, int flags)
  54. {
  55. struct list_head *head = &sdp->sd_ail1_list;
  56. uint64_t sync_gen;
  57. struct list_head *first, *tmp;
  58. struct gfs2_ail *first_ai, *ai;
  59. gfs2_log_lock(sdp);
  60. if (list_empty(head)) {
  61. gfs2_log_unlock(sdp);
  62. return;
  63. }
  64. sync_gen = sdp->sd_ail_sync_gen++;
  65. first = head->prev;
  66. first_ai = list_entry(first, struct gfs2_ail, ai_list);
  67. first_ai->ai_sync_gen = sync_gen;
  68. gfs2_ail1_start_one(sdp, first_ai);
  69. if (flags & DIO_ALL)
  70. first = NULL;
  71. for (;;) {
  72. if (first && (head->prev != first ||
  73. gfs2_ail1_empty_one(sdp, first_ai, 0)))
  74. break;
  75. for (tmp = head->prev; tmp != head; tmp = tmp->prev) {
  76. ai = list_entry(tmp, struct gfs2_ail, ai_list);
  77. if (ai->ai_sync_gen >= sync_gen)
  78. continue;
  79. ai->ai_sync_gen = sync_gen;
  80. gfs2_ail1_start_one(sdp, ai);
  81. break;
  82. }
  83. if (tmp == head)
  84. break;
  85. }
  86. gfs2_log_unlock(sdp);
  87. }
  88. int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags)
  89. {
  90. struct gfs2_ail *ai, *s;
  91. int ret;
  92. gfs2_log_lock(sdp);
  93. list_for_each_entry_safe_reverse(ai, s, &sdp->sd_ail1_list, ai_list) {
  94. if (gfs2_ail1_empty_one(sdp, ai, flags))
  95. list_move(&ai->ai_list, &sdp->sd_ail2_list);
  96. else if (!(flags & DIO_ALL))
  97. break;
  98. }
  99. ret = list_empty(&sdp->sd_ail1_list);
  100. gfs2_log_unlock(sdp);
  101. return ret;
  102. }
  103. static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail)
  104. {
  105. struct gfs2_ail *ai, *safe;
  106. unsigned int old_tail = sdp->sd_log_tail;
  107. int wrap = (new_tail < old_tail);
  108. int a, b, rm;
  109. gfs2_log_lock(sdp);
  110. list_for_each_entry_safe(ai, safe, &sdp->sd_ail2_list, ai_list) {
  111. a = (old_tail <= ai->ai_first);
  112. b = (ai->ai_first < new_tail);
  113. rm = (wrap) ? (a || b) : (a && b);
  114. if (!rm)
  115. continue;
  116. gfs2_ail2_empty_one(sdp, ai);
  117. list_del(&ai->ai_list);
  118. gfs2_assert_warn(sdp, list_empty(&ai->ai_ail1_list));
  119. gfs2_assert_warn(sdp, list_empty(&ai->ai_ail2_list));
  120. kfree(ai);
  121. }
  122. gfs2_log_unlock(sdp);
  123. }
  124. /**
  125. * gfs2_log_reserve - Make a log reservation
  126. * @sdp: The GFS2 superblock
  127. * @blks: The number of blocks to reserve
  128. *
  129. * Returns: errno
  130. */
  131. int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks)
  132. {
  133. unsigned int try = 0;
  134. if (gfs2_assert_warn(sdp, blks) ||
  135. gfs2_assert_warn(sdp, blks <= sdp->sd_jdesc->jd_blocks))
  136. return -EINVAL;
  137. mutex_lock(&sdp->sd_log_reserve_mutex);
  138. gfs2_log_lock(sdp);
  139. while(sdp->sd_log_blks_free <= blks) {
  140. gfs2_log_unlock(sdp);
  141. gfs2_ail1_empty(sdp, 0);
  142. gfs2_log_flush(sdp, NULL);
  143. if (try++)
  144. gfs2_ail1_start(sdp, 0);
  145. gfs2_log_lock(sdp);
  146. }
  147. sdp->sd_log_blks_free -= blks;
  148. /* printk(KERN_INFO "reserved %u blocks (%u left)\n", blks, sdp->sd_log_blks_free); */
  149. gfs2_log_unlock(sdp);
  150. mutex_unlock(&sdp->sd_log_reserve_mutex);
  151. down_read(&sdp->sd_log_flush_lock);
  152. return 0;
  153. }
  154. /**
  155. * gfs2_log_release - Release a given number of log blocks
  156. * @sdp: The GFS2 superblock
  157. * @blks: The number of blocks
  158. *
  159. */
  160. void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
  161. {
  162. gfs2_log_lock(sdp);
  163. sdp->sd_log_blks_free += blks;
  164. /* printk(KERN_INFO "released %u blocks (%u left)\n", blks, sdp->sd_log_blks_free); */
  165. gfs2_assert_withdraw(sdp,
  166. sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
  167. gfs2_log_unlock(sdp);
  168. up_read(&sdp->sd_log_flush_lock);
  169. }
  170. static uint64_t log_bmap(struct gfs2_sbd *sdp, unsigned int lbn)
  171. {
  172. int new = 0;
  173. uint64_t dbn;
  174. int error;
  175. int bdy;
  176. error = gfs2_block_map(sdp->sd_jdesc->jd_inode, lbn, &new, &dbn, &bdy);
  177. if (!(!error && dbn)) {
  178. printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, (unsigned long long)dbn, lbn);
  179. }
  180. gfs2_assert_withdraw(sdp, !error && dbn);
  181. return dbn;
  182. }
  183. /**
  184. * log_distance - Compute distance between two journal blocks
  185. * @sdp: The GFS2 superblock
  186. * @newer: The most recent journal block of the pair
  187. * @older: The older journal block of the pair
  188. *
  189. * Compute the distance (in the journal direction) between two
  190. * blocks in the journal
  191. *
  192. * Returns: the distance in blocks
  193. */
  194. static inline unsigned int log_distance(struct gfs2_sbd *sdp,
  195. unsigned int newer,
  196. unsigned int older)
  197. {
  198. int dist;
  199. dist = newer - older;
  200. if (dist < 0)
  201. dist += sdp->sd_jdesc->jd_blocks;
  202. return dist;
  203. }
  204. static unsigned int current_tail(struct gfs2_sbd *sdp)
  205. {
  206. struct gfs2_ail *ai;
  207. unsigned int tail;
  208. gfs2_log_lock(sdp);
  209. if (list_empty(&sdp->sd_ail1_list))
  210. tail = sdp->sd_log_head;
  211. else {
  212. ai = list_entry(sdp->sd_ail1_list.prev, struct gfs2_ail,
  213. ai_list);
  214. tail = ai->ai_first;
  215. }
  216. gfs2_log_unlock(sdp);
  217. return tail;
  218. }
  219. static inline void log_incr_head(struct gfs2_sbd *sdp)
  220. {
  221. if (sdp->sd_log_flush_head == sdp->sd_log_tail)
  222. gfs2_assert_withdraw(sdp,
  223. sdp->sd_log_flush_head == sdp->sd_log_head);
  224. if (++sdp->sd_log_flush_head == sdp->sd_jdesc->jd_blocks) {
  225. sdp->sd_log_flush_head = 0;
  226. sdp->sd_log_flush_wrapped = 1;
  227. }
  228. }
  229. /**
  230. * gfs2_log_get_buf - Get and initialize a buffer to use for log control data
  231. * @sdp: The GFS2 superblock
  232. *
  233. * Returns: the buffer_head
  234. */
  235. struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp)
  236. {
  237. uint64_t blkno = log_bmap(sdp, sdp->sd_log_flush_head);
  238. struct gfs2_log_buf *lb;
  239. struct buffer_head *bh;
  240. lb = kzalloc(sizeof(struct gfs2_log_buf), GFP_NOFS | __GFP_NOFAIL);
  241. list_add(&lb->lb_list, &sdp->sd_log_flush_list);
  242. bh = lb->lb_bh = sb_getblk(sdp->sd_vfs, blkno);
  243. lock_buffer(bh);
  244. memset(bh->b_data, 0, bh->b_size);
  245. set_buffer_uptodate(bh);
  246. clear_buffer_dirty(bh);
  247. unlock_buffer(bh);
  248. log_incr_head(sdp);
  249. return bh;
  250. }
  251. /**
  252. * gfs2_log_fake_buf - Build a fake buffer head to write metadata buffer to log
  253. * @sdp: the filesystem
  254. * @data: the data the buffer_head should point to
  255. *
  256. * Returns: the log buffer descriptor
  257. */
  258. struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp,
  259. struct buffer_head *real)
  260. {
  261. uint64_t blkno = log_bmap(sdp, sdp->sd_log_flush_head);
  262. struct gfs2_log_buf *lb;
  263. struct buffer_head *bh;
  264. lb = kzalloc(sizeof(struct gfs2_log_buf), GFP_NOFS | __GFP_NOFAIL);
  265. list_add(&lb->lb_list, &sdp->sd_log_flush_list);
  266. lb->lb_real = real;
  267. bh = lb->lb_bh = alloc_buffer_head(GFP_NOFS | __GFP_NOFAIL);
  268. atomic_set(&bh->b_count, 1);
  269. bh->b_state = (1 << BH_Mapped) | (1 << BH_Uptodate);
  270. set_bh_page(bh, real->b_page, bh_offset(real));
  271. bh->b_blocknr = blkno;
  272. bh->b_size = sdp->sd_sb.sb_bsize;
  273. bh->b_bdev = sdp->sd_vfs->s_bdev;
  274. log_incr_head(sdp);
  275. return bh;
  276. }
  277. static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail, int pull)
  278. {
  279. unsigned int dist = log_distance(sdp, new_tail, sdp->sd_log_tail);
  280. ail2_empty(sdp, new_tail);
  281. gfs2_log_lock(sdp);
  282. sdp->sd_log_blks_free += dist - ((pull) ? 1 : 0);
  283. /* printk(KERN_INFO "pull tail refunding %u blocks (%u left) pull=%d\n", dist - ((pull) ? 1 : 0), sdp->sd_log_blks_free, pull); */
  284. gfs2_assert_withdraw(sdp,
  285. sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
  286. gfs2_log_unlock(sdp);
  287. sdp->sd_log_tail = new_tail;
  288. }
  289. /**
  290. * log_write_header - Get and initialize a journal header buffer
  291. * @sdp: The GFS2 superblock
  292. *
  293. * Returns: the initialized log buffer descriptor
  294. */
  295. static void log_write_header(struct gfs2_sbd *sdp, uint32_t flags, int pull)
  296. {
  297. uint64_t blkno = log_bmap(sdp, sdp->sd_log_flush_head);
  298. struct buffer_head *bh;
  299. struct gfs2_log_header *lh;
  300. unsigned int tail;
  301. uint32_t hash;
  302. /* printk(KERN_INFO "log write header start (flags=%08x, pull=%d)\n", flags, pull); */
  303. bh = sb_getblk(sdp->sd_vfs, blkno);
  304. lock_buffer(bh);
  305. memset(bh->b_data, 0, bh->b_size);
  306. set_buffer_uptodate(bh);
  307. clear_buffer_dirty(bh);
  308. unlock_buffer(bh);
  309. gfs2_ail1_empty(sdp, 0);
  310. tail = current_tail(sdp);
  311. lh = (struct gfs2_log_header *)bh->b_data;
  312. memset(lh, 0, sizeof(struct gfs2_log_header));
  313. lh->lh_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
  314. lh->lh_header.mh_type = cpu_to_be32(GFS2_METATYPE_LH);
  315. lh->lh_header.mh_format = cpu_to_be32(GFS2_FORMAT_LH);
  316. lh->lh_sequence = cpu_to_be64(sdp->sd_log_sequence++);
  317. lh->lh_flags = cpu_to_be32(flags);
  318. lh->lh_tail = cpu_to_be32(tail);
  319. lh->lh_blkno = cpu_to_be32(sdp->sd_log_flush_head);
  320. hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header));
  321. lh->lh_hash = cpu_to_be32(hash);
  322. set_buffer_dirty(bh);
  323. if (sync_dirty_buffer(bh))
  324. gfs2_io_error_bh(sdp, bh);
  325. brelse(bh);
  326. if (sdp->sd_log_tail != tail)
  327. log_pull_tail(sdp, tail, pull);
  328. else
  329. gfs2_assert_withdraw(sdp, !pull);
  330. sdp->sd_log_idle = (tail == sdp->sd_log_flush_head);
  331. log_incr_head(sdp);
  332. /* printk(KERN_INFO "log write header out\n"); */
  333. }
  334. static void log_flush_commit(struct gfs2_sbd *sdp)
  335. {
  336. struct list_head *head = &sdp->sd_log_flush_list;
  337. struct gfs2_log_buf *lb;
  338. struct buffer_head *bh;
  339. #if 0
  340. unsigned int d;
  341. d = log_distance(sdp, sdp->sd_log_flush_head, sdp->sd_log_head);
  342. gfs2_assert_withdraw(sdp, d + 1 == sdp->sd_log_blks_reserved);
  343. #endif
  344. while (!list_empty(head)) {
  345. lb = list_entry(head->next, struct gfs2_log_buf, lb_list);
  346. list_del(&lb->lb_list);
  347. bh = lb->lb_bh;
  348. wait_on_buffer(bh);
  349. if (!buffer_uptodate(bh))
  350. gfs2_io_error_bh(sdp, bh);
  351. if (lb->lb_real) {
  352. while (atomic_read(&bh->b_count) != 1) /* Grrrr... */
  353. schedule();
  354. free_buffer_head(bh);
  355. } else
  356. brelse(bh);
  357. kfree(lb);
  358. }
  359. log_write_header(sdp, 0, 0);
  360. }
  361. /**
  362. * gfs2_log_flush - flush incore transaction(s)
  363. * @sdp: the filesystem
  364. * @gl: The glock structure to flush. If NULL, flush the whole incore log
  365. *
  366. */
  367. void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
  368. {
  369. struct gfs2_ail *ai;
  370. down_write(&sdp->sd_log_flush_lock);
  371. if (gl) {
  372. gfs2_log_lock(sdp);
  373. if (list_empty(&gl->gl_le.le_list)) {
  374. gfs2_log_unlock(sdp);
  375. up_write(&sdp->sd_log_flush_lock);
  376. return;
  377. }
  378. gfs2_log_unlock(sdp);
  379. }
  380. ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL);
  381. INIT_LIST_HEAD(&ai->ai_ail1_list);
  382. INIT_LIST_HEAD(&ai->ai_ail2_list);
  383. gfs2_assert_withdraw(sdp,
  384. sdp->sd_log_num_buf == sdp->sd_log_commited_buf);
  385. gfs2_assert_withdraw(sdp,
  386. sdp->sd_log_num_revoke == sdp->sd_log_commited_revoke);
  387. sdp->sd_log_flush_head = sdp->sd_log_head;
  388. sdp->sd_log_flush_wrapped = 0;
  389. ai->ai_first = sdp->sd_log_flush_head;
  390. lops_before_commit(sdp);
  391. if (!list_empty(&sdp->sd_log_flush_list))
  392. log_flush_commit(sdp);
  393. else if (sdp->sd_log_tail != current_tail(sdp) && !sdp->sd_log_idle)
  394. log_write_header(sdp, 0, PULL);
  395. lops_after_commit(sdp, ai);
  396. sdp->sd_log_head = sdp->sd_log_flush_head;
  397. /* printk(KERN_INFO "sd_log_num_hdrs %u\n", sdp->sd_log_num_hdrs); */
  398. sdp->sd_log_blks_free -= sdp->sd_log_num_hdrs;
  399. sdp->sd_log_blks_reserved =
  400. sdp->sd_log_commited_buf =
  401. sdp->sd_log_num_hdrs =
  402. sdp->sd_log_commited_revoke = 0;
  403. gfs2_log_lock(sdp);
  404. if (!list_empty(&ai->ai_ail1_list)) {
  405. list_add(&ai->ai_list, &sdp->sd_ail1_list);
  406. ai = NULL;
  407. }
  408. gfs2_log_unlock(sdp);
  409. sdp->sd_vfs->s_dirt = 0;
  410. up_write(&sdp->sd_log_flush_lock);
  411. kfree(ai);
  412. }
  413. static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
  414. {
  415. unsigned int reserved = 1;
  416. unsigned int old;
  417. gfs2_log_lock(sdp);
  418. sdp->sd_log_commited_buf += tr->tr_num_buf_new - tr->tr_num_buf_rm;
  419. gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_buf) >= 0);
  420. sdp->sd_log_commited_revoke += tr->tr_num_revoke - tr->tr_num_revoke_rm;
  421. gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_revoke) >= 0);
  422. if (sdp->sd_log_commited_buf)
  423. reserved += sdp->sd_log_commited_buf;
  424. if (sdp->sd_log_commited_revoke)
  425. reserved += gfs2_struct2blk(sdp, sdp->sd_log_commited_revoke,
  426. sizeof(uint64_t));
  427. old = sdp->sd_log_blks_free;
  428. sdp->sd_log_blks_free += tr->tr_reserved -
  429. (reserved - sdp->sd_log_blks_reserved);
  430. gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free >= old);
  431. gfs2_assert_withdraw(sdp,
  432. sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks +
  433. sdp->sd_log_num_hdrs);
  434. sdp->sd_log_blks_reserved = reserved;
  435. gfs2_log_unlock(sdp);
  436. }
  437. /**
  438. * gfs2_log_commit - Commit a transaction to the log
  439. * @sdp: the filesystem
  440. * @tr: the transaction
  441. *
  442. * Returns: errno
  443. */
  444. void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
  445. {
  446. log_refund(sdp, tr);
  447. lops_incore_commit(sdp, tr);
  448. sdp->sd_vfs->s_dirt = 1;
  449. up_read(&sdp->sd_log_flush_lock);
  450. gfs2_log_lock(sdp);
  451. if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) {
  452. gfs2_log_unlock(sdp);
  453. gfs2_log_flush(sdp, NULL);
  454. } else
  455. gfs2_log_unlock(sdp);
  456. }
  457. /**
  458. * gfs2_log_shutdown - write a shutdown header into a journal
  459. * @sdp: the filesystem
  460. *
  461. */
  462. void gfs2_log_shutdown(struct gfs2_sbd *sdp)
  463. {
  464. down_write(&sdp->sd_log_flush_lock);
  465. gfs2_assert_withdraw(sdp, !sdp->sd_log_blks_reserved);
  466. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_gl);
  467. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_buf);
  468. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_jdata);
  469. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke);
  470. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_rg);
  471. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_databuf);
  472. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_hdrs);
  473. gfs2_assert_withdraw(sdp, list_empty(&sdp->sd_ail1_list));
  474. sdp->sd_log_flush_head = sdp->sd_log_head;
  475. sdp->sd_log_flush_wrapped = 0;
  476. log_write_header(sdp, GFS2_LOG_HEAD_UNMOUNT, 0);
  477. /* printk(KERN_INFO "sd_log_blks_free %u, sd_jdesc->jd_blocks %u\n", sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); */
  478. gfs2_assert_warn(sdp, sdp->sd_log_blks_free == sdp->sd_jdesc->jd_blocks);
  479. gfs2_assert_warn(sdp, sdp->sd_log_head == sdp->sd_log_tail);
  480. gfs2_assert_warn(sdp, list_empty(&sdp->sd_ail2_list));
  481. sdp->sd_log_head = sdp->sd_log_flush_head;
  482. sdp->sd_log_tail = sdp->sd_log_head;
  483. up_write(&sdp->sd_log_flush_lock);
  484. }