aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/namei.c
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-11-20 20:54:57 -0500
committerMark Fasheh <mfasheh@suse.com>2009-04-03 14:39:16 -0400
commit198a1ca3b735986542c538e38b9499ffcaed7005 (patch)
tree3b02034534c4640e72623088a59d1e942c38e7c3 /fs/ocfs2/namei.c
parente7c17e43090afe558c40bfb66637744c27bd2aeb (diff)
ocfs2: Increase max links count
Since we've now got a directory format capable of handling a large number of entries, we can increase the maximum link count supported. This only gets increased if the directory indexing feature is turned on. Signed-off-by: Mark Fasheh <mfasheh@suse.com> Acked-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/namei.c')
-rw-r--r--fs/ocfs2/namei.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index f911edc8378b..67113cfddc9b 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -255,13 +255,13 @@ static int ocfs2_mknod(struct inode *dir,
255 return status; 255 return status;
256 } 256 }
257 257
258 if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) { 258 if (S_ISDIR(mode) && (dir->i_nlink >= ocfs2_link_max(osb))) {
259 status = -EMLINK; 259 status = -EMLINK;
260 goto leave; 260 goto leave;
261 } 261 }
262 262
263 dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data; 263 dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data;
264 if (!dirfe->i_links_count) { 264 if (!ocfs2_read_links_count(dirfe)) {
265 /* can't make a file in a deleted directory. */ 265 /* can't make a file in a deleted directory. */
266 status = -ENOENT; 266 status = -ENOENT;
267 goto leave; 267 goto leave;
@@ -381,7 +381,7 @@ static int ocfs2_mknod(struct inode *dir,
381 mlog_errno(status); 381 mlog_errno(status);
382 goto leave; 382 goto leave;
383 } 383 }
384 le16_add_cpu(&dirfe->i_links_count, 1); 384 ocfs2_add_links_count(dirfe, 1);
385 status = ocfs2_journal_dirty(handle, parent_fe_bh); 385 status = ocfs2_journal_dirty(handle, parent_fe_bh);
386 if (status < 0) { 386 if (status < 0) {
387 mlog_errno(status); 387 mlog_errno(status);
@@ -529,7 +529,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
529 fe->i_mode = cpu_to_le16(inode->i_mode); 529 fe->i_mode = cpu_to_le16(inode->i_mode);
530 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) 530 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
531 fe->id1.dev1.i_rdev = cpu_to_le64(huge_encode_dev(dev)); 531 fe->id1.dev1.i_rdev = cpu_to_le64(huge_encode_dev(dev));
532 fe->i_links_count = cpu_to_le16(inode->i_nlink); 532
533 ocfs2_set_links_count(fe, inode->i_nlink);
533 534
534 fe->i_last_eb_blk = 0; 535 fe->i_last_eb_blk = 0;
535 strcpy(fe->i_signature, OCFS2_INODE_SIGNATURE); 536 strcpy(fe->i_signature, OCFS2_INODE_SIGNATURE);
@@ -668,7 +669,7 @@ static int ocfs2_link(struct dentry *old_dentry,
668 } 669 }
669 670
670 fe = (struct ocfs2_dinode *) fe_bh->b_data; 671 fe = (struct ocfs2_dinode *) fe_bh->b_data;
671 if (le16_to_cpu(fe->i_links_count) >= OCFS2_LINK_MAX) { 672 if (ocfs2_read_links_count(fe) >= ocfs2_link_max(osb)) {
672 err = -EMLINK; 673 err = -EMLINK;
673 goto out_unlock_inode; 674 goto out_unlock_inode;
674 } 675 }
@@ -690,13 +691,13 @@ static int ocfs2_link(struct dentry *old_dentry,
690 691
691 inc_nlink(inode); 692 inc_nlink(inode);
692 inode->i_ctime = CURRENT_TIME; 693 inode->i_ctime = CURRENT_TIME;
693 fe->i_links_count = cpu_to_le16(inode->i_nlink); 694 ocfs2_set_links_count(fe, inode->i_nlink);
694 fe->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 695 fe->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
695 fe->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 696 fe->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
696 697
697 err = ocfs2_journal_dirty(handle, fe_bh); 698 err = ocfs2_journal_dirty(handle, fe_bh);
698 if (err < 0) { 699 if (err < 0) {
699 le16_add_cpu(&fe->i_links_count, -1); 700 ocfs2_add_links_count(fe, -1);
700 drop_nlink(inode); 701 drop_nlink(inode);
701 mlog_errno(err); 702 mlog_errno(err);
702 goto out_commit; 703 goto out_commit;
@@ -706,7 +707,7 @@ static int ocfs2_link(struct dentry *old_dentry,
706 OCFS2_I(inode)->ip_blkno, 707 OCFS2_I(inode)->ip_blkno,
707 parent_fe_bh, &lookup); 708 parent_fe_bh, &lookup);
708 if (err) { 709 if (err) {
709 le16_add_cpu(&fe->i_links_count, -1); 710 ocfs2_add_links_count(fe, -1);
710 drop_nlink(inode); 711 drop_nlink(inode);
711 mlog_errno(err); 712 mlog_errno(err);
712 goto out_commit; 713 goto out_commit;
@@ -895,7 +896,7 @@ static int ocfs2_unlink(struct inode *dir,
895 if (S_ISDIR(inode->i_mode)) 896 if (S_ISDIR(inode->i_mode))
896 drop_nlink(inode); 897 drop_nlink(inode);
897 drop_nlink(inode); 898 drop_nlink(inode);
898 fe->i_links_count = cpu_to_le16(inode->i_nlink); 899 ocfs2_set_links_count(fe, inode->i_nlink);
899 900
900 status = ocfs2_journal_dirty(handle, fe_bh); 901 status = ocfs2_journal_dirty(handle, fe_bh);
901 if (status < 0) { 902 if (status < 0) {
@@ -1139,7 +1140,7 @@ static int ocfs2_rename(struct inode *old_dir,
1139 } 1140 }
1140 1141
1141 if (!new_inode && new_dir != old_dir && 1142 if (!new_inode && new_dir != old_dir &&
1142 new_dir->i_nlink >= OCFS2_LINK_MAX) { 1143 new_dir->i_nlink >= ocfs2_link_max(osb)) {
1143 status = -EMLINK; 1144 status = -EMLINK;
1144 goto bail; 1145 goto bail;
1145 } 1146 }
@@ -1293,7 +1294,7 @@ static int ocfs2_rename(struct inode *old_dir,
1293 } 1294 }
1294 1295
1295 if (S_ISDIR(new_inode->i_mode) || 1296 if (S_ISDIR(new_inode->i_mode) ||
1296 (newfe->i_links_count == cpu_to_le16(1))){ 1297 (ocfs2_read_links_count(newfe) == 1)) {
1297 status = ocfs2_orphan_add(osb, handle, new_inode, 1298 status = ocfs2_orphan_add(osb, handle, new_inode,
1298 newfe, orphan_name, 1299 newfe, orphan_name,
1299 &orphan_insert, orphan_dir); 1300 &orphan_insert, orphan_dir);
@@ -1313,9 +1314,9 @@ static int ocfs2_rename(struct inode *old_dir,
1313 new_dir->i_version++; 1314 new_dir->i_version++;
1314 1315
1315 if (S_ISDIR(new_inode->i_mode)) 1316 if (S_ISDIR(new_inode->i_mode))
1316 newfe->i_links_count = 0; 1317 ocfs2_set_links_count(newfe, 0);
1317 else 1318 else
1318 le16_add_cpu(&newfe->i_links_count, -1); 1319 ocfs2_add_links_count(newfe, -1);
1319 1320
1320 status = ocfs2_journal_dirty(handle, newfe_bh); 1321 status = ocfs2_journal_dirty(handle, newfe_bh);
1321 if (status < 0) { 1322 if (status < 0) {
@@ -1409,14 +1410,13 @@ static int ocfs2_rename(struct inode *old_dir,
1409 } else { 1410 } else {
1410 struct ocfs2_dinode *fe; 1411 struct ocfs2_dinode *fe;
1411 status = ocfs2_journal_access_di(handle, old_dir, 1412 status = ocfs2_journal_access_di(handle, old_dir,
1412 old_dir_bh, 1413 old_dir_bh,
1413 OCFS2_JOURNAL_ACCESS_WRITE); 1414 OCFS2_JOURNAL_ACCESS_WRITE);
1414 fe = (struct ocfs2_dinode *) old_dir_bh->b_data; 1415 fe = (struct ocfs2_dinode *) old_dir_bh->b_data;
1415 fe->i_links_count = cpu_to_le16(old_dir->i_nlink); 1416 ocfs2_set_links_count(fe, old_dir->i_nlink);
1416 status = ocfs2_journal_dirty(handle, old_dir_bh); 1417 status = ocfs2_journal_dirty(handle, old_dir_bh);
1417 } 1418 }
1418 } 1419 }
1419
1420 ocfs2_dentry_move(old_dentry, new_dentry, old_dir, new_dir); 1420 ocfs2_dentry_move(old_dentry, new_dentry, old_dir, new_dir);
1421 status = 0; 1421 status = 0;
1422bail: 1422bail:
@@ -1614,7 +1614,7 @@ static int ocfs2_symlink(struct inode *dir,
1614 } 1614 }
1615 1615
1616 dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data; 1616 dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data;
1617 if (!dirfe->i_links_count) { 1617 if (!ocfs2_read_links_count(dirfe)) {
1618 /* can't make a file in a deleted directory. */ 1618 /* can't make a file in a deleted directory. */
1619 status = -ENOENT; 1619 status = -ENOENT;
1620 goto bail; 1620 goto bail;
@@ -1932,8 +1932,8 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb,
1932 * underneath us... */ 1932 * underneath us... */
1933 orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data; 1933 orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data;
1934 if (S_ISDIR(inode->i_mode)) 1934 if (S_ISDIR(inode->i_mode))
1935 le16_add_cpu(&orphan_fe->i_links_count, 1); 1935 ocfs2_add_links_count(orphan_fe, 1);
1936 orphan_dir_inode->i_nlink = le16_to_cpu(orphan_fe->i_links_count); 1936 orphan_dir_inode->i_nlink = ocfs2_read_links_count(orphan_fe);
1937 1937
1938 status = ocfs2_journal_dirty(handle, orphan_dir_bh); 1938 status = ocfs2_journal_dirty(handle, orphan_dir_bh);
1939 if (status < 0) { 1939 if (status < 0) {
@@ -2016,8 +2016,8 @@ int ocfs2_orphan_del(struct ocfs2_super *osb,
2016 /* do the i_nlink dance! :) */ 2016 /* do the i_nlink dance! :) */
2017 orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data; 2017 orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data;
2018 if (S_ISDIR(inode->i_mode)) 2018 if (S_ISDIR(inode->i_mode))
2019 le16_add_cpu(&orphan_fe->i_links_count, -1); 2019 ocfs2_add_links_count(orphan_fe, -1);
2020 orphan_dir_inode->i_nlink = le16_to_cpu(orphan_fe->i_links_count); 2020 orphan_dir_inode->i_nlink = ocfs2_read_links_count(orphan_fe);
2021 2021
2022 status = ocfs2_journal_dirty(handle, orphan_dir_bh); 2022 status = ocfs2_journal_dirty(handle, orphan_dir_bh);
2023 if (status < 0) { 2023 if (status < 0) {