aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inline.c
diff options
context:
space:
mode:
authorTao Ma <boyu.mt@taobao.com>2012-12-10 14:06:00 -0500
committerTheodore Ts'o <tytso@mit.edu>2012-12-10 14:06:00 -0500
commite8e948e7802a2ab05c146d3e72a39b93b5718236 (patch)
tree3e6914f6b16c457e0d14cee75bf0149f730bbd99 /fs/ext4/inline.c
parent7335cd3b41b1e704608ca46159641ca9cb598121 (diff)
ext4: let ext4_find_entry handle inline data
Create a new function ext4_find_inline_entry() to handle the case of inline data. Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inline.c')
-rw-r--r--fs/ext4/inline.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 471504133c76..0a8f5a865496 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1462,6 +1462,54 @@ out:
1462 return ret; 1462 return ret;
1463} 1463}
1464 1464
1465struct buffer_head *ext4_find_inline_entry(struct inode *dir,
1466 const struct qstr *d_name,
1467 struct ext4_dir_entry_2 **res_dir,
1468 int *has_inline_data)
1469{
1470 int ret;
1471 struct ext4_iloc iloc;
1472 void *inline_start;
1473 int inline_size;
1474
1475 if (ext4_get_inode_loc(dir, &iloc))
1476 return NULL;
1477
1478 down_read(&EXT4_I(dir)->xattr_sem);
1479 if (!ext4_has_inline_data(dir)) {
1480 *has_inline_data = 0;
1481 goto out;
1482 }
1483
1484 inline_start = (void *)ext4_raw_inode(&iloc)->i_block +
1485 EXT4_INLINE_DOTDOT_SIZE;
1486 inline_size = EXT4_MIN_INLINE_DATA_SIZE - EXT4_INLINE_DOTDOT_SIZE;
1487 ret = search_dir(iloc.bh, inline_start, inline_size,
1488 dir, d_name, 0, res_dir);
1489 if (ret == 1)
1490 goto out_find;
1491 if (ret < 0)
1492 goto out;
1493
1494 if (ext4_get_inline_size(dir) == EXT4_MIN_INLINE_DATA_SIZE)
1495 goto out;
1496
1497 inline_start = ext4_get_inline_xattr_pos(dir, &iloc);
1498 inline_size = ext4_get_inline_size(dir) - EXT4_MIN_INLINE_DATA_SIZE;
1499
1500 ret = search_dir(iloc.bh, inline_start, inline_size,
1501 dir, d_name, 0, res_dir);
1502 if (ret == 1)
1503 goto out_find;
1504
1505out:
1506 brelse(iloc.bh);
1507 iloc.bh = NULL;
1508out_find:
1509 up_read(&EXT4_I(dir)->xattr_sem);
1510 return iloc.bh;
1511}
1512
1465int ext4_destroy_inline_data(handle_t *handle, struct inode *inode) 1513int ext4_destroy_inline_data(handle_t *handle, struct inode *inode)
1466{ 1514{
1467 int ret; 1515 int ret;